Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Transfer Ownersh... | 12833347 | 1350 days ago | IN | 0 ETH | 0.0014263 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Prices
Compiler Version
v0.8.6+commit.11564f7e
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/access/Ownable.sol"; import "./interfaces/IPrices.sol"; /** @notice Manage and normalizes ETH price feeds. */ contract Prices is IPrices, Ownable { // --- public constant stored properties --- // /// @notice The target number of decimals the price feed results have. uint256 public constant override targetDecimals = 18; // --- public stored properties --- // /// @notice The number to multiply each price feed by to get to the target decimals. mapping(uint256 => uint256) public override feedDecimalAdjuster; /// @notice The available price feeds that can be used to get the price of ETH. mapping(uint256 => AggregatorV3Interface) public override feedFor; // --- external views --- // /** @notice Gets the current price of ETH for the provided currency. @param _currency The currency to get a price for. @return price The price of ETH with 18 decimals. */ function getETHPriceFor(uint256 _currency) external view override returns (uint256) { // The 0 currency is ETH itself. if (_currency == 0) return 10**targetDecimals; // Get a reference to the feed. AggregatorV3Interface _feed = feedFor[_currency]; // Feed must exist. require( _feed != AggregatorV3Interface(address(0)), "Prices::getETHPrice: NOT_FOUND" ); // Get the lateset round information. Only need the price is needed. (, int256 _price, , , ) = _feed.latestRoundData(); // Multiply the price by the decimal adjuster to get the normalized result. return uint256(_price) * feedDecimalAdjuster[_currency]; } // --- external transactions --- // /** @notice Add a price feed for the price of ETH. @dev Current feeds can't be modified. @param _feed The price feed being added. @param _currency The currency that the price feed is for. */ function addFeed(AggregatorV3Interface _feed, uint256 _currency) external override onlyOwner { // The 0 currency is reserved for ETH. require(_currency > 0, "Prices::addFeed: RESERVED"); // There can't already be a feed for the specified currency. require( feedFor[_currency] == AggregatorV3Interface(address(0)), "Prices::addFeed: ALREADY_EXISTS" ); // Get a reference to the number of decimals the feed uses. uint256 _decimals = _feed.decimals(); // Decimals should be less than or equal to the target number of decimals. require(_decimals <= targetDecimals, "Prices::addFeed: BAD_DECIMALS"); // Set the feed. feedFor[_currency] = _feed; // Set the decimal adjuster for the currency. feedDecimalAdjuster[_currency] = 10**(targetDecimals - _decimals); emit AddFeed(_currency, _feed); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; interface IPrices { event AddFeed(uint256 indexed currency, AggregatorV3Interface indexed feed); function feedDecimalAdjuster(uint256 _currency) external returns (uint256); function targetDecimals() external returns (uint256); function feedFor(uint256 _currency) external returns (AggregatorV3Interface); function getETHPriceFor(uint256 _currency) external view returns (uint256); function addFeed(AggregatorV3Interface _priceFeed, uint256 _currency) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// 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 ); }
{ "optimizer": { "enabled": true, "runs": 10000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"currency","type":"uint256"},{"indexed":true,"internalType":"contract AggregatorV3Interface","name":"feed","type":"address"}],"name":"AddFeed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract AggregatorV3Interface","name":"_feed","type":"address"},{"internalType":"uint256","name":"_currency","type":"uint256"}],"name":"addFeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"feedDecimalAdjuster","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"feedFor","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_currency","type":"uint256"}],"name":"getETHPriceFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"targetDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610b268061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b1461012d5780639fa937231461014b578063a967c20b1461015e578063f2fde38b1461017157600080fd5b80630aee17f21461008d57806336c1387e146100c05780633e495e66146100c8578063715018a614610123575b600080fd5b6100ad61009b366004610898565b60016020526000908152604090205481565b6040519081526020015b60405180910390f35b6100ad601281565b6100fe6100d6366004610898565b60026020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b7565b61012b610184565b005b60005473ffffffffffffffffffffffffffffffffffffffff166100fe565b6100ad610159366004610898565b610216565b61012b61016c36600461086c565b610363565b61012b61017f366004610848565b610684565b60005473ffffffffffffffffffffffffffffffffffffffff16331461020a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61021460006107b4565b565b60008161022f576102296012600a610985565b92915050565b60008281526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16806102bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072696365733a3a67657445544850726963653a204e4f545f464f554e4400006044820152606401610201565b60008173ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561030357600080fd5b505afa158015610317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033b91906108b1565b50505060008681526001602052604090205490925061035b915082610a4b565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610201565b6000811161044e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5072696365733a3a616464466565643a205245534552564544000000000000006044820152606401610201565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16156104da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5072696365733a3a616464466565643a20414c52454144595f455849535453006044820152606401610201565b60008273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561052257600080fd5b505afa158015610536573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055a9190610901565b60ff16905060128111156105ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5072696365733a3a616464466565643a204241445f444543494d414c530000006044820152606401610201565b600082815260026020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8516179055610621816012610a88565b61062c90600a610985565b60008381526001602052604080822092909255905173ffffffffffffffffffffffffffffffffffffffff85169184917f39f7e6a3cfe66d8f71a7951583f7e721ef29d4650eddf11122c8df3aa1c772fd9190a3505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610705576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610201565b73ffffffffffffffffffffffffffffffffffffffff81166107a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610201565b6107b1816107b4565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805169ffffffffffffffffffff8116811461084357600080fd5b919050565b60006020828403121561085a57600080fd5b813561086581610ace565b9392505050565b6000806040838503121561087f57600080fd5b823561088a81610ace565b946020939093013593505050565b6000602082840312156108aa57600080fd5b5035919050565b600080600080600060a086880312156108c957600080fd5b6108d286610829565b94506020860151935060408601519250606086015191506108f560808701610829565b90509295509295909350565b60006020828403121561091357600080fd5b815160ff8116811461086557600080fd5b600181815b8085111561097d57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561096357610963610a9f565b8085161561097057918102915b93841c9390800290610929565b509250929050565b6000610865838360008261099b57506001610229565b816109a857506000610229565b81600181146109be57600281146109c8576109e4565b6001915050610229565b60ff8411156109d9576109d9610a9f565b50506001821b610229565b5060208310610133831016604e8410600b8410161715610a07575081810a610229565b610a118383610924565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610a4357610a43610a9f565b029392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610a8357610a83610a9f565b500290565b600082821015610a9a57610a9a610a9f565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146107b157600080fdfea26469706673582212202251d9e3bc60df31fd17f29546da2a321684dc4dcdf6ececf984dba7f73d0efe64736f6c63430008060033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b1461012d5780639fa937231461014b578063a967c20b1461015e578063f2fde38b1461017157600080fd5b80630aee17f21461008d57806336c1387e146100c05780633e495e66146100c8578063715018a614610123575b600080fd5b6100ad61009b366004610898565b60016020526000908152604090205481565b6040519081526020015b60405180910390f35b6100ad601281565b6100fe6100d6366004610898565b60026020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b7565b61012b610184565b005b60005473ffffffffffffffffffffffffffffffffffffffff166100fe565b6100ad610159366004610898565b610216565b61012b61016c36600461086c565b610363565b61012b61017f366004610848565b610684565b60005473ffffffffffffffffffffffffffffffffffffffff16331461020a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b61021460006107b4565b565b60008161022f576102296012600a610985565b92915050565b60008281526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16806102bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5072696365733a3a67657445544850726963653a204e4f545f464f554e4400006044820152606401610201565b60008173ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561030357600080fd5b505afa158015610317573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033b91906108b1565b50505060008681526001602052604090205490925061035b915082610a4b565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610201565b6000811161044e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5072696365733a3a616464466565643a205245534552564544000000000000006044820152606401610201565b60008181526002602052604090205473ffffffffffffffffffffffffffffffffffffffff16156104da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5072696365733a3a616464466565643a20414c52454144595f455849535453006044820152606401610201565b60008273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561052257600080fd5b505afa158015610536573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055a9190610901565b60ff16905060128111156105ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f5072696365733a3a616464466565643a204241445f444543494d414c530000006044820152606401610201565b600082815260026020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8516179055610621816012610a88565b61062c90600a610985565b60008381526001602052604080822092909255905173ffffffffffffffffffffffffffffffffffffffff85169184917f39f7e6a3cfe66d8f71a7951583f7e721ef29d4650eddf11122c8df3aa1c772fd9190a3505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610705576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610201565b73ffffffffffffffffffffffffffffffffffffffff81166107a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610201565b6107b1816107b4565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b805169ffffffffffffffffffff8116811461084357600080fd5b919050565b60006020828403121561085a57600080fd5b813561086581610ace565b9392505050565b6000806040838503121561087f57600080fd5b823561088a81610ace565b946020939093013593505050565b6000602082840312156108aa57600080fd5b5035919050565b600080600080600060a086880312156108c957600080fd5b6108d286610829565b94506020860151935060408601519250606086015191506108f560808701610829565b90509295509295909350565b60006020828403121561091357600080fd5b815160ff8116811461086557600080fd5b600181815b8085111561097d57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561096357610963610a9f565b8085161561097057918102915b93841c9390800290610929565b509250929050565b6000610865838360008261099b57506001610229565b816109a857506000610229565b81600181146109be57600281146109c8576109e4565b6001915050610229565b60ff8411156109d9576109d9610a9f565b50506001821b610229565b5060208310610133831016604e8410600b8410161715610a07575081810a610229565b610a118383610924565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610a4357610a43610a9f565b029392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610a8357610a83610a9f565b500290565b600082821015610a9a57610a9a610a9f565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146107b157600080fdfea26469706673582212202251d9e3bc60df31fd17f29546da2a321684dc4dcdf6ececf984dba7f73d0efe64736f6c63430008060033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
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.