ETH Price: $2,453.08 (+0.87%)

Contract

0xF67405E155B67a472b3c02dFeB0932C2579F4682
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040116255592021-01-10 6:50:451366 days ago1610261445IN
 Create: ChainlinkUSDCUSDPriceConsumer
0 ETH0.0461870480

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ChainlinkUSDCUSDPriceConsumer

Compiler Version
v0.6.11+commit.5ef660b1

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 3 : ChainlinkUSDCUSDPriceConsumer.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;

import "./AggregatorV3Interface.sol";
import "../Math/SignedSafeMath.sol";

contract ChainlinkUSDCUSDPriceConsumer {
    using SignedSafeMath for int256;

    AggregatorV3Interface internal priceFeedUSDCETH;
    AggregatorV3Interface internal priceFeedETHUSD;


    constructor() public {
        // mainnet
        priceFeedUSDCETH = AggregatorV3Interface(0x986b5E1e1755e3C2440e960477f25201B0a8bbD4); // usdc-eth.data.eth
        priceFeedETHUSD  = AggregatorV3Interface(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419); // eth-usd.data.eth

    }

    /**
     * Returns the latest price
     */
    function getLatestPrice() public view returns (int) {
        (
            , 
            int256 priceUSDCETH,
            ,
            ,
            
        ) = priceFeedUSDCETH.latestRoundData(); // 835781130862914, 18    


        (
            , 
            int256 priceETHUSD,
            ,
            ,
            
        ) = priceFeedETHUSD.latestRoundData(); // 119804000000, 8 
        
        

        int price = priceUSDCETH.mul(priceETHUSD).div(int256(10) ** priceFeedUSDCETH.decimals());


        return price;
    }

    function getDecimals() public view returns (uint8) {
        return priceFeedETHUSD.decimals();  //8
    }
    
    
}

File 2 of 3 : SignedSafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.11;

/**
 * @title SignedSafeMath
 * @dev Signed math operations with safety checks that revert on error.
 */
