ETH Price: $2,149.58 (-7.82%)

Contract

0x6be987c6d72e25F02f6f061F94417d83a6Aa13fC
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Pending Gove...148286642022-05-23 9:06:361011 days ago1653296796IN
0x6be987c6...3a6Aa13fC
0 ETH0.0010948723.25670326
Set Route125998192021-06-09 10:28:101359 days ago1623234490IN
0x6be987c6...3a6Aa13fC
0 ETH0.0008143711
Set Route125525372021-06-02 3:15:381366 days ago1622603738IN
0x6be987c6...3a6Aa13fC
0 ETH0.0032156826
Set Route125159282021-05-27 10:41:471372 days ago1622112107IN
0x6be987c6...3a6Aa13fC
0 ETH0.0059473624.00000145
Set Route124044772021-05-10 4:29:361389 days ago1620620976IN
0x6be987c6...3a6Aa13fC
0 ETH0.0097709132
Set Route123270172021-04-28 5:26:051401 days ago1619587565IN
0x6be987c6...3a6Aa13fC
0 ETH0.0168617640
Set Route123270152021-04-28 5:26:001401 days ago1619587560IN
0x6be987c6...3a6Aa13fC
0 ETH0.022818840

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CoreOracle

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
/**
 *Submitted for verification at Etherscan.io on 2021-04-28
*/

// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;



// Part: IBaseOracle

interface IBaseOracle {
  /// @dev Return the value of the given input as ETH per unit, multiplied by 2**112.
  /// @param token The ERC-20 token to check the value.
  function getETHPx(address token) external view returns (uint);
}

// Part: OpenZeppelin/[email protected]/Address

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain`call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
      return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// Part: OpenZeppelin/[email protected]/Initializable

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        return !Address.isContract(address(this));
    }
}

// Part: Governable

contract Governable is Initializable {
  event SetGovernor(address governor);
  event SetPendingGovernor(address pendingGovernor);
  event AcceptGovernor(address governor);

  address public governor; // The current governor.
  address public pendingGovernor; // The address pending to become the governor once accepted.

  bytes32[64] _gap; // reserve space for upgrade

  modifier onlyGov() {
    require(msg.sender == governor, 'not the governor');
    _;
  }

  /// @dev Initialize using msg.sender as the first governor.
  function __Governable__init() internal initializer {
    governor = msg.sender;
    pendingGovernor = address(0);
    emit SetGovernor(msg.sender);
  }

  /// @dev Set the pending governor, which will be the governor once accepted.
  /// @param _pendingGovernor The address to become the pending governor.
  function setPendingGovernor(address _pendingGovernor) external onlyGov {
    pendingGovernor = _pendingGovernor;
    emit SetPendingGovernor(_pendingGovernor);
  }

  /// @dev Accept to become the new governor. Must be called by the pending governor.
  function acceptGovernor() external {
    require(msg.sender == pendingGovernor, 'not the pending governor');
    pendingGovernor = address(0);
    governor = msg.sender;
    emit AcceptGovernor(msg.sender);
  }
}

// File: CoreOracle.sol

contract CoreOracle is IBaseOracle, Governable {
  event SetRoute(address indexed token, address route);
  mapping(address => address) public routes; // Mapping from token to oracle source

  constructor() public {
    __Governable__init();
  }

  /// @dev Set oracle source routes for tokens
  /// @param tokens List of tokens
  /// @param targets List of oracle source routes
  function setRoute(address[] calldata tokens, address[] calldata targets) external onlyGov {
    require(tokens.length == targets.length, 'inconsistent length');
    for (uint idx = 0; idx < tokens.length; idx++) {
      routes[tokens[idx]] = targets[idx];
      emit SetRoute(tokens[idx], targets[idx]);
    }
  }

  /// @dev Return the value of the given input as ETH per unit, multiplied by 2**112.
  /// @param token The ERC-20 token to check the value.
  function getETHPx(address token) external view override returns (uint) {
    uint px = IBaseOracle(routes[token]).getETHPx(token);
    require(px != 0, 'price oracle failure');
    return px;
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"governor","type":"address"}],"name":"AcceptGovernor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"governor","type":"address"}],"name":"SetGovernor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pendingGovernor","type":"address"}],"name":"SetPendingGovernor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"route","type":"address"}],"name":"SetRoute","type":"event"},{"inputs":[],"name":"acceptGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getETHPx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"governor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingGovernor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"routes","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_pendingGovernor","type":"address"}],"name":"setPendingGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"address[]","name":"targets","type":"address[]"}],"name":"setRoute","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061001961001e565b610142565b600054610100900460ff16806100375750610037610121565b80610045575060005460ff16155b6100805760405162461bcd60e51b815260040180806020018281038252602e8152602001806107ce602e913960400191505060405180910390fd5b600054610100900460ff161580156100ab576000805460ff1961ff0019909116610100171660011790555b6000805462010000600160b01b0319163362010000810291909117909155600180546001600160a01b031916905560408051918252517fbce074c8369e26e70e1ae2f14fc944da352cfe6f52e2de9572f0c9942a24b7fc916020908290030190a1801561011e576000805461ff00191690555b50565b60006101363061013c60201b6106411760201c565b15905090565b3b151590565b61067d806101516000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063d74096591161005b578063d7409659146101a2578063e3056a34146101c8578063e58bb639146101d0578063f235757f146101d85761007d565b80630c340a2414610082578063573f775a146100a6578063ab9aadfe1461016a575b600080fd5b61008a6101fe565b604080516001600160a01b039092168252519081900360200190f35b610168600480360360408110156100bc57600080fd5b8101906020810181356401000000008111156100d757600080fd5b8201836020820111156100e957600080fd5b8035906020019184602083028401116401000000008311171561010b57600080fd5b91939092909160208101903564010000000081111561012957600080fd5b82018360208201111561013b57600080fd5b8035906020019184602083028401116401000000008311171561015d57600080fd5b509092509050610213565b005b6101906004803603602081101561018057600080fd5b50356001600160a01b03166103cf565b60408051918252519081900360200190f35b61008a600480360360208110156101b857600080fd5b50356001600160a01b03166104a9565b61008a6104c4565b6101686104d3565b610168600480360360208110156101ee57600080fd5b50356001600160a01b0316610595565b6000546201000090046001600160a01b031681565b6000546201000090046001600160a01b0316331461026b576040805162461bcd60e51b815260206004820152601060248201526f3737ba103a34329033b7bb32b93737b960811b604482015290519081900360640190fd5b8281146102b5576040805162461bcd60e51b81526020600482015260136024820152720d2dcc6dedce6d2e6e8cadce840d8cadccee8d606b1b604482015290519081900360640190fd5b60005b838110156103c8578282828181106102cc57fe5b905060200201356001600160a01b0316604260008787858181106102ec57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555084848281811061034c57fe5b905060200201356001600160a01b03166001600160a01b03167fa8c96090e146ce1076efa81e5424d56e13d5c3854943f7926406c12d15d6dbe984848481811061039257fe5b905060200201356001600160a01b031660405180826001600160a01b0316815260200191505060405180910390a26001016102b8565b5050505050565b6001600160a01b0380821660008181526042602090815260408083205481516355cd56ff60e11b8152600481019590955290519294859491169263ab9aadfe92602480840193919291829003018186803b15801561042c57600080fd5b505afa158015610440573d6000803e3d6000fd5b505050506040513d602081101561045657600080fd5b50519050806104a3576040805162461bcd60e51b81526020600482015260146024820152737072696365206f7261636c65206661696c75726560601b604482015290519081900360640190fd5b92915050565b6042602052600090815260409020546001600160a01b031681565b6001546001600160a01b031681565b6001546001600160a01b03163314610532576040805162461bcd60e51b815260206004820152601860248201527f6e6f74207468652070656e64696e6720676f7665726e6f720000000000000000604482015290519081900360640190fd5b600180546001600160a01b03191690556000805462010000600160b01b031916336201000081029190911790915560408051918252517fd345d81ce68c70b119a17eee79dc1421700bd9cb21ca148a62dc90983964e82f916020908290030190a1565b6000546201000090046001600160a01b031633146105ed576040805162461bcd60e51b815260206004820152601060248201526f3737ba103a34329033b7bb32b93737b960811b604482015290519081900360640190fd5b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f964dea888b00b2ab53f13dfe7ca334b46e99338c222ae232d98547a1da019f609181900360200190a150565b3b15159056fea26469706673582212202f835fd22c9bf03fad6a789a02f97b1c2b84752535b3e27f9f72f1967ff1301264736f6c634300060c0033496e697469616c697a61626c653a20636f6e747261637420697320616c726561647920696e697469616c697a6564

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063d74096591161005b578063d7409659146101a2578063e3056a34146101c8578063e58bb639146101d0578063f235757f146101d85761007d565b80630c340a2414610082578063573f775a146100a6578063ab9aadfe1461016a575b600080fd5b61008a6101fe565b604080516001600160a01b039092168252519081900360200190f35b610168600480360360408110156100bc57600080fd5b8101906020810181356401000000008111156100d757600080fd5b8201836020820111156100e957600080fd5b8035906020019184602083028401116401000000008311171561010b57600080fd5b91939092909160208101903564010000000081111561012957600080fd5b82018360208201111561013b57600080fd5b8035906020019184602083028401116401000000008311171561015d57600080fd5b509092509050610213565b005b6101906004803603602081101561018057600080fd5b50356001600160a01b03166103cf565b60408051918252519081900360200190f35b61008a600480360360208110156101b857600080fd5b50356001600160a01b03166104a9565b61008a6104c4565b6101686104d3565b610168600480360360208110156101ee57600080fd5b50356001600160a01b0316610595565b6000546201000090046001600160a01b031681565b6000546201000090046001600160a01b0316331461026b576040805162461bcd60e51b815260206004820152601060248201526f3737ba103a34329033b7bb32b93737b960811b604482015290519081900360640190fd5b8281146102b5576040805162461bcd60e51b81526020600482015260136024820152720d2dcc6dedce6d2e6e8cadce840d8cadccee8d606b1b604482015290519081900360640190fd5b60005b838110156103c8578282828181106102cc57fe5b905060200201356001600160a01b0316604260008787858181106102ec57fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555084848281811061034c57fe5b905060200201356001600160a01b03166001600160a01b03167fa8c96090e146ce1076efa81e5424d56e13d5c3854943f7926406c12d15d6dbe984848481811061039257fe5b905060200201356001600160a01b031660405180826001600160a01b0316815260200191505060405180910390a26001016102b8565b5050505050565b6001600160a01b0380821660008181526042602090815260408083205481516355cd56ff60e11b8152600481019590955290519294859491169263ab9aadfe92602480840193919291829003018186803b15801561042c57600080fd5b505afa158015610440573d6000803e3d6000fd5b505050506040513d602081101561045657600080fd5b50519050806104a3576040805162461bcd60e51b81526020600482015260146024820152737072696365206f7261636c65206661696c75726560601b604482015290519081900360640190fd5b92915050565b6042602052600090815260409020546001600160a01b031681565b6001546001600160a01b031681565b6001546001600160a01b03163314610532576040805162461bcd60e51b815260206004820152601860248201527f6e6f74207468652070656e64696e6720676f7665726e6f720000000000000000604482015290519081900360640190fd5b600180546001600160a01b03191690556000805462010000600160b01b031916336201000081029190911790915560408051918252517fd345d81ce68c70b119a17eee79dc1421700bd9cb21ca148a62dc90983964e82f916020908290030190a1565b6000546201000090046001600160a01b031633146105ed576040805162461bcd60e51b815260206004820152601060248201526f3737ba103a34329033b7bb32b93737b960811b604482015290519081900360640190fd5b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f964dea888b00b2ab53f13dfe7ca334b46e99338c222ae232d98547a1da019f609181900360200190a150565b3b15159056fea26469706673582212202f835fd22c9bf03fad6a789a02f97b1c2b84752535b3e27f9f72f1967ff1301264736f6c634300060c0033

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.