Address Details
contract

0xc44831f5f424A95465720bda94110AB0140Afc93

Contract Name
BlocklessTCO2eOracle
Creator
0x437c69–882e3a at 0xda15a7–0ee2dd
Balance
0 CELO ( )
Tokens
Fetching tokens...
Transactions
676 Transactions
Transfers
0 Transfers
Gas Used
24,116,571
Last Balance Update
14868164
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
BlocklessTCO2eOracle




Optimization enabled
false
Compiler version
v0.8.7+commit.e28d00a7




EVM Version
london




Verified at
2023-01-24T21:41:40.051482Z

contracts/BlocklessTCO2eOracle.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./BlsOracleInterface.sol";

contract BlocklessTCO2eOracle is BlsOracleInterface {
    string private _id;
    string private _description;
    uint8 private _decimals;

    int256 private _latestAnswer;
    uint256 private _latestTimestamp;
    uint256 private _latestRound;
    
    address public _owner;

    event NewBlsOraclePrice(
        int256 indexed current,
        uint256 indexed roundId,
        uint256 updatedAt
    );

    event NewBlsOracleQuery(
        address indexed _from,
        string indexed _id,
        uint timestamp
    );

    event NewOwner(address oldOwner, address newOwner);

    modifier onlyOwner() {
        require(msg.sender == _owner, "only admin may call");
        _;
    }

    constructor(
        string memory id,
        string memory description,
        uint8 decimals_
    ) {
        _owner = msg.sender;
        _id = id;
        _description = description;
        _decimals = decimals_;
    }

    function setOwner(address newOwner) external onlyOwner {
        address oldOwner = _owner;
        _owner = newOwner;

        emit NewOwner(oldOwner, newOwner);
    }

    function decimals() external view override returns (uint8) {
        return _decimals;
    }

    function latestAnswer() external view override returns (int256) {
        return _latestAnswer;
    }

    function latestTimestamp() external view override returns (uint256) {
        return _latestTimestamp;
    }

    function latestRound() external view override returns (uint256) {
        return _latestRound;
    }

    /**
     * Emit a Blockless Oracle Query here
     *
     */
    function update() external {
        require(msg.sender == _owner);
        
        emit NewBlsOracleQuery(msg.sender, _id, block.timestamp);
    }

    function __callback(int256 _price) external {
        require(msg.sender == _owner);

        _latestAnswer = _price;
        _latestRound = block.number;
        _latestTimestamp = block.timestamp;

        emit NewBlsOraclePrice(_price, _latestRound, _latestTimestamp);
    }
}
        

/contracts/BlsOracleInterface.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

  function latestAnswer() external view returns (int256);

  function latestTimestamp() external view returns (uint256);

  function latestRound() external view returns (uint256);

  event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"string","name":"id","internalType":"string"},{"type":"string","name":"description","internalType":"string"},{"type":"uint8","name":"decimals_","internalType":"uint8"}]},{"type":"event","name":"AnswerUpdated","inputs":[{"type":"int256","name":"current","internalType":"int256","indexed":true},{"type":"uint256","name":"roundId","internalType":"uint256","indexed":true},{"type":"uint256","name":"updatedAt","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NewBlsOraclePrice","inputs":[{"type":"int256","name":"current","internalType":"int256","indexed":true},{"type":"uint256","name":"roundId","internalType":"uint256","indexed":true},{"type":"uint256","name":"updatedAt","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NewBlsOracleQuery","inputs":[{"type":"address","name":"_from","internalType":"address","indexed":true},{"type":"string","name":"_id","internalType":"string","indexed":true},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NewOwner","inputs":[{"type":"address","name":"oldOwner","internalType":"address","indexed":false},{"type":"address","name":"newOwner","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"__callback","inputs":[{"type":"int256","name":"_price","internalType":"int256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"_owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"int256","name":"","internalType":"int256"}],"name":"latestAnswer","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"latestRound","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"latestTimestamp","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setOwner","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"update","inputs":[]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c806370324fac1161005b57806370324fac146101035780638205bf6a1461011f578063a2e620451461013d578063b2bdfa7b1461014757610088565b806313af40351461008d578063313ce567146100a957806350d25bcd146100c7578063668a0f02146100e5575b600080fd5b6100a760048036038101906100a2919061048f565b610165565b005b6100b161029a565b6040516100be9190610678565b60405180910390f35b6100cf6102b1565b6040516100dc9190610622565b60405180910390f35b6100ed6102bb565b6040516100fa919061065d565b60405180910390f35b61011d600480360381019061011891906104bc565b6102c5565b005b610127610374565b604051610134919061065d565b60405180910390f35b61014561037e565b005b61014f61043f565b60405161015c91906105de565b60405180910390f35b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146101f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101ec9061063d565b60405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b2364818360405161028e9291906105f9565b60405180910390a15050565b6000600260009054906101000a900460ff16905090565b6000600354905090565b6000600554905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461031f57600080fd5b806003819055504360058190555042600481905550600554817fa085aeb22c7d1cf9e526e11f37b76fbaa391d620eaeebb33ead10676473d4dd1600454604051610369919061065d565b60405180910390a350565b6000600454905090565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103d857600080fd5b60006040516103e791906105c7565b60405180910390203373ffffffffffffffffffffffffffffffffffffffff167fc396af0b61dfe04603380121a3f3ac9d82b24b2008f8c53ac14eb167755225ac42604051610435919061065d565b60405180910390a3565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081359050610474816107a6565b92915050565b600081359050610489816107bd565b92915050565b6000602082840312156104a5576104a4610778565b5b60006104b384828501610465565b91505092915050565b6000602082840312156104d2576104d1610778565b5b60006104e08482850161047a565b91505092915050565b6104f2816106c4565b82525050565b610501816106d6565b82525050565b6000815461051481610717565b61051e81866106b9565b94506001821660008114610539576001811461054a5761057d565b60ff1983168652818601935061057d565b61055385610693565b60005b8381101561057557815481890152600182019150602081019050610556565b838801955050505b50505092915050565b60006105936013836106a8565b915061059e8261077d565b602082019050919050565b6105b281610700565b82525050565b6105c18161070a565b82525050565b60006105d38284610507565b915081905092915050565b60006020820190506105f360008301846104e9565b92915050565b600060408201905061060e60008301856104e9565b61061b60208301846104e9565b9392505050565b600060208201905061063760008301846104f8565b92915050565b6000602082019050818103600083015261065681610586565b9050919050565b600060208201905061067260008301846105a9565b92915050565b600060208201905061068d60008301846105b8565b92915050565b60008190508160005260206000209050919050565b600082825260208201905092915050565b600081905092915050565b60006106cf826106e0565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000600282049050600182168061072f57607f821691505b6020821081141561074357610742610749565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b7f6f6e6c792061646d696e206d61792063616c6c00000000000000000000000000600082015250565b6107af816106c4565b81146107ba57600080fd5b50565b6107c6816106d6565b81146107d157600080fd5b5056fea2646970667358221220fa7cfe680f1cc1de758efee6e809cd81636fa5ef1f1b3bf61eea129e8cae26f764736f6c63430008070033