Source Code
Overview
S Balance
More Info
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xb87b0bC8...e35F0fbAE The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
PriceFeed
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 2000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MITpragma solidity 0.7.6;import "../interfaces/IPriceFeed.sol";import "../interfaces/IBandStdReference.sol";import "../interfaces/IChainlinkAggregator.sol";import "../dependencies/openzeppelin/contracts/SafeMath.sol";/** PriceFeed for mainnet deployment, to be connected to Chainlink's live ETH:USD aggregator reference* contract, and a wrapper contract bandOracle, which connects to BandMaster contract.** The PriceFeed uses Chainlink as primary oracle, and Band as fallback. It contains logic for* switching oracles based on oracle failures, timeouts, and conditions for returning to the primary* Chainlink oracle.*/contract PriceFeed is IPriceFeed {using SafeMath for uint256;uint constant public DECIMAL_PRECISION = 1e18;IChainlinkAggregator public chainlinkOracle; // Mainnet Chainlink aggregatorIBandStdReference public bandOracle; // Wrapper contract that calls the Band systemstring public bandBase;
1234567891011121314151617181920212223242526// SPDX-License-Identifier: agpl-3.0pragma solidity 0.7.6;/*** @dev Wrappers over Solidity's arithmetic operations with added overflow* checks.** Arithmetic operations in Solidity wrap on overflow. This can easily result* in bugs, because programmers usually assume that an overflow raises an* error, which is the standard behavior in high level programming languages.* `SafeMath` restores this intuition by reverting the transaction when an* operation overflows.** Using this library instead of the unchecked operations eliminates an entire* class of bugs, so it's recommended to use it always.*/library SafeMath {/*** @dev Returns the addition of two unsigned integers, reverting on* overflow.** Counterpart to Solidity's `+` operator.** Requirements:* - Addition cannot overflow.*/
123456789101112pragma solidity 0.7.6;interface IBandStdReference {/// Returns the price data for the given base/quote pair. Revert if not available.function getReferenceData(string memory _base, string memory _quote)externalviewreturns (uint256 rate, uint256 lastUpdatedBase, uint256 lastUpdatedRate);}
1234567891011121314151617181920212223242526// SPDX-License-Identifier: MIT// Code from https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.solpragma solidity 0.7.6;interface IChainlinkAggregator {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)externalviewreturns (uint80 roundId,int256 answer,uint256 startedAt,uint256 updatedAt,uint80 answeredInRound);function latestRoundData()
12345678910// SPDX-License-Identifier: MITpragma solidity 0.7.6;interface IPriceFeed {// --- Function ---function fetchPrice() external view returns (uint);function updatePrice() external returns (uint);}
12345678910111213141516171819202122{"optimizer": {"enabled": true,"runs": 2000},"outputSelection": {"*": {"*": ["evm.bytecode","evm.deployedBytecode","devdoc","userdoc","metadata","abi"]}},"metadata": {"useLiteralContent": true},"libraries": {}}
Contract ABI
API[{"inputs":[{"internalType":"contract IChainlinkAggregator","name":"_chainlinkOracleAddress","type":"address"},{"internalType":"contract IBandStdReference","name":"_bandOracleAddress","type":"address"},{"internalType":"uint256","name":"_timeout","type":"uint256"},{"internalType":"string","name":"_bandBase","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_lastGoodPrice","type":"uint256"}],"name":"LastGoodPriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum PriceFeed.Status","name":"newStatus","type":"uint8"}],"name":"PriceFeedStatusChanged","type":"event"},{"inputs":[],"name":"DECIMAL_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PRICE_DEVIATION_FROM_PREVIOUS_ROUND","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PRICE_DIFFERENCE_BETWEEN_ORACLES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TARGET_DIGITS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TIMEOUT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bandBase","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bandOracle","outputs":[{"internalType":"contract IBandStdReference","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bandQuote","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkOracle","outputs":[{"internalType":"contract IChainlinkAggregator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fetchPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastGoodPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"status","outputs":[{"internalType":"enum PriceFeed.Status","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"updatePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100df5760003560e01c806358a6aa881161008c578063a20baee611610066578063a20baee6146101fd578063afa22d1f14610205578063ef06e72c1461020d578063f56f48f214610215576100df565b806358a6aa88146101bc578063673a7e28146101c4578063956dcd1f146101cc576100df565b8063200d2ed2116100bd578063200d2ed21461010e57806326d182d51461013757806345079cb4146101b4576100df565b80630490be83146100e45780630fdb11cf146100fe5780631be5c92f14610106575b600080fd5b6100ec61021d565b60408051918252519081900360200190f35b6100ec610223565b6100ec610236565b61011661023b565b6040518082600481111561012657fe5b815260200191505060405180910390f35b61013f610244565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610179578181015183820152602001610161565b50505050905090810190601f1680156101a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100ec6102cf565b6100ec6102da565b6100ec6102e6565b6101d46103a3565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100ec6103bf565b61013f6103cb565b6101d4610404565b6100ec610420565b60035481565b60008061022e61052a565b925050505b90565b601281565b60045460ff1681565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156102c75780601f1061029c576101008083540402835291602001916102c7565b820191906000526020600020905b8154815290600101906020018083116102aa57829003601f168201915b505050505081565b66b1a2bc2ec5000081565b6706f05b59d3b2000081565b60008060006102f361052a565b6003819055909250905081600481111561030957fe5b6004805460ff169081111561031a57fe5b1461039d57600480548391907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001838381111561035557fe5b02179055507f5c57579a8214fe4f710c1c56fa829f045b9fa6d225a744225a30c32188064d4e826040518082600481111561038c57fe5b815260200191505060405180910390a15b91505090565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b670de0b6b3a764000081565b6040518060400160405280600381526020017f555344000000000000000000000000000000000000000000000000000000000081525081565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000000000000000000000000000000000000000384081565b600061048683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061088a565b90505b92915050565b600061048683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610926565b6000826104e057506000610489565b828202828482816104ed57fe5b04146104865760405162461bcd60e51b81526004018080602001828103825260218152602001806111356021913960400191505060405180910390fd5b600080600061053761098b565b9050600061054d82600001518360800151610b1c565b90506000610559610c2f565b905060006004805460ff169081111561056e57fe5b14156106c75761057e8383610e19565b156105d05761058c81610e33565b156105a257600260035494509450505050610886565b6105ab81610e7e565b156105c157600160035494509450505050610886565b51600194509250610886915050565b6105d983610ebf565b1561062a576105e781610e33565b156105fd57600460035494509450505050610886565b61060681610e7e565b1561061b576003805494509450505050610886565b51600394509250610886915050565b6106348383610ef9565b156106975761064281610e33565b1561065857600260035494509450505050610886565b61066181610e7e565b1561067757600160035494509450505050610886565b6106818382610f6b565b156105c157505060200151600092509050610886565b6106a081610e33565b156106b657505060200151600492509050610886565b505060200151600092509050610886565b60016004805460ff16908111156106da57fe5b141561070a576106eb838383610fce565b1561070157505060200151600092509050610886565b61058c81610e33565b60026004805460ff169081111561071d57fe5b14156107555761072e838383610fce565b1561074457505060200151600092509050610886565b600260035494509450505050610886565b60036004805460ff169081111561076857fe5b14156107da576107788383610e19565b156107865761058c81610e33565b61078f83610ebf565b1561079d576105e781610e33565b6107a681610e33565b156107bc57505060200151600492509050610886565b6107c581610e7e565b15610677576003805494509450505050610886565b6004805460ff16818111156107eb57fe5b1415610882576107fb8383610e19565b1561081157600260035494509450505050610886565b61081a83610ebf565b1561083057600460035494509450505050610886565b61083b838383610fce565b1561085157505060200151600092509050610886565b61085b8383610ef9565b1561087157600260035494509450505050610886565b505060200151600492509050610886565b5050505b9091565b600081848411156109195760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156108de5781810151838201526020016108c6565b50505050905090810190601f16801561090b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50508183035b9392505050565b600081836109755760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156108de5781810151838201526020016108c6565b50600083858161098157fe5b0495945050505050565b6109936110e3565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156109f957600080fd5b505afa925050508015610a1e57506040513d6020811015610a1957600080fd5b505160015b610a2757610233565b60ff16608082015260008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b158015610a9557600080fd5b505afa925050508015610ad757506040513d60a0811015610ab557600080fd5b5080516020820151604083015160608401516080909401519293919290919060015b610ae057610233565b69ffffffffffffffffffff851686526080860151610b0290859060ff16611026565b602087015250604085015250506001606083015250610233565b610b246110e3565b600054604080517f9a6fc8f500000000000000000000000000000000000000000000000000000000815269ffffffffffffffffffff6000198701166004820152905173ffffffffffffffffffffffffffffffffffffffff90921691639a6fc8f59160248082019260a092909190829003018186803b158015610ba557600080fd5b505afa925050508015610be757506040513d60a0811015610bc557600080fd5b5080516020820151604083015160608401516080909401519293919290919060015b610bf057610489565b69ffffffffffffffffffff85168652610c0c8460ff8916611026565b602087015250604085015250505060ff8216608082015260016060820152610489565b610c37611111565b60018054604080518082018252600381527f5553440000000000000000000000000000000000000000000000000000000000602082015281517f65555bcc00000000000000000000000000000000000000000000000000000000815260048101928352600280546000199681161561010002969096019095168590046044820181905273ffffffffffffffffffffffffffffffffffffffff909416946365555bcc94909391829160248201916064019086908015610d365780601f10610d0b57610100808354040283529160200191610d36565b820191906000526020600020905b815481529060010190602001808311610d1957829003601f168201915b5050838103825284518152845160209182019186019080838360005b83811015610d6a578181015183820152602001610d52565b50505050905090810190601f168015610d975780820380516001836020036101000a031916815260200191505b5094505050505060606040518083038186803b158015610db657600080fd5b505afa925050508015610dea57506040513d6060811015610dd657600080fd5b508051602082015160409092015190919060015b610df357610233565b828452808210610e035780610e05565b815b602085015250506001604083015250610233565b6000610e2483611081565b80610486575061048682611081565b60008160400151610e4657506001610e79565b60208201511580610e5a5750428260200151115b15610e6757506001610e79565b8151610e7557506001610e79565b5060005b919050565b60007f0000000000000000000000000000000000000000000000000000000000003840610eb883602001514261044490919063ffffffff16565b1192915050565b60007f0000000000000000000000000000000000000000000000000000000000003840610eb883604001514261044490919063ffffffff16565b602080830151908201516000919082818310610f155781610f17565b825b9050600082841015610f295782610f2b565b835b90506000610f5582610f4f670de0b6b3a7640000610f498388610444565b906104d1565b9061048f565b6706f05b59d3b200001098975050505050505050565b602082015181516000919082828210610f845782610f86565b815b9050600083831015610f985783610f9a565b825b90506000610fb883610f4f670de0b6b3a7640000610f498684610444565b66b1a2bc2ec50000101598975050505050505050565b6000610fd982610e33565b80610fe85750610fe882610e7e565b80610ff85750610ff88484610e19565b80611007575061100784610ebf565b156110145750600061091f565b61101e8483610f6b565b949350505050565b6000806012831061106757611060847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee8501600a0a61048f565b9050610486565b60128310156104865761101e846012859003600a0a6104d1565b6000816060015161109457506001610e79565b815169ffffffffffffffffffff166110ae57506001610e79565b604082015115806110c25750428260400151115b156110cf57506001610e79565b6000826020015113610e7557506001610e79565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b60405180606001604052806000815260200160008152602001600015158152509056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220080557f8f1170176c468c5266401b3267c409ba97268ec1b5d02ffcce263822c64736f6c63430007060033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 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.