Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
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 0x07Ef2089...96AF4fF49 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
ChainlinkOracle
Compiler Version
v0.7.5+commit.eb77ed08
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.7.5; import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/introspection/IERC165.sol"; /** * @title Chainlink Oracle * @author Cryptex.finance * @notice Contract in charge or reading the information from a Chainlink Oracle. TCAP contracts read the price directly from this contract. More information can be found on Chainlink Documentation */ contract ChainlinkOracle is Ownable, IERC165 { AggregatorV3Interface internal aggregatorContract; /* * setReferenceContract.selector ^ * getLatestAnswer.selector ^ * getLatestTimestamp.selector ^ * getPreviousAnswer.selector ^ * getPreviousTimestamp.selector => 0x85be402b */ bytes4 private constant _INTERFACE_ID_CHAINLINK_ORACLE = 0x85be402b; /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @notice Called once the contract is deployed. * Set the Chainlink Oracle as an aggregator. */ constructor(address _aggregator) { aggregatorContract = AggregatorV3Interface(_aggregator); } /** * @notice Changes the reference contract. * @dev Only owner can call it. */ function setReferenceContract(address _aggregator) public onlyOwner() { aggregatorContract = AggregatorV3Interface(_aggregator); } /** * @notice Returns the latest answer from the reference contract. * @return price */ function getLatestAnswer() public view returns (int256) { ( uint80 roundID, int256 price, , uint256 timeStamp, uint80 answeredInRound ) = aggregatorContract.latestRoundData(); require( timeStamp != 0, "ChainlinkOracle::getLatestAnswer: round is not complete" ); require( answeredInRound >= roundID, "ChainlinkOracle::getLatestAnswer: stale data" ); return price; } /** * @notice Returns the latest round from the reference contract. */ function getLatestRound() public view returns ( uint80, int256, uint256, uint256, uint80 ) { ( uint80 roundID, int256 price, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound ) = aggregatorContract.latestRoundData(); return (roundID, price, startedAt, timeStamp, answeredInRound); } /** * @notice Returns a given round from the reference contract. * @param _id of round */ function getRound(uint80 _id) public view returns ( uint80, int256, uint256, uint256, uint80 ) { ( uint80 roundID, int256 price, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound ) = aggregatorContract.getRoundData(_id); return (roundID, price, startedAt, timeStamp, answeredInRound); } /** * @notice Returns the last time the Oracle was updated. */ function getLatestTimestamp() public view returns (uint256) { (, , , uint256 timeStamp, ) = aggregatorContract.latestRoundData(); return timeStamp; } /** * @notice Returns a previous answer updated on the Oracle. * @param _id of round * @return price */ function getPreviousAnswer(uint80 _id) public view returns (int256) { (uint80 roundID, int256 price, , , ) = aggregatorContract.getRoundData(_id); require( _id <= roundID, "ChainlinkOracle::getPreviousAnswer: not enough history" ); return price; } /** * @notice Returns a previous time the Oracle was updated. * @param _id of round * @return timeStamp */ function getPreviousTimestamp(uint80 _id) public view returns (uint256) { (uint80 roundID, , , uint256 timeStamp, ) = aggregatorContract.getRoundData(_id); require( _id <= roundID, "ChainlinkOracle::getPreviousTimestamp: not enough history" ); return timeStamp; } /** * @notice ERC165 Standard for support of interfaces. */ function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { return (interfaceId == _INTERFACE_ID_CHAINLINK_ORACLE || interfaceId == _INTERFACE_ID_ERC165); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. 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 ); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../GSN/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "evmVersion": "istanbul", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_aggregator","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"getLatestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestRound","outputs":[{"internalType":"uint80","name":"","type":"uint80"},{"internalType":"int256","name":"","type":"int256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_id","type":"uint80"}],"name":"getPreviousAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_id","type":"uint80"}],"name":"getPreviousTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_id","type":"uint80"}],"name":"getRound","outputs":[{"internalType":"uint80","name":"","type":"uint80"},{"internalType":"int256","name":"","type":"int256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_aggregator","type":"address"}],"name":"setReferenceContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063715018a611610071578063715018a6146101bb5780637498e6c2146101c35780638da5cb5b146101e957806396237c021461020d578063f2fde38b14610215578063f43b52cb1461023b576100a9565b806301ffc9a7146100ae57806324a343fa146100e95780633cf8a69714610153578063608bf1c31461017b578063708fe4df146101b3575b600080fd5b6100d5600480360360208110156100c457600080fd5b50356001600160e01b031916610243565b604080519115158252519081900360200190f35b61010f600480360360208110156100ff57600080fd5b50356001600160501b031661027a565b60405180866001600160501b03168152602001858152602001848152602001838152602001826001600160501b031681526020019550505050505060405180910390f35b6101796004803603602081101561016957600080fd5b50356001600160a01b0316610343565b005b6101a16004803603602081101561019157600080fd5b50356001600160501b03166103cf565b60408051918252519081900360200190f35b61010f6104b4565b610179610568565b6101a1600480360360208110156101d957600080fd5b50356001600160501b031661061c565b6101f16106fa565b604080516001600160a01b039092168252519081900360200190f35b6101a1610709565b6101796004803603602081101561022b57600080fd5b50356001600160a01b031661083c565b6101a1610946565b60006001600160e01b031982166385be402b60e01b148061027457506001600160e01b031982166301ffc9a760e01b145b92915050565b600080600080600080600080600080600160009054906101000a90046001600160a01b03166001600160a01b0316639a6fc8f58c6040518263ffffffff1660e01b815260040180826001600160501b0316815260200191505060a06040518083038186803b1580156102eb57600080fd5b505afa1580156102ff573d6000803e3d6000fd5b505050506040513d60a081101561031557600080fd5b508051602082015160408301516060840151608090940151929f919e509c50919a5098509650505050505050565b61034b6109cc565b6000546001600160a01b039081169116146103ad576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60015460408051639a6fc8f560e01b81526001600160501b03841660048201529051600092839283926001600160a01b0390921691639a6fc8f59160248082019260a092909190829003018186803b15801561042a57600080fd5b505afa15801561043e573d6000803e3d6000fd5b505050506040513d60a081101561045457600080fd5b50805160609091015190925090506001600160501b0380831690851611156104ad5760405162461bcd60e51b8152600401808060200182810382526039815260200180610a5a6039913960400191505060405180910390fd5b9392505050565b600080600080600080600080600080600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561051157600080fd5b505afa158015610525573d6000803e3d6000fd5b505050506040513d60a081101561053b57600080fd5b508051602082015160408301516060840151608090940151929e919d509b50919950975095505050505050565b6105706109cc565b6000546001600160a01b039081169116146105d2576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60015460408051639a6fc8f560e01b81526001600160501b03841660048201529051600092839283926001600160a01b0390921691639a6fc8f59160248082019260a092909190829003018186803b15801561067757600080fd5b505afa15801561068b573d6000803e3d6000fd5b505050506040513d60a08110156106a157600080fd5b50805160209091015190925090506001600160501b0380831690851611156104ad5760405162461bcd60e51b8152600401808060200182810382526036815260200180610a936036913960400191505060405180910390fd5b6000546001600160a01b031690565b6000806000806000600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561075f57600080fd5b505afa158015610773573d6000803e3d6000fd5b505050506040513d60a081101561078957600080fd5b5080516020820151606083015160809093015191965094509092509050816107e25760405162461bcd60e51b81526004018080602001828103825260378152602001806109d16037913960400191505060405180910390fd5b836001600160501b0316816001600160501b031610156108335760405162461bcd60e51b815260040180806020018281038252602c815260200180610a2e602c913960400191505060405180910390fd5b50909250505090565b6108446109cc565b6000546001600160a01b039081169116146108a6576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166108eb5760405162461bcd60e51b8152600401808060200182810382526026815260200180610a086026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080600160009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561099757600080fd5b505afa1580156109ab573d6000803e3d6000fd5b505050506040513d60a08110156109c157600080fd5b506060015191505090565b339056fe436861696e6c696e6b4f7261636c653a3a6765744c6174657374416e737765723a20726f756e64206973206e6f7420636f6d706c6574654f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373436861696e6c696e6b4f7261636c653a3a6765744c6174657374416e737765723a207374616c652064617461436861696e6c696e6b4f7261636c653a3a67657450726576696f757354696d657374616d703a206e6f7420656e6f75676820686973746f7279436861696e6c696e6b4f7261636c653a3a67657450726576696f7573416e737765723a206e6f7420656e6f75676820686973746f7279a26469706673582212209b63b276a565f0464370ea796c503312e8948f518a38ae1c1d84828deaaf738564736f6c63430007050033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 23 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.