ERC-20
Overview
Max Total Supply
0 DOT/USD Price Feed
Holders
0
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 8 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x1296d3a1...7915d8001 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
PriceFeedStore
Compiler Version
v0.8.19+commit.7dd6d404
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.19; import "@openzeppelin/contracts/access/Ownable.sol"; contract PriceFeedStore is Ownable { address public xOracle; string public name; uint256 public tokenIndex; uint256 public decimals; // price store struct PriceData { uint256 price; uint256 latestPrice; uint256 timestamp; } mapping(uint256 => PriceData) public pricesData; uint256 public latestRound; uint256 public latestTimestamp; event UpdatePrice(uint256 indexed tokenIndex, uint256 roundId, uint256 price, uint256 latestPrice, uint256 timestamp); event SetXOracle(address xOracle); modifier onlyXOracle() { require(xOracle == msg.sender, "xOracle: forbidden"); _; } constructor(address _xOracle, string memory _name, uint256 _tokenIndex, uint256 _decimals) { require(_xOracle != address(0), "address invalid"); xOracle = _xOracle; name = _name; tokenIndex = _tokenIndex; decimals = _decimals; } // ------------------------------ // xOracle setPrice // ------------------------------ function setPrice(uint256 _price, uint256 _timestamp) external onlyXOracle { // Sometimes the fulfill request is not in order in a short time. // So it's possible that the price is not the latest price. // _price is the fulfilling price, but latestPrice is the newest price at the time. uint256 latestPrice; if (_timestamp > latestTimestamp) { latestPrice = _price; latestTimestamp = _timestamp; } else { latestPrice = pricesData[latestRound].latestPrice; } // next round latestRound++; // already checked correct tokenIndex in xOracle.setPriceFeedStore pricesData[latestRound] = PriceData({ price: _price, latestPrice: latestPrice, timestamp: block.timestamp }); emit UpdatePrice(tokenIndex, latestRound, _price, latestPrice, block.timestamp); } // ------------------------------ // onlyOwner // ------------------------------ function setXOracle(address _xOracle) external onlyOwner { require(_xOracle != address(0), "address invalid"); xOracle = _xOracle; emit SetXOracle(_xOracle); } // ------------------------------ // view function // ------------------------------ function getLastPrice() external view returns (uint256, uint256, uint256, uint256) { PriceData memory priceData = pricesData[latestRound]; return ( latestRound, priceData.price, priceData.latestPrice, priceData.timestamp ); } function getPrice(uint256 _roundId) external view returns (uint256, uint256, uint256, uint256) { PriceData memory priceData = pricesData[_roundId]; return ( _roundId, priceData.price, priceData.latestPrice, priceData.timestamp ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) 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() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 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; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_xOracle","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"uint256","name":"_tokenIndex","type":"uint256"},{"internalType":"uint256","name":"_decimals","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"xOracle","type":"address"}],"name":"SetXOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"latestPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"UpdatePrice","type":"event"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLastPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_roundId","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pricesData","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"latestPrice","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_xOracle","type":"address"}],"name":"setXOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162000b2938038062000b2983398101604081905262000034916200012e565b6200003f33620000c8565b6001600160a01b0384166200008c5760405162461bcd60e51b815260206004820152600f60248201526e1859191c995cdcc81a5b9d985b1a59608a1b604482015260640160405180910390fd5b600180546001600160a01b0319166001600160a01b0386161790556002620000b58482620002c3565b50600391909155600455506200038f9050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156200014557600080fd5b84516001600160a01b03811681146200015d57600080fd5b602086810151919550906001600160401b03808211156200017d57600080fd5b818801915088601f8301126200019257600080fd5b815181811115620001a757620001a762000118565b604051601f8201601f19908116603f01168101908382118183101715620001d257620001d262000118565b816040528281528b86848701011115620001eb57600080fd5b600093505b828410156200020f5784840186015181850187015292850192620001f0565b6000928101909501919091525050506040860151606090960151949790965092505050565b600181811c908216806200024957607f821691505b6020821081036200026a57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002be57600081815260208120601f850160051c81016020861015620002995750805b601f850160051c820191505b81811015620002ba57828155600101620002a5565b5050505b505050565b81516001600160401b03811115620002df57620002df62000118565b620002f781620002f0845462000234565b8462000270565b602080601f8311600181146200032f5760008415620003165750858301515b600019600386901b1c1916600185901b178555620002ba565b600085815260208120601f198616915b8281101562000360578886015182559484019460019091019084016200033f565b50858210156200037f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61078a806200039f6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063d55f92731161008c578063e757223011610066578063e757223014610225578063eb4344d71461026f578063f2fde38b14610282578063f7d975771461029557600080fd5b8063d55f9273146101af578063d8cf24fd146101b8578063e2d31d9a1461021257600080fd5b8063668a0f02116100c8578063668a0f021461016e578063715018a6146101775780638205bf6a146101815780638da5cb5b1461018a57600080fd5b806306fdde03146100ef57806322fe60b81461010d578063313ce56714610157575b600080fd5b6100f76102a8565b604051610104919061063a565b60405180910390f35b61013c61011b366004610688565b60056020526000908152604090208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610104565b61016060045481565b604051908152602001610104565b61016060065481565b61017f610336565b005b61016060075481565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610104565b61016060035481565b6006546000818152600560209081526040918290208251606081018452815480825260018301549382018490526002909201549301839052915b604080519485526020850193909352918301526060820152608001610104565b600154610197906001600160a01b031681565b6101f2610233366004610688565b60008181526005602090815260409182902082516060810184528154808252600183015493820184905260029092015493018390529293909190565b61017f61027d3660046106a1565b61034a565b61017f6102903660046106a1565b6103f3565b61017f6102a33660046106d1565b61046c565b600280546102b5906106f3565b80601f01602080910402602001604051908101604052809291908181526020018280546102e1906106f3565b801561032e5780601f106103035761010080835404028352916020019161032e565b820191906000526020600020905b81548152906001019060200180831161031157829003601f168201915b505050505081565b61033e610590565b61034860006105ea565b565b610352610590565b6001600160a01b03811661039f5760405162461bcd60e51b815260206004820152600f60248201526e1859191c995cdcc81a5b9d985b1a59608a1b60448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f6c48a60c0375177ff24c8b5b13defd76b82697ba4eb0c0f265d175ca63a64dba9060200160405180910390a150565b6103fb610590565b6001600160a01b0381166104605760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610396565b610469816105ea565b50565b6001546001600160a01b031633146104bb5760405162461bcd60e51b81526020600482015260126024820152713c27b930b1b6329d103337b93134b23232b760711b6044820152606401610396565b60006007548211156104d357506007819055816104ea565b506006546000908152600560205260409020600101545b600680549060006104fa8361072d565b909155505060408051606080820183528582526020808301858152428486018181526006805460009081526005865288902096518755925160018701555160029095019490945560035490548551908152918201889052938101859052908101919091527fd37605941cf2403b0eed3b571758fd57ec7a4c6829d707fac05db895c662b8ee9060800160405180910390a2505050565b6000546001600160a01b031633146103485760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610396565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208083528351808285015260005b818110156106675785810183015185820160400152820161064b565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561069a57600080fd5b5035919050565b6000602082840312156106b357600080fd5b81356001600160a01b03811681146106ca57600080fd5b9392505050565b600080604083850312156106e457600080fd5b50508035926020909101359150565b600181811c9082168061070757607f821691505b60208210810361072757634e487b7160e01b600052602260045260246000fd5b50919050565b60006001820161074d57634e487b7160e01b600052601160045260246000fd5b506001019056fea26469706673582212208651c9f3005d735efc066411a8a41f9aa95e6a5dbdf12a1bb5e34c12dd5a1d9764736f6c63430008130033000000000000000000000000b376d2fe17cafc7fe841e16b897fe658f1e8de7d00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000124254432f55534420507269636520466565640000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063d55f92731161008c578063e757223011610066578063e757223014610225578063eb4344d71461026f578063f2fde38b14610282578063f7d975771461029557600080fd5b8063d55f9273146101af578063d8cf24fd146101b8578063e2d31d9a1461021257600080fd5b8063668a0f02116100c8578063668a0f021461016e578063715018a6146101775780638205bf6a146101815780638da5cb5b1461018a57600080fd5b806306fdde03146100ef57806322fe60b81461010d578063313ce56714610157575b600080fd5b6100f76102a8565b604051610104919061063a565b60405180910390f35b61013c61011b366004610688565b60056020526000908152604090208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610104565b61016060045481565b604051908152602001610104565b61016060065481565b61017f610336565b005b61016060075481565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610104565b61016060035481565b6006546000818152600560209081526040918290208251606081018452815480825260018301549382018490526002909201549301839052915b604080519485526020850193909352918301526060820152608001610104565b600154610197906001600160a01b031681565b6101f2610233366004610688565b60008181526005602090815260409182902082516060810184528154808252600183015493820184905260029092015493018390529293909190565b61017f61027d3660046106a1565b61034a565b61017f6102903660046106a1565b6103f3565b61017f6102a33660046106d1565b61046c565b600280546102b5906106f3565b80601f01602080910402602001604051908101604052809291908181526020018280546102e1906106f3565b801561032e5780601f106103035761010080835404028352916020019161032e565b820191906000526020600020905b81548152906001019060200180831161031157829003601f168201915b505050505081565b61033e610590565b61034860006105ea565b565b610352610590565b6001600160a01b03811661039f5760405162461bcd60e51b815260206004820152600f60248201526e1859191c995cdcc81a5b9d985b1a59608a1b60448201526064015b60405180910390fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f6c48a60c0375177ff24c8b5b13defd76b82697ba4eb0c0f265d175ca63a64dba9060200160405180910390a150565b6103fb610590565b6001600160a01b0381166104605760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610396565b610469816105ea565b50565b6001546001600160a01b031633146104bb5760405162461bcd60e51b81526020600482015260126024820152713c27b930b1b6329d103337b93134b23232b760711b6044820152606401610396565b60006007548211156104d357506007819055816104ea565b506006546000908152600560205260409020600101545b600680549060006104fa8361072d565b909155505060408051606080820183528582526020808301858152428486018181526006805460009081526005865288902096518755925160018701555160029095019490945560035490548551908152918201889052938101859052908101919091527fd37605941cf2403b0eed3b571758fd57ec7a4c6829d707fac05db895c662b8ee9060800160405180910390a2505050565b6000546001600160a01b031633146103485760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610396565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208083528351808285015260005b818110156106675785810183015185820160400152820161064b565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561069a57600080fd5b5035919050565b6000602082840312156106b357600080fd5b81356001600160a01b03811681146106ca57600080fd5b9392505050565b600080604083850312156106e457600080fd5b50508035926020909101359150565b600181811c9082168061070757607f821691505b60208210810361072757634e487b7160e01b600052602260045260246000fd5b50919050565b60006001820161074d57634e487b7160e01b600052601160045260246000fd5b506001019056fea26469706673582212208651c9f3005d735efc066411a8a41f9aa95e6a5dbdf12a1bb5e34c12dd5a1d9764736f6c63430008130033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.