Forkchoice Ethereum Mainnet

Address Contract Partially Verified

Address 0x76B47460d7F7c5222cFb6b6A75615ab10895DDe4
Balance 0 ETH
Nonce 1
Code Size 2695 bytes
Indexed Transactions 0 (1 on-chain, 1.5% indexed)
External Etherscan · Sourcify

Contract Bytecode

2695 bytes
Copy Bytecode
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c806392bf2be01161006657806392bf2be01461011b5780639d23d9f214610141578063abfd531014610201578063b3596f07146102c3578063f2fde38b146102fb5761009e565b8063170aee73146100a35780636210308c146100cb578063715018a6146100ef5780638da5cb5b146100f75780638f32d59b146100ff575b600080fd5b6100c9600480360360208110156100b957600080fd5b50356001600160a01b0316610321565b005b6100d3610374565b604080516001600160a01b039092168252519081900360200190f35b6100c9610383565b6100d3610414565b610107610423565b604080519115158252519081900360200190f35b6100d36004803603602081101561013157600080fd5b50356001600160a01b0316610434565b6101b16004803603602081101561015757600080fd5b81019060208101813564010000000081111561017257600080fd5b82018360208201111561018457600080fd5b803590602001918460208302840111640100000000831117156101a657600080fd5b509092509050610455565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156101ed5781810151838201526020016101d5565b505050509050019250505060405180910390f35b6100c96004803603604081101561021757600080fd5b81019060208101813564010000000081111561023257600080fd5b82018360208201111561024457600080fd5b8035906020019184602083028401116401000000008311171561026657600080fd5b91939092909160208101903564010000000081111561028457600080fd5b82018360208201111561029657600080fd5b803590602001918460208302840111640100000000831117156102b857600080fd5b5090925090506104de565b6102e9600480360360208110156102d957600080fd5b50356001600160a01b0316610598565b60408051918252519081900360200190f35b6100c96004803603602081101561031157600080fd5b50356001600160a01b0316610775565b610329610423565b610368576040805162461bcd60e51b81526020600482018190526024820152600080516020610a33833981519152604482015290519081900360640190fd5b610371816107c5565b50565b6002546001600160a01b031690565b61038b610423565b6103ca576040805162461bcd60e51b81526020600482018190526024820152600080516020610a33833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6000546001600160a01b0316331490565b6001600160a01b03808216600090815260016020526040902054165b919050565b60608083839050604051908082528060200260200182016040528015610485578160200160208202803883390190505b50905060005b838110156104d6576104b78585838181106104a257fe5b905060200201356001600160a01b0316610598565b8282815181106104c357fe5b602090810291909101015260010161048b565b509392505050565b6104e6610423565b610525576040805162461bcd60e51b81526020600482018190526024820152600080516020610a33833981519152604482015290519081900360640190fd5b6105928484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060408051602080880282810182019093528782529093508792508691829185019084908082843760009201919091525061080f92505050565b50505050565b6001600160a01b038082166000908152600160205260408120549091166105bd610954565b6001600160a01b0316836001600160a01b031614156105e757670de0b6b3a7640000915050610450565b6001600160a01b038116610677576002546040805163b3596f0760e01b81526001600160a01b0386811660048301529151919092169163b3596f07916024808301926020929190829003018186803b15801561064257600080fd5b505afa158015610656573d6000803e3d6000fd5b505050506040513d602081101561066c57600080fd5b505191506104509050565b6000816001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156106b257600080fd5b505afa1580156106c6573d6000803e3d6000fd5b505050506040513d60208110156106dc57600080fd5b5051905060008113156106f25791506104509050565b6002546040805163b3596f0760e01b81526001600160a01b0387811660048301529151919092169163b3596f07916024808301926020929190829003018186803b15801561073f57600080fd5b505afa158015610753573d6000803e3d6000fd5b505050506040513d602081101561076957600080fd5b50519250610450915050565b61077d610423565b6107bc576040805162461bcd60e51b81526020600482018190526024820152600080516020610a33833981519152604482015290519081900360640190fd5b6103718161096c565b600280546001600160a01b0319166001600160a01b0383169081179091556040517fce7a780d33665b1ea097af5f155e3821b809ecbaa839d3b33aa83ba28168cefb90600090a250565b8051825114610865576040805162461bcd60e51b815260206004820152601a60248201527f494e434f4e53495354454e545f504152414d535f4c454e475448000000000000604482015290519081900360640190fd5b60005b825181101561094f5781818151811061087d57fe5b60200260200101516001600085848151811061089557fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508181815181106108ed57fe5b60200260200101516001600160a01b031683828151811061090a57fe5b60200260200101516001600160a01b03167f22c5b7b2d8561d39f7f210b6b326a1aa69f15311163082308ac4877db6339dc160405160405180910390a3600101610868565b505050565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee90565b6001600160a01b0381166109b15760405162461bcd60e51b8152600401808060200182810382526026815260200180610a0d6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b039290921691909117905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a265627a7a72315820cc0c9190753cba20cea8f02e68f8af86d4cf0d4b2f79bfd550849deecdd80e9e64736f6c634300050e0032

