ETH Price: $3,334.54 (-0.26%)

Contract

0x6417084B8Df644e1d7E32BE39B54F3a5BbEA645B
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Settle209911322024-10-18 8:03:5970 days ago1729238639IN
0x6417084B...5BbEA645B
0 ETH0.0029055142.06679293
Settle200330512024-06-06 13:21:23204 days ago1717680083IN
0x6417084B...5BbEA645B
0 ETH0.0016290818.92440356

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xFFf0d064...7e31DFb0D
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
SpotOracle

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 2 : SpotOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.10;

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

contract SpotOracle {
    mapping(uint256 => uint256) public settlePrices;
    AggregatorV3Interface immutable internal PRICEFEED;
    uint256 public latestExpiryUpdated = 0;

    event Settled(uint256 expiry, uint256 settlePrice);

    constructor(
        AggregatorV3Interface priceFeed
    ) {
        PRICEFEED = priceFeed;
    }

    // settle price
    function settle() public {
        uint256 expiry = block.timestamp - block.timestamp % 86400 + 28800;
        require(block.timestamp >= expiry, "Oracle: not expired");
        require(settlePrices[expiry] == 0, "Oracle: already settled");

        uint256 currentPrice = uint256(getLatestPrice());
        if (latestExpiryUpdated != 0 && latestExpiryUpdated <= expiry - 86400 * 2) {
            uint256 missedDays = (expiry - latestExpiryUpdated) / 86400;
            uint256 startPrice = settlePrices[latestExpiryUpdated];

            for (uint256 i = 1; i < missedDays; i++) {
                uint256 missedExpiry = latestExpiryUpdated + i * 86400;
                uint256 missedDayPrice;
                if (startPrice > currentPrice) {
                    missedDayPrice = startPrice - (startPrice - currentPrice) * i / missedDays;
                } else {
                    missedDayPrice = startPrice + (currentPrice - startPrice) * i / missedDays;
                }
                settlePrices[missedExpiry] = missedDayPrice;
                emit Settled(missedExpiry, missedDayPrice);
            }
        }

        settlePrices[expiry] = currentPrice;
        latestExpiryUpdated = expiry;

        emit Settled(expiry, currentPrice);
    }

    function getLatestPrice() internal view returns (int) {
        // prettier-ignore
        (
            /* uint80 roundID */,
            int price,
            /*uint startedAt*/,
            /*uint timeStamp*/,
            /*uint80 answeredInRound*/
        ) = PRICEFEED.latestRoundData();
        require(price > 0, "Oracle: invalid price");

        return price;
    }
}

File 2 of 2 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  function getRoundData(
    uint80 _roundId
  ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

  function latestRoundData()
    external
    view
    returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"expiry","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settlePrice","type":"uint256"}],"name":"Settled","type":"event"},{"inputs":[],"name":"latestExpiryUpdated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"settle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"settlePrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100415760003560e01c806311da60b4146100465780636f31322314610050578063f0ea68aa1461006b575b600080fd5b61004e61008b565b005b61005960015481565b60405190815260200160405180910390f35b6100596100793660046103da565b60006020819052908152604090205481565b600061009a6201518042610409565b6100a49042610433565b6100b09061708061044a565b9050804210156100fd5760405162461bcd60e51b815260206004820152601360248201527213dc9858db194e881b9bdd08195e1c1a5c9959606a1b60448201526064015b60405180910390fd5b600081815260208190526040902054156101595760405162461bcd60e51b815260206004820152601760248201527f4f7261636c653a20616c726561647920736574746c656400000000000000000060448201526064016100f4565b6000610163610302565b905060015460001415801561018657506101806202a30083610433565b60015411155b156102b0576000620151806001548461019f9190610433565b6101a99190610462565b600180546000908152602081905260409020549192505b828110156102ac5760006101d78262015180610476565b6001546101e4919061044a565b90506000858411156102215784836101fc8887610433565b6102069190610476565b6102109190610462565b61021a9085610433565b905061024e565b848361022d8689610433565b6102379190610476565b6102419190610462565b61024b908561044a565b90505b6000828152602081815260409182902083905581518481529081018390527ff5b268a3ff315cc44ccceeef86259c9e8eef81ceecb14001543809115380dd62910160405180910390a1505080806102a490610495565b9150506101c0565b5050505b60008281526020818152604091829020839055600184905581518481529081018390527ff5b268a3ff315cc44ccceeef86259c9e8eef81ceecb14001543809115380dd62910160405180910390a15050565b6000807f0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b84196001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610363573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038791906104ca565b505050915050600081136103d55760405162461bcd60e51b81526020600482015260156024820152744f7261636c653a20696e76616c696420707269636560581b60448201526064016100f4565b919050565b6000602082840312156103ec57600080fd5b5035919050565b634e487b7160e01b600052601260045260246000fd5b600082610418576104186103f3565b500690565b634e487b7160e01b600052601160045260246000fd5b6000828210156104455761044561041d565b500390565b6000821982111561045d5761045d61041d565b500190565b600082610471576104716103f3565b500490565b60008160001904831182151516156104905761049061041d565b500290565b60006000198214156104a9576104a961041d565b5060010190565b805169ffffffffffffffffffff811681146103d557600080fd5b600080600080600060a086880312156104e257600080fd5b6104eb866104b0565b945060208601519350604086015192506060860151915061050e608087016104b0565b9050929550929590935056fea2646970667358221220deb63b9a6d452d0003e208ee5a7d2541f7fd5794bb0d308185d0c66644c6ae2d64736f6c634300080a0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.