library SignedSafeMath {
    int256 constant private _INT256_MIN = -2**255;

    /**
     * @dev Returns the multiplication of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(int256 a, int256 b) internal pure returns (int256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow");

        int256 c = a * b;
        require(c / a == b, "SignedSafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two signed integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(int256 a, int256 b) internal pure returns (int256) {
        require(b != 0, "SignedSafeMath: division by zero");
        require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow");

        int256 c = a / b;

        return c;
    }

    /**
     * @dev Returns the subtraction of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(int256 a, int256 b) internal pure returns (int256) {
        int256 c = a - b;
        require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow");

        return c;
    }

    /**
     * @dev Returns the addition of two signed integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(int256 a, int256 b) internal pure returns (int256) {
        int256 c = a + b;
        require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow");

        return c;
    }
}

File 3 of 3 : AggregatorV3Interface.sol
// 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
    );

}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"getDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestPrice","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5073986b5e1e1755e3c2440e960477f25201b0a8bbd46000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550735f4ec3df9cbd43714fe2740f5e3616155c5b8419600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108bb806100c96000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80638e15f4731461003b578063f0141d8414610059575b600080fd5b610043610077565b604051610050919061074b565b60405180910390f35b61006161029d565b60405161006e91906107c6565b60405180910390f35b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156100e157600080fd5b505afa1580156100f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101199190610581565b5050509150506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561018957600080fd5b505afa15801561019d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c19190610581565b50505091505060006102926000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561023357600080fd5b505afa158015610247573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026b91906105f8565b60ff16600a0a610284848661034490919063ffffffff16565b61044290919063ffffffff16565b905080935050505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561030757600080fd5b505afa15801561031b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033f91906105f8565b905090565b600080831415610357576000905061043c565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831480156103a557507f800000000000000000000000000000000000000000000000000000000000000082145b156103e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103dc90610786565b60405180910390fd5b60008284029050828482816103f657fe5b0514610437576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042e90610786565b60405180910390fd5b809150505b92915050565b600080821415610487576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047e906107a6565b60405180910390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821480156104d557507f800000000000000000000000000000000000000000000000000000000000000083145b15610515576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050c90610766565b60405180910390fd5b600082848161052057fe5b0590508091505092915050565b60008151905061053c81610829565b92915050565b60008151905061055181610840565b92915050565b6000815190506105668161086e565b92915050565b60008151905061057b81610857565b92915050565b600080600080600060a0868803121561059957600080fd5b60006105a788828901610557565b95505060206105b88882890161052d565b94505060406105c988828901610542565b93505060606105da88828901610542565b92505060806105eb88828901610557565b9150509295509295909350565b60006020828403121561060a57600080fd5b60006106188482850161056c565b91505092915050565b61062a816107f2565b82525050565b600061063d6021836107e1565b91507f5369676e6564536166654d6174683a206469766973696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006106a36027836107e1565b91507f5369676e6564536166654d6174683a206d756c7469706c69636174696f6e206f60008301527f766572666c6f77000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006107096020836107e1565b91507f5369676e6564536166654d6174683a206469766973696f6e206279207a65726f6000830152602082019050919050565b61074581610806565b82525050565b60006020820190506107606000830184610621565b92915050565b6000602082019050818103600083015261077f81610630565b9050919050565b6000602082019050818103600083015261079f81610696565b9050919050565b600060208201905081810360008301526107bf816106fc565b9050919050565b60006020820190506107db600083018461073c565b92915050565b600082825260208201905092915050565b6000819050919050565b6000819050919050565b600060ff82169050919050565b600069ffffffffffffffffffff82169050919050565b610832816107f2565b811461083d57600080fd5b50565b610849816107fc565b811461085457600080fd5b50565b61086081610806565b811461086b57600080fd5b50565b61087781610813565b811461088257600080fd5b5056fea26469706673582212200e164d18aa45dc628687543335c4d08b9968feaaafd8d365f210ecfe2b910f5364736f6c634300060b0033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100365760003560e01c80638e15f4731461003b578063f0141d8414610059575b600080fd5b610043610077565b604051610050919061074b565b60405180910390f35b61006161029d565b60405161006e91906107c6565b60405180910390f35b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156100e157600080fd5b505afa1580156100f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101199190610581565b5050509150506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561018957600080fd5b505afa15801561019d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c19190610581565b50505091505060006102926000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561023357600080fd5b505afa158015610247573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026b91906105f8565b60ff16600a0a610284848661034490919063ffffffff16565b61044290919063ffffffff16565b905080935050505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561030757600080fd5b505afa15801561031b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033f91906105f8565b905090565b600080831415610357576000905061043c565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831480156103a557507f800000000000000000000000000000000000000000000000000000000000000082145b156103e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103dc90610786565b60405180910390fd5b60008284029050828482816103f657fe5b0514610437576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042e90610786565b60405180910390fd5b809150505b92915050565b600080821415610487576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047e906107a6565b60405180910390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821480156104d557507f800000000000000000000000000000000000000000000000000000000000000083145b15610515576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050c90610766565b60405180910390fd5b600082848161052057fe5b0590508091505092915050565b60008151905061053c81610829565b92915050565b60008151905061055181610840565b92915050565b6000815190506105668161086e565b92915050565b60008151905061057b81610857565b92915050565b600080600080600060a0868803121561059957600080fd5b60006105a788828901610557565b95505060206105b88882890161052d565b94505060406105c988828901610542565b93505060606105da88828901610542565b92505060806105eb88828901610557565b9150509295509295909350565b60006020828403121561060a57600080fd5b60006106188482850161056c565b91505092915050565b61062a816107f2565b82525050565b600061063d6021836107e1565b91507f5369676e6564536166654d6174683a206469766973696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006106a36027836107e1565b91507f5369676e6564536166654d6174683a206d756c7469706c69636174696f6e206f60008301527f766572666c6f77000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006107096020836107e1565b91507f5369676e6564536166654d6174683a206469766973696f6e206279207a65726f6000830152602082019050919050565b61074581610806565b82525050565b60006020820190506107606000830184610621565b92915050565b6000602082019050818103600083015261077f81610630565b9050919050565b6000602082019050818103600083015261079f81610696565b9050919050565b600060208201905081810360008301526107bf816106fc565b9050919050565b60006020820190506107db600083018461073c565b92915050565b600082825260208201905092915050565b6000819050919050565b6000819050919050565b600060ff82169050919050565b600069ffffffffffffffffffff82169050919050565b610832816107f2565b811461083d57600080fd5b50565b610849816107fc565b811461085457600080fd5b50565b61086081610806565b811461086b57600080fd5b50565b61087781610813565b811461088257600080fd5b5056fea26469706673582212200e164d18aa45dc628687543335c4d08b9968feaaafd8d365f210ecfe2b910f5364736f6c634300060b0033

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.