Verified Source Code Partial Match

Compiler: v0.5.14+commit.01f1aaa4 EVM: istanbul Optimization: Yes (200 runs)
ChainlinkProxyPriceProvider.sol 235 lines
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol

pragma solidity ^0.5.0;

/**
 * @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.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be aplied to your functions to restrict their use to
 * the owner.
 */
contract Ownable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }

    /**
     * @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(isOwner(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return msg.sender == _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 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 onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

// File: contracts/interfaces/IPriceOracleGetter.sol

pragma solidity ^0.5.0;

/**
* @title IPriceOracleGetter interface
* @notice Interface for the Aave price oracle.
**/

interface IPriceOracleGetter {
    /**
    * @dev returns the asset price in ETH
    * @param _asset the address of the asset
    * @return the ETH price of the asset
    **/
    function getAssetPrice(address _asset) external view returns (uint256);
}

// File: contracts/interfaces/IChainlinkAggregator.sol

pragma solidity ^0.5.0;

interface IChainlinkAggregator {
  function latestAnswer() external view returns (int256);
  function latestTimestamp() external view returns (uint256);
  function latestRound() external view returns (uint256);
  function getAnswer(uint256 roundId) external view returns (int256);
  function getTimestamp(uint256 roundId) external view returns (uint256);

  event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp);
  event NewRound(uint256 indexed roundId, address indexed startedBy);
}

// File: contracts/libraries/EthAddressLib.sol

pragma solidity ^0.5.0;

library EthAddressLib {

    /**
    * @dev returns the address used within the protocol to identify ETH
    * @return the address assigned to ETH
     */
    function ethAddress() internal pure returns(address) {
        return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    }
}

// File: contracts/misc/ChainlinkProxyPriceProvider.sol

pragma solidity ^0.5.0;





