Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
ChainlinkProxy
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import '../interfaces/IAggregator.sol'; import {ProxyCall} from '../libraries/ProxyCall.sol'; /// @title ChainlinkProxy /// @notice Contract that proxies calls to the dataFeedStore /// @notice This contract is responsible for fetching data for one feed only contract ChainlinkProxy is IAggregator { /// @inheritdoc IChainlinkAggregator uint8 public immutable override decimals; /// @inheritdoc IAggregator uint32 public immutable override key; /// @inheritdoc IAggregator address public immutable override dataFeedStore; /// @inheritdoc IChainlinkAggregator string public override description; /// @notice Constructor /// @param _description The description of the feed /// @param _decimals The decimals of the feed /// @param _key The key ID of the feed /// @param _dataFeedStore The address of the data feed store constructor( string memory _description, uint8 _decimals, uint32 _key, address _dataFeedStore ) { description = _description; decimals = _decimals; key = _key; dataFeedStore = _dataFeedStore; } /// @inheritdoc IChainlinkAggregator function latestAnswer() external view override returns (int256) { return ProxyCall._latestAnswer(key, dataFeedStore); } /// @inheritdoc IChainlinkAggregator function latestRound() external view override returns (uint256) { return ProxyCall._latestRound(key, dataFeedStore); } /// @inheritdoc IChainlinkAggregator function latestRoundData() external view override returns (uint80, int256, uint256, uint256, uint80) { return ProxyCall._latestRoundData(key, dataFeedStore); } /// @inheritdoc IChainlinkAggregator function getRoundData( uint80 _roundId ) external view override returns (uint80, int256, uint256, uint256, uint80) { return ProxyCall._getRoundData(_roundId, key, dataFeedStore); } }
/** * SPDX-FileCopyrightText: Copyright (c) 2021 SmartContract ChainLink Limited SEZC * * SPDX-License-Identifier: MIT */ pragma solidity ^0.8.24; interface IChainlinkAggregator { /// @notice Decimals for the feed data /// @return decimals The decimals of the feed function decimals() external view returns (uint8); /// @notice Description text for the feed data /// @return description The description of the feed function description() external view returns (string memory); /// @notice Get the latest answer for the feed /// @return answer The latest value stored function latestAnswer() external view returns (int256); /// @notice Get the latest round ID for the feed /// @return roundId The latest round ID function latestRound() external view returns (uint256); /// @notice Get the data for a round at a given round ID /// @param _roundId The round ID to retrieve the data for /// @return roundId The round ID /// @return answer The value stored for the round /// @return startedAt Timestamp of when the value was stored /// @return updatedAt Same as startedAt /// @return answeredInRound Same as roundId function getRoundData( uint80 _roundId ) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); /// @notice Get the latest round data available /// @return roundId The latest round ID for the feed /// @return answer The value stored for the round /// @return startedAt Timestamp of when the value was stored /// @return updatedAt Same as startedAt /// @return answeredInRound Same as roundId function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import {IChainlinkAggregator} from './chainlink/IChainlinkAggregator.sol'; interface IAggregator is IChainlinkAggregator { /// @notice The feed data this contract is responsible for /// @dev This is the key ID for the mapping in the dataFeedStore /// @return key The key ID for the feed function key() external view returns (uint32); /// @notice The dataFeedStore this contract is responsible for /// @dev The address of the underlying contract that stores the data /// @return dataFeedStore The address of the dataFeedStore function dataFeedStore() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; /// @title ProxyCall /// @notice Library for calling dataFeedStore functions /// @dev Contains utility functions for calling gas efficiently dataFeedStore functions and decoding return data library ProxyCall { /// @notice Gets the latest answer from the dataFeedStore /// @param key The key ID for the feed /// @param dataFeedStore The address of the dataFeedStore contract /// @return answer The latest stored value after being decoded function _latestAnswer( uint32 key, address dataFeedStore ) internal view returns (int256) { return int256( uint256( uint192( bytes24( _callDataFeed(dataFeedStore, abi.encodePacked(0x80000000 | key)) ) ) ) ); } /// @notice Gets the round data from the dataFeedStore /// @param _roundId The round ID to retrieve data for /// @param key The key ID for the feed /// @param dataFeedStore The address of the dataFeedStore contract /// @return roundId The round ID /// @return answer The value stored for the feed at the given round ID /// @return startedAt The timestamp when the value was stored /// @return updatedAt Same as startedAt /// @return answeredInRound Same as roundId function _getRoundData( uint80 _roundId, uint32 key, address dataFeedStore ) internal view returns (uint80, int256 answer, uint256 startedAt, uint256, uint80) { (answer, startedAt) = _decodeData( _callDataFeed( dataFeedStore, abi.encodeWithSelector(bytes4(0x20000000 | key), _roundId) ) ); return (_roundId, answer, startedAt, startedAt, _roundId); } /// @notice Gets the latest round ID for a given feed from the dataFeedStore /// @dev Using assembly achieves lower gas costs /// @param key The key ID for the feed /// @param dataFeedStore The address of the dataFeedStore contract /// @return roundId The latest round ID function _latestRound( uint32 key, address dataFeedStore ) internal view returns (uint256 roundId) { // using assembly staticcall costs less gas than using a view function assembly { // get free memory pointer let ptr := mload(0x40) // store selector in memory at location 0 mstore(0, shl(224, or(0x40000000, key))) // call dataFeedStore with selector 0xc0000000 | key (4 bytes) and store return value (64 bytes) at memory location ptr let success := staticcall(gas(), dataFeedStore, 0, 4, ptr, 64) // revert if call failed if iszero(success) { revert(0, 0) } // load return value from memory at location ptr // roundId is stored in the second 32 bytes of the return 64 bytes roundId := mload(add(ptr, 32)) } } /// @notice Gets the latest round data for a given feed from the dataFeedStore /// @dev Using assembly achieves lower gas costs /// @param key The key ID for the feed /// @param dataFeedStore The address of the dataFeedStore contract /// @return roundId The latest round ID /// @return answer The latest stored value after being decoded /// @return startedAt The timestamp when the value was stored /// @return updatedAt Same as startedAt /// @return answeredInRound Same as roundId function _latestRoundData( uint32 key, address dataFeedStore ) internal view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256, uint80) { bytes32 returnData; // using assembly staticcall costs less gas than using a view function assembly { // get free memory pointer let ptr := mload(0x40) // store selector in memory at location 0 mstore(0x00, shl(224, or(0xc0000000, key))) // call dataFeedStore with selector 0xc0000000 | key (4 bytes) and store return value (64 bytes) at memory location ptr let success := staticcall(gas(), dataFeedStore, 0x00, 4, ptr, 64) // revert if call failed if iszero(success) { revert(0, 0) } // assign return value to returnData returnData := mload(ptr) // load return value from memory at location ptr // roundId is stored in the second 32 bytes of the return 64 bytes roundId := mload(add(ptr, 32)) } (answer, startedAt) = _decodeData(returnData); return (roundId, answer, startedAt, startedAt, roundId); } /// @notice Calls the dataFeedStore with the given data /// @dev Using assembly achieves lower gas costs /// Used as a call() function to dataFeedStore /// @param dataFeedStore The address of the dataFeedStore contract /// @param data The data to call the dataFeedStore with /// @return returnData The return value from the dataFeedStore function _callDataFeed( address dataFeedStore, bytes memory data ) internal view returns (bytes32 returnData) { // using assembly staticcall costs less gas than using a view function assembly { // get free memory pointer let ptr := mload(0x40) // call dataFeedStore with data and store return value (32 bytes) at memory location ptr let success := staticcall( gas(), // gas remaining dataFeedStore, // address to call add(data, 32), // location of data to call (skip first 32 bytes of data which is the length of data) mload(data), // size of data to call ptr, // where to store the return data 32 // how much data to store ) // revert if call failed if iszero(success) { revert(0, 0) } // assign loaded return value at memory location ptr to returnData returnData := mload(ptr) } } /// @notice Decodes the return data from the dataFeedStore /// @param data The data to decode /// @return answer The value stored for the feed at the given round ID /// @return timestamp The timestamp when the value was stored function _decodeData(bytes32 data) internal pure returns (int256, uint256) { return (int256(uint256(uint192(bytes24(data)))), uint64(uint256(data))); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"string","name":"_description","type":"string"},{"internalType":"uint8","name":"_decimals","type":"uint8"},{"internalType":"uint32","name":"_key","type":"uint32"},{"internalType":"address","name":"_dataFeedStore","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"dataFeedStore","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","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":"key","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","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"}]
Contract Creation Code
60e06040523480156200001157600080fd5b50604051620009d1380380620009d18339810160408190526200003491620000c1565b60006200004285826200025f565b5060ff90921660805263ffffffff1660a0526001600160a01b031660c052506200032b565b634e487b7160e01b600052604160045260246000fd5b805160ff811681146200008f57600080fd5b919050565b805163ffffffff811681146200008f57600080fd5b80516001600160a01b03811681146200008f57600080fd5b60008060008060808587031215620000d857600080fd5b84516001600160401b0380821115620000f057600080fd5b818701915087601f8301126200010557600080fd5b8151818111156200011a576200011a62000067565b604051601f8201601f19908116603f0116810190838211818310171562000145576200014562000067565b81604052828152602093508a848487010111156200016257600080fd5b600091505b8282101562000186578482018401518183018501529083019062000167565b6000848483010152809850505050620001a18188016200007d565b94505050620001b36040860162000094565b9150620001c360608601620000a9565b905092959194509250565b600181811c90821680620001e357607f821691505b6020821081036200020457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200025a576000816000526020600020601f850160051c81016020861015620002355750805b601f850160051c820191505b81811015620002565782815560010162000241565b5050505b505050565b81516001600160401b038111156200027b576200027b62000067565b62000293816200028c8454620001ce565b846200020a565b602080601f831160018114620002cb5760008415620002b25750858301515b600019600386901b1c1916600185901b17855562000256565b600085815260208120601f198616915b82811015620002fc57888601518255948401946001909101908401620002db565b50858210156200031b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c051610640620003916000396000818161013f015281816101f30152818161024401528181610325015261038901526000818160d0015281816101d20152818161022301528181610304015261036801526000609201526106406000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80637284e4161161005b5780637284e416146101255780638b90201d1461013a5780639a6fc8f514610179578063feaf968c146101c357600080fd5b8063313ce5671461008d5780633943380c146100cb57806350d25bcd14610107578063668a0f021461011d575b600080fd5b6100b47f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020015b60405180910390f35b6100f27f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016100c2565b61010f6101cb565b6040519081526020016100c2565b61010f61021c565b61012d610268565b6040516100c2919061054e565b6101617f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c2565b61018c61018736600461059d565b6102f6565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016100c2565b61018c61035b565b60006102177f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006103be565b905090565b60006102177f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610404565b60008054610275906105d0565b80601f01602080910402602001604051908101604052809291908181526020018280546102a1906105d0565b80156102ee5780601f106102c3576101008083540402835291602001916102ee565b820191906000526020600020905b8154815290600101906020018083116102d157829003601f168201915b505050505081565b6000806000806000610349867f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000610436565b939a9299509097509550909350915050565b60008060008060006103ad7f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006104d1565b945094509450945094509091929394565b6040516001600160e01b03196380000000841760e01b1660208201526000906103fa90839060240160405160208183030381529060405261052a565b60401c9392505050565b60006040518363400000001760e01b60005260408160046000865afa8061042a57600080fd5b50602001519392505050565b60008060008060006104be6104a9878963200000001760e01b8b604051602401610472919069ffffffffffffffffffff91909116815260200190565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261052a565b604081901c9167ffffffffffffffff90911690565b9899909897508796508995509350505050565b6000806000806000806040518863c00000001760e01b600052604081600460008b5afa806104fe57600080fd5b50805160209091015199604082901c995067ffffffffffffffff90911697508796508995509350505050565b6000604051602081845160208601875afa8061054557600080fd5b50519392505050565b60006020808352835180602085015260005b8181101561057c57858101830151858201604001528201610560565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156105af57600080fd5b813569ffffffffffffffffffff811681146105c957600080fd5b9392505050565b600181811c908216806105e457607f821691505b60208210810361060457634e487b7160e01b600052602260045260246000fd5b5091905056fea2646970667358221220df1808e86f1cc6a6d63f83fcc8077268f06d89382182c510d8ef39e2ed0c7f3664736f6c63430008180033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000076000000000000000000000000ee5a4826068c5326a7f06fd6c7cbf816f096846c000000000000000000000000000000000000000000000000000000000000000a434f4d50202f2055534400000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80637284e4161161005b5780637284e416146101255780638b90201d1461013a5780639a6fc8f514610179578063feaf968c146101c357600080fd5b8063313ce5671461008d5780633943380c146100cb57806350d25bcd14610107578063668a0f021461011d575b600080fd5b6100b47f000000000000000000000000000000000000000000000000000000000000000881565b60405160ff90911681526020015b60405180910390f35b6100f27f000000000000000000000000000000000000000000000000000000000000007681565b60405163ffffffff90911681526020016100c2565b61010f6101cb565b6040519081526020016100c2565b61010f61021c565b61012d610268565b6040516100c2919061054e565b6101617f000000000000000000000000ee5a4826068c5326a7f06fd6c7cbf816f096846c81565b6040516001600160a01b0390911681526020016100c2565b61018c61018736600461059d565b6102f6565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016100c2565b61018c61035b565b60006102177f00000000000000000000000000000000000000000000000000000000000000767f000000000000000000000000ee5a4826068c5326a7f06fd6c7cbf816f096846c6103be565b905090565b60006102177f00000000000000000000000000000000000000000000000000000000000000767f000000000000000000000000ee5a4826068c5326a7f06fd6c7cbf816f096846c610404565b60008054610275906105d0565b80601f01602080910402602001604051908101604052809291908181526020018280546102a1906105d0565b80156102ee5780601f106102c3576101008083540402835291602001916102ee565b820191906000526020600020905b8154815290600101906020018083116102d157829003601f168201915b505050505081565b6000806000806000610349867f00000000000000000000000000000000000000000000000000000000000000767f000000000000000000000000ee5a4826068c5326a7f06fd6c7cbf816f096846c610436565b939a9299509097509550909350915050565b60008060008060006103ad7f00000000000000000000000000000000000000000000000000000000000000767f000000000000000000000000ee5a4826068c5326a7f06fd6c7cbf816f096846c6104d1565b945094509450945094509091929394565b6040516001600160e01b03196380000000841760e01b1660208201526000906103fa90839060240160405160208183030381529060405261052a565b60401c9392505050565b60006040518363400000001760e01b60005260408160046000865afa8061042a57600080fd5b50602001519392505050565b60008060008060006104be6104a9878963200000001760e01b8b604051602401610472919069ffffffffffffffffffff91909116815260200190565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261052a565b604081901c9167ffffffffffffffff90911690565b9899909897508796508995509350505050565b6000806000806000806040518863c00000001760e01b600052604081600460008b5afa806104fe57600080fd5b50805160209091015199604082901c995067ffffffffffffffff90911697508796508995509350505050565b6000604051602081845160208601875afa8061054557600080fd5b50519392505050565b60006020808352835180602085015260005b8181101561057c57858101830151858201604001528201610560565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156105af57600080fd5b813569ffffffffffffffffffff811681146105c957600080fd5b9392505050565b600181811c908216806105e457607f821691505b60208210810361060457634e487b7160e01b600052602260045260246000fd5b5091905056fea2646970667358221220df1808e86f1cc6a6d63f83fcc8077268f06d89382182c510d8ef39e2ed0c7f3664736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000076000000000000000000000000ee5a4826068c5326a7f06fd6c7cbf816f096846c000000000000000000000000000000000000000000000000000000000000000a434f4d50202f2055534400000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _description (string): COMP / USD
Arg [1] : _decimals (uint8): 8
Arg [2] : _key (uint32): 118
Arg [3] : _dataFeedStore (address): 0xeE5a4826068C5326a7f06fD6c7cBf816F096846c
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000076
Arg [3] : 000000000000000000000000ee5a4826068c5326a7f06fd6c7cbf816f096846c
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [5] : 434f4d50202f2055534400000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 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.