Contract 0xAfE908d639CFF4E2313d065B3CDA5eF4e056d9b8 1

Contract Overview

Balance:
0 Ether
Txn Hash
Method
Block
From
To
Value
0xb7b63997ec23036f0a77c69a366e10526576bebec2f81ab8dda048936128e0a00x6080604089609452021-07-18 23:54:30352 days 20 hrs ago0x8feebfa4ac7af314d90a0c17c3f91c800cfde44b IN  Create: ChainChainlinkPrices0 Ether0.000409671
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ChainChainlinkPrices

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion, None license
/**
 *Submitted for verification at Etherscan.io on 2021-07-18
*/

pragma solidity ^0.6.2;

interface IChainlinkAggregator {
  function latestAnswer() external view returns (int);
  function decimals() external view returns (uint8);
}

/*
* This contract uses two chainlink price feeds to make a new price feed
* and has the interface needed for AAVE to interact with it.
* For price feeds A -> B and C -> B, outputs A -> C
*/

contract ChainChainlinkPrices is IChainlinkAggregator {

    address internal priceFeedAddress1;
    address internal priceFeedAddress2;
    IChainlinkAggregator internal priceFeed1;
    IChainlinkAggregator internal priceFeed2;
    IChainlinkAggregator internal priceFeedControl;

    /**
     * 
     */
    constructor(address p1, address p2) public {
        priceFeedAddress1 = p1;
        priceFeedAddress2 = p2;
        priceFeed1 = IChainlinkAggregator(p1);
        priceFeed2 = IChainlinkAggregator(p2);
    }
    
    /**
     * Returns the latest price
     */
    function getPrice1() public view returns (int) {
        return priceFeed1.latestAnswer();
    }    
    function getPrice2() public view returns (int) {
        return priceFeed2.latestAnswer();
    }
    function getPriceSource1() public view returns (address) {
        return priceFeedAddress1;
    }
    function getPriceSource2() public view returns (address) {
        return priceFeedAddress2;
    }
    /**
     * Converts DAI price to ETH using two feeds and returns 18 decimal point precision
     */
    function latestAnswer() public view virtual override returns (int) {
        int price1 = getPrice1();
        uint8 price1d = priceFeed1.decimals();
        int price2 = getPrice2();
        uint8 price2d = priceFeed2.decimals();
        int newprice = price1  * (int(10) ** (price2d - price1d + uint8(18))) / price2;
        return newprice;
    }
    function decimals() public view virtual override returns (uint8) {
        return uint8(18);
    }
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"p1","type":"address"},{"internalType":"address","name":"p2","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrice1","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrice2","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPriceSource1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPriceSource2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5060405161061f38038061061f8339818101604052604081101561003357600080fd5b810190808051906020019092919080519060200190929190505050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050506104bd806101626000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80632464e15d14610067578063313ce5671461008557806350d25bcd146100a657806366a9b6ef146100c4578063a941ada9146100f8578063e1ed02c614610116575b600080fd5b61006f61014a565b6040518082815260200191505060405180910390f35b61008d6101f4565b604051808260ff16815260200191505060405180910390f35b6100ae6101fd565b6040518082815260200191505060405180910390f35b6100cc61038a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101006103b3565b6040518082815260200191505060405180910390f35b61011e61045d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156101b457600080fd5b505afa1580156101c8573d6000803e3d6000fd5b505050506040513d60208110156101de57600080fd5b8101908080519060200190929190505050905090565b60006012905090565b6000806102086103b3565b90506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561027457600080fd5b505afa158015610288573d6000803e3d6000fd5b505050506040513d602081101561029e57600080fd5b8101908080519060200190929190505050905060006102bb61014a565b90506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561032757600080fd5b505afa15801561033b573d6000803e3d6000fd5b505050506040513d602081101561035157600080fd5b8101908080519060200190929190505050905060008260128584030160ff16600a0a86028161037c57fe5b059050809550505050505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561041d57600080fd5b505afa158015610431573d6000803e3d6000fd5b505050506040513d602081101561044757600080fd5b8101908080519060200190929190505050905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690509056fea264697066735822122055a6043e21aae0bc2f5d196c6682e78b4122c80b70735184ace88db40c8235f864736f6c634300060c00330000000000000000000000002ba49aaa16e6afd2a993473cfb70fa8559b523cf0000000000000000000000008a753747a1fa494ec906ce90e9f37563a8af630e

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000002ba49aaa16e6afd2a993473cfb70fa8559b523cf0000000000000000000000008a753747a1fa494ec906ce90e9f37563a8af630e

-----Decoded View---------------
Arg [0] : p1 (address): 0x2ba49aaa16e6afd2a993473cfb70fa8559b523cf
Arg [1] : p2 (address): 0x8a753747a1fa494ec906ce90e9f37563a8af630e

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000002ba49aaa16e6afd2a993473cfb70fa8559b523cf
Arg [1] : 0000000000000000000000008a753747a1fa494ec906ce90e9f37563a8af630e


Deployed ByteCode Sourcemap

374:1593:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1079:98;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1864:100;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;1502:356;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1183:100;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;971:98;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1289:100;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;1079:98;1121:3;1144:10;;;;;;;;;;;:23;;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1137:32;;1079:98;:::o;1864:100::-;1922:5;1953:2;1940:16;;1864:100;:::o;1502:356::-;1564:3;1580:10;1593:11;:9;:11::i;:::-;1580:24;;1615:13;1631:10;;;;;;;;;;;:19;;;:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1615:37;;1663:10;1676:11;:9;:11::i;:::-;1663:24;;1698:13;1714:10;;;;;;;;;;;:19;;;:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1698:37;;1746:12;1818:6;1810:2;1794:7;1784;:17;:29;1772:42;;1776:2;1772:42;1761:6;:54;:63;;;;;;1746:78;;1842:8;1835:15;;;;;;;1502:356;:::o;1183:100::-;1231:7;1258:17;;;;;;;;;;;1251:24;;1183:100;:::o;971:98::-;1013:3;1036:10;;;;;;;;;;;:23;;;:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1029:32;;971:98;:::o;1289:100::-;1337:7;1364:17;;;;;;;;;;;1357:24;;1289:100;:::o

Swarm Source

ipfs://55a6043e21aae0bc2f5d196c6682e78b4122c80b70735184ace88db40c8235f8
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading

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.