/// @title ChainlinkProxyPriceProvider
/// @author Aave
/// @notice Proxy smart contract to get the price of an asset from a price source, with Chainlink Aggregator
///         smart contracts as primary option
/// - If the returned price by a Chainlink aggregator is <= 0, the call is forwarded to a fallbackOracle
/// - Owned by the Aave governance system, allowed to add sources for assets, replace them
///   and change the fallbackOracle
contract ChainlinkProxyPriceProvider is IPriceOracleGetter, Ownable {

    event AssetSourceUpdated(address indexed asset, address indexed source);
    event FallbackOracleUpdated(address indexed fallbackOracle);

    mapping(address => IChainlinkAggregator) private assetsSources;
    IPriceOracleGetter private fallbackOracle;

    /// @notice Constructor
    /// @param _assets The addresses of the assets
    /// @param _sources The address of the source of each asset
    /// @param _fallbackOracle The address of the fallback oracle to use if the data of an
    ///        aggregator is not consistent
    constructor(address[] memory _assets, address[] memory _sources, address _fallbackOracle) public {
        internalSetFallbackOracle(_fallbackOracle);
        internalSetAssetsSources(_assets, _sources);
    }

    /// @notice External function called by the Aave governance to set or replace sources of assets
    /// @param _assets The addresses of the assets
    /// @param _sources The address of the source of each asset
    function setAssetSources(address[] calldata _assets, address[] calldata _sources) external onlyOwner {
        internalSetAssetsSources(_assets, _sources);
    }

    /// @notice Sets the fallbackOracle
    /// - Callable only by the Aave governance
    /// @param _fallbackOracle The address of the fallbackOracle
    function setFallbackOracle(address _fallbackOracle) external onlyOwner {
        internalSetFallbackOracle(_fallbackOracle);
    }

    /// @notice Internal function to set the sources for each asset
    /// @param _assets The addresses of the assets
    /// @param _sources The address of the source of each asset
    function internalSetAssetsSources(address[] memory _assets, address[] memory _sources) internal {
        require(_assets.length == _sources.length, "INCONSISTENT_PARAMS_LENGTH");
        for (uint256 i = 0; i < _assets.length; i++) {
            assetsSources[_assets[i]] = IChainlinkAggregator(_sources[i]);
            emit AssetSourceUpdated(_assets[i], _sources[i]);
        }
    }

    /// @notice Internal function to set the fallbackOracle
    /// @param _fallbackOracle The address of the fallbackOracle
    function internalSetFallbackOracle(address _fallbackOracle) internal {
        fallbackOracle = IPriceOracleGetter(_fallbackOracle);
        emit FallbackOracleUpdated(_fallbackOracle);
    }

    /// @notice Gets an asset price by address
    /// @param _asset The asset address
    function getAssetPrice(address _asset) public view returns(uint256) {
        IChainlinkAggregator source = assetsSources[_asset];
        if (_asset == EthAddressLib.ethAddress()) {
            return 1 ether;
        } else {
            // If there is no registered source for the asset, call the fallbackOracle
            if (address(source) == address(0)) {
                return IPriceOracleGetter(fallbackOracle).getAssetPrice(_asset);
            } else {
                int256 _price = IChainlinkAggregator(source).latestAnswer();
                if (_price > 0) {
                    return uint256(_price);
                } else {
                    return IPriceOracleGetter(fallbackOracle).getAssetPrice(_asset);
                }
            }
        }
    }

    /// @notice Gets a list of prices from a list of assets addresses
    /// @param _assets The list of assets addresses
    function getAssetsPrices(address[] calldata _assets) external view returns(uint256[] memory) {
        uint256[] memory prices = new uint256[](_assets.length);
        for (uint256 i = 0; i < _assets.length; i++) {
            prices[i] = getAssetPrice(_assets[i]);
        }
        return prices;
    }

    /// @notice Gets the address of the source for an asset address
    /// @param _asset The address of the asset
    /// @return address The address of the source
    function getSourceOfAsset(address _asset) external view returns(address) {
        return address(assetsSources[_asset]);
    }

    /// @notice Gets the address of the fallback oracle
    /// @return address The addres of the fallback oracle
    function getFallbackOracle() external view returns(address) {
        return address(fallbackOracle);
    }
}

Read Contract

getAssetPrice 0xb3596f07 → uint256
getAssetsPrices 0x9d23d9f2 → uint256[]
getFallbackOracle 0x6210308c → address
getSourceOfAsset 0x92bf2be0 → address
isOwner 0x8f32d59b → bool
owner 0x8da5cb5b → address

Write Contract 4 functions

These functions modify contract state and require a wallet transaction to execute.

renounceOwnership 0x715018a6
No parameters
setAssetSources 0xabfd5310
address[] _assets
address[] _sources
setFallbackOracle 0x170aee73
address _fallbackOracle
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

This address has 1 on-chain transactions, but only 1.5% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →