Contract Overview
Balance:
0 ETH
ETH Value:
$0.00
My Name Tag:
Not Available
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x0eefec7be6031714e539681ecefb692d93f9363e48f5ad197c4c9f460588031e | Add Price Feed | 25975625 | 137 days 10 hrs ago | 0xa67d0c1180e0e183f482304a9b5436a3478f0674 | IN | 0xa5a095f2a2beb2d53382293b0ffe0f520ddec297 | 0 ETH | 0.00001643 | |
0x63c16cd18c7fdb5eb1e260a7718d6b7c6846c3b8df264be9f9bb9b949f888415 | 0x60806040 | 25975433 | 137 days 10 hrs ago | 0xa67d0c1180e0e183f482304a9b5436a3478f0674 | IN | Contract Creation | 0 ETH | 0.00016318 |
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xCF36A344d739d1Ac7369bF97581282d4e0413B26
Contract Name:
PriceFeed
Compiler Version
v0.8.14+commit.80d49f37
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "./interfaces/AggregatorV3Interface.sol"; import "./libraries/AccessControl.sol"; /** * @title Contract used for accessing exchange rates using chainlink price feeds * @dev Interacts with chainlink price feeds and services all contracts in the system for price data. */ contract PriceFeed is AccessControl { ///////////////////////////////////// /// governance settable variables /// ///////////////////////////////////// mapping(address => mapping(address => address)) public priceFeeds; ////////////////////////// /// constant variables /// ////////////////////////// uint8 private constant SCALE_DECIMALS = 18; // seconds since the last price feed update until we deem the data to be stale uint32 private constant STALE_PRICE_DELAY = 3600; constructor(address _authority) AccessControl(IAuthority(_authority)) {} /////////////// /// setters /// /////////////// function addPriceFeed( address underlying, address strike, address feed ) public { _onlyGovernor(); priceFeeds[underlying][strike] = feed; } /////////////////////// /// complex getters /// /////////////////////// function getRate(address underlying, address strike) external view returns (uint256) { address feedAddress = priceFeeds[underlying][strike]; require(feedAddress != address(0), "Price feed does not exist"); AggregatorV3Interface feed = AggregatorV3Interface(feedAddress); (uint80 roundId, int256 rate, , uint256 timestamp, uint80 answeredInRound) = feed .latestRoundData(); require(rate > 0, "ChainLinkPricer: price is lower than 0"); require(timestamp != 0, "ROUND_NOT_COMPLETE"); require(block.timestamp <= timestamp + STALE_PRICE_DELAY, "STALE_PRICE"); require(answeredInRound >= roundId, "STALE_PRICE"); return uint256(rate); } /// @dev get the rate from chainlink and convert it to e18 decimals function getNormalizedRate(address underlying, address strike) external view returns (uint256) { address feedAddress = priceFeeds[underlying][strike]; require(feedAddress != address(0), "Price feed does not exist"); AggregatorV3Interface feed = AggregatorV3Interface(feedAddress); uint8 feedDecimals = feed.decimals(); (uint80 roundId, int256 rate, , uint256 timestamp, uint80 answeredInRound) = feed .latestRoundData(); require(rate > 0, "ChainLinkPricer: price is lower than 0"); require(timestamp != 0, "ROUND_NOT_COMPLETE"); require(block.timestamp <= timestamp + STALE_PRICE_DELAY, "STALE_PRICE"); require(answeredInRound >= roundId, "STALE_PRICE_ROUND"); uint8 difference; if (SCALE_DECIMALS > feedDecimals) { difference = SCALE_DECIMALS - feedDecimals; return uint256(rate) * (10**difference); } difference = feedDecimals - SCALE_DECIMALS; return uint256(rate) / (10**difference); } }
// SPDX-License-Identifier: UNLICENSED 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 ); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "../interfaces/IAuthority.sol"; error UNAUTHORIZED(); /** * @title Contract used for access control functionality, based off of OlympusDao Access Control */ abstract contract AccessControl { /* ========== EVENTS ========== */ event AuthorityUpdated(IAuthority authority); /* ========== STATE VARIABLES ========== */ IAuthority public authority; /* ========== Constructor ========== */ constructor(IAuthority _authority) { authority = _authority; emit AuthorityUpdated(_authority); } /* ========== GOV ONLY ========== */ function setAuthority(IAuthority _newAuthority) external { _onlyGovernor(); authority = _newAuthority; emit AuthorityUpdated(_newAuthority); } /* ========== INTERNAL CHECKS ========== */ function _onlyGovernor() internal view { if (msg.sender != authority.governor()) revert UNAUTHORIZED(); } function _onlyGuardian() internal view { if (!authority.guardian(msg.sender) && msg.sender != authority.governor()) revert UNAUTHORIZED(); } function _onlyManager() internal view { if (msg.sender != authority.manager() && msg.sender != authority.governor()) revert UNAUTHORIZED(); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.0; interface IAuthority { /* ========== EVENTS ========== */ event GovernorPushed(address indexed from, address indexed to); event GuardianPushed(address indexed to); event ManagerPushed(address indexed from, address indexed to); event GovernorPulled(address indexed from, address indexed to); event GuardianRevoked(address indexed to); event ManagerPulled(address indexed from, address indexed to); /* ========== VIEW ========== */ function governor() external view returns (address); function guardian(address _target) external view returns (bool); function manager() external view returns (address); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"address","name":"_authority","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"UNAUTHORIZED","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IAuthority","name":"authority","type":"address"}],"name":"AuthorityUpdated","type":"event"},{"inputs":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"strike","type":"address"},{"internalType":"address","name":"feed","type":"address"}],"name":"addPriceFeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"authority","outputs":[{"internalType":"contract IAuthority","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"strike","type":"address"}],"name":"getNormalizedRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"strike","type":"address"}],"name":"getRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"priceFeeds","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IAuthority","name":"_newAuthority","type":"address"}],"name":"setAuthority","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051610b2e380380610b2e83398101604081905261002f91610089565b600080546001600160a01b0319166001600160a01b03831690811790915560405190815281907f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad9060200160405180910390a150506100b9565b60006020828403121561009b57600080fd5b81516001600160a01b03811681146100b257600080fd5b9392505050565b610a66806100c86000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806314738a6c146100675780631b10a9491461008d578063379b87ea146100a25780637a9e5e4b146100b5578063bf7e214f146100c8578063f90c6906146100f3575b600080fd5b61007a6100753660046106ec565b610127565b6040519081526020015b60405180910390f35b6100a061009b366004610725565b6103d3565b005b61007a6100b03660046106ec565b610418565b6100a06100c3366004610770565b6105d0565b6000546100db906001600160a01b031681565b6040516001600160a01b039091168152602001610084565b6100db6101013660046106ec565b60016020908152600092835260408084209091529082529020546001600160a01b031681565b6001600160a01b03808316600090815260016020908152604080832085851684529091528120549091168061019f5760405162461bcd60e51b8152602060048201526019602482015278141c9a58d9481999595908191bd95cc81b9bdd08195e1a5cdd603a1b60448201526064015b60405180910390fd5b60008190506000816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102089190610794565b9050600080600080856001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa15801561024e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027291906107d3565b9450945050935093506000831361029b5760405162461bcd60e51b815260040161019690610823565b816000036102e05760405162461bcd60e51b8152602060048201526012602482015271524f554e445f4e4f545f434f4d504c45544560701b6044820152606401610196565b6102ec610e108361087f565b42111561030b5760405162461bcd60e51b815260040161019690610897565b836001600160501b0316816001600160501b031610156103615760405162461bcd60e51b815260206004820152601160248201527014d510531157d4149250d157d493d55391607a1b6044820152606401610196565b600060ff8616601211156103a05761037a8660126108bc565b905061038781600a6109c3565b61039190856109d2565b985050505050505050506103cd565b6103ab6012876108bc565b90506103b881600a6109c3565b6103c290856109f1565b985050505050505050505b92915050565b6103db61062c565b6001600160a01b03928316600090815260016020908152604080832094861683529390529190912080546001600160a01b03191691909216179055565b6001600160a01b03808316600090815260016020908152604080832085851684529091528120549091168061048b5760405162461bcd60e51b8152602060048201526019602482015278141c9a58d9481999595908191bd95cc81b9bdd08195e1a5cdd603a1b6044820152606401610196565b6000819050600080600080846001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156104d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f891906107d3565b945094505093509350600083136105215760405162461bcd60e51b815260040161019690610823565b816000036105665760405162461bcd60e51b8152602060048201526012602482015271524f554e445f4e4f545f434f4d504c45544560701b6044820152606401610196565b610572610e108361087f565b4211156105915760405162461bcd60e51b815260040161019690610897565b836001600160501b0316816001600160501b031610156105c35760405162461bcd60e51b815260040161019690610897565b5090979650505050505050565b6105d861062c565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f2f658b440c35314f52658ea8a740e05b284cdc84dc9ae01e891f21b8933e7cad9060200160405180910390a150565b60008054906101000a90046001600160a01b03166001600160a01b0316630c340a246040518163ffffffff1660e01b8152600401602060405180830381865afa15801561067d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106a19190610a13565b6001600160a01b0316336001600160a01b0316146106d25760405163075fd2b160e01b815260040160405180910390fd5b565b6001600160a01b03811681146106e957600080fd5b50565b600080604083850312156106ff57600080fd5b823561070a816106d4565b9150602083013561071a816106d4565b809150509250929050565b60008060006060848603121561073a57600080fd5b8335610745816106d4565b92506020840135610755816106d4565b91506040840135610765816106d4565b809150509250925092565b60006020828403121561078257600080fd5b813561078d816106d4565b9392505050565b6000602082840312156107a657600080fd5b815160ff8116811461078d57600080fd5b80516001600160501b03811681146107ce57600080fd5b919050565b600080600080600060a086880312156107eb57600080fd5b6107f4866107b7565b9450602086015193506040860151925060608601519150610817608087016107b7565b90509295509295909350565b60208082526026908201527f436861696e4c696e6b5072696365723a207072696365206973206c6f7765722060408201526507468616e20360d41b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000821982111561089257610892610869565b500190565b6020808252600b908201526a5354414c455f505249434560a81b604082015260600190565b600060ff821660ff8416808210156108d6576108d6610869565b90039392505050565b600181815b8085111561091a57816000190482111561090057610900610869565b8085161561090d57918102915b93841c93908002906108e4565b509250929050565b600082610931575060016103cd565b8161093e575060006103cd565b8160018114610954576002811461095e5761097a565b60019150506103cd565b60ff84111561096f5761096f610869565b50506001821b6103cd565b5060208310610133831016604e8410600b841016171561099d575081810a6103cd565b6109a783836108df565b80600019048211156109bb576109bb610869565b029392505050565b600061078d60ff841683610922565b60008160001904831182151516156109ec576109ec610869565b500290565b600082610a0e57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215610a2557600080fd5b815161078d816106d456fea26469706673582212207a13445b4ac7b22b677623a2fed588e6a9ccf007af254780cdedd1b58fea8f0d64736f6c634300080e0033000000000000000000000000b10ea60c0228acd7bd31ef86949b03ae48ee57f1
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.