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
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 15049430 | 797 days ago | IN | 0 ETH | 0.08308975 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x1bFC8D3D...0993A1B25 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
NFTOracle
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {INFTOracle} from "../interfaces/INFTOracle.sol"; import {BlockContext} from "../utils/BlockContext.sol"; contract NFTOracle is INFTOracle, Initializable, OwnableUpgradeable, BlockContext { modifier onlyAdmin() { require(_msgSender() == priceFeedAdmin, "NFTOracle: !admin"); _; } event AssetAdded(address indexed asset); event AssetRemoved(address indexed asset); event FeedAdminUpdated(address indexed admin); event SetAssetData(address indexed asset, uint256 price, uint256 timestamp, uint256 roundId); event SetAssetTwapPrice(address indexed asset, uint256 price, uint256 timestamp); struct NFTPriceData { uint256 roundId; uint256 price; uint256 timestamp; } struct NFTPriceFeed { bool registered; NFTPriceData[] nftPriceData; } address public priceFeedAdmin; // key is nft contract address mapping(address => NFTPriceFeed) public nftPriceFeedMap; address[] public nftPriceFeedKeys; // data validity check parameters uint256 private constant DECIMAL_PRECISION = 10**18; // Maximum deviation allowed between two consecutive oracle prices. 18-digit precision. uint256 public maxPriceDeviation; // 20%,18-digit precision. // The maximum allowed deviation between two consecutive oracle prices within a certain time frame. 18-bit precision. uint256 public maxPriceDeviationWithTime; // 10% uint256 public timeIntervalWithPrice; // 30 minutes uint256 public minUpdateTime; // 10 minutes mapping(address => bool) public nftPaused; modifier whenNotPaused(address _nftContract) { _whenNotPaused(_nftContract); _; } uint256 public twapInterval; mapping(address => uint256) public twapPriceMap; function _whenNotPaused(address _nftContract) internal view { bool _paused = nftPaused[_nftContract]; require(!_paused, "NFTOracle: nft price feed paused"); } function initialize( address _admin, uint256 _maxPriceDeviation, uint256 _maxPriceDeviationWithTime, uint256 _timeIntervalWithPrice, uint256 _minUpdateTime, uint256 _twapInterval ) public initializer { __Ownable_init(); priceFeedAdmin = _admin; maxPriceDeviation = _maxPriceDeviation; maxPriceDeviationWithTime = _maxPriceDeviationWithTime; timeIntervalWithPrice = _timeIntervalWithPrice; minUpdateTime = _minUpdateTime; twapInterval = _twapInterval; } function setPriceFeedAdmin(address _admin) external onlyOwner { priceFeedAdmin = _admin; emit FeedAdminUpdated(_admin); } function setAssets(address[] calldata _nftContracts) external onlyOwner { for (uint256 i = 0; i < _nftContracts.length; i++) { _addAsset(_nftContracts[i]); } } function addAsset(address _nftContract) external onlyOwner { _addAsset(_nftContract); } function _addAsset(address _nftContract) internal { requireKeyExisted(_nftContract, false); nftPriceFeedMap[_nftContract].registered = true; nftPriceFeedKeys.push(_nftContract); emit AssetAdded(_nftContract); } function removeAsset(address _nftContract) external onlyOwner { requireKeyExisted(_nftContract, true); delete nftPriceFeedMap[_nftContract]; uint256 length = nftPriceFeedKeys.length; for (uint256 i = 0; i < length; i++) { if (nftPriceFeedKeys[i] == _nftContract) { nftPriceFeedKeys[i] = nftPriceFeedKeys[length - 1]; nftPriceFeedKeys.pop(); break; } } emit AssetRemoved(_nftContract); } function setAssetData(address _nftContract, uint256 _price) external override onlyAdmin whenNotPaused(_nftContract) { uint256 _timestamp = _blockTimestamp(); _setAssetData(_nftContract, _price, _timestamp); } function setMultipleAssetsData(address[] calldata _nftContracts, uint256[] calldata _prices) external override onlyAdmin { require(_nftContracts.length == _prices.length, "NFTOracle: data length not match"); uint256 _timestamp = _blockTimestamp(); for (uint256 i = 0; i < _nftContracts.length; i++) { bool _paused = nftPaused[_nftContracts[i]]; if (!_paused) { _setAssetData(_nftContracts[i], _prices[i], _timestamp); } } } function _setAssetData( address _nftContract, uint256 _price, uint256 _timestamp ) internal { requireKeyExisted(_nftContract, true); require(_timestamp > getLatestTimestamp(_nftContract), "NFTOracle: incorrect timestamp"); require(_price > 0, "NFTOracle: price can not be 0"); bool dataValidity = checkValidityOfPrice(_nftContract, _price, _timestamp); require(dataValidity, "NFTOracle: invalid price data"); uint256 len = getPriceFeedLength(_nftContract); NFTPriceData memory data = NFTPriceData({price: _price, timestamp: _timestamp, roundId: len}); nftPriceFeedMap[_nftContract].nftPriceData.push(data); uint256 twapPrice = calculateTwapPrice(_nftContract); twapPriceMap[_nftContract] = twapPrice; emit SetAssetData(_nftContract, _price, _timestamp, len); emit SetAssetTwapPrice(_nftContract, twapPrice, _timestamp); } function getAssetPrice(address _nftContract) external view override returns (uint256) { require(isExistedKey(_nftContract), "NFTOracle: key not existed"); uint256 len = getPriceFeedLength(_nftContract); require(len > 0, "NFTOracle: no price data"); uint256 twapPrice = twapPriceMap[_nftContract]; if (twapPrice == 0) { return nftPriceFeedMap[_nftContract].nftPriceData[len - 1].price; } else { return twapPrice; } } function getLatestTimestamp(address _nftContract) public view override returns (uint256) { require(isExistedKey(_nftContract), "NFTOracle: key not existed"); uint256 len = getPriceFeedLength(_nftContract); if (len == 0) { return 0; } return nftPriceFeedMap[_nftContract].nftPriceData[len - 1].timestamp; } function calculateTwapPrice(address _nftContract) public view returns (uint256) { require(isExistedKey(_nftContract), "NFTOracle: key not existed"); require(twapInterval != 0, "NFTOracle: interval can't be 0"); uint256 len = getPriceFeedLength(_nftContract); require(len > 0, "NFTOracle: Not enough history"); uint256 round = len - 1; NFTPriceData memory priceRecord = nftPriceFeedMap[_nftContract].nftPriceData[round]; uint256 latestTimestamp = priceRecord.timestamp; uint256 baseTimestamp = _blockTimestamp() - twapInterval; // if latest updated timestamp is earlier than target timestamp, return the latest price. if (latestTimestamp < baseTimestamp || round == 0) { return priceRecord.price; } // rounds are like snapshots, latestRound means the latest price snapshot. follow chainlink naming uint256 cumulativeTime = _blockTimestamp() - latestTimestamp; uint256 previousTimestamp = latestTimestamp; uint256 weightedPrice = priceRecord.price * cumulativeTime; while (true) { if (round == 0) { // if cumulative time is less than requested interval, return current twap price return weightedPrice / cumulativeTime; } round = round - 1; // get current round timestamp and price priceRecord = nftPriceFeedMap[_nftContract].nftPriceData[round]; uint256 currentTimestamp = priceRecord.timestamp; uint256 price = priceRecord.price; // check if current round timestamp is earlier than target timestamp if (currentTimestamp <= baseTimestamp) { // weighted time period will be (target timestamp - previous timestamp). For example, // now is 1000, twapInterval is 100, then target timestamp is 900. If timestamp of current round is 970, // and timestamp of NEXT round is 880, then the weighted time period will be (970 - 900) = 70, // instead of (970 - 880) weightedPrice = weightedPrice + (price * (previousTimestamp - baseTimestamp)); break; } uint256 timeFraction = previousTimestamp - currentTimestamp; weightedPrice = weightedPrice + price * timeFraction; cumulativeTime = cumulativeTime + timeFraction; previousTimestamp = currentTimestamp; } return weightedPrice / twapInterval; } function getPreviousPrice(address _nftContract, uint256 _numOfRoundBack) public view override returns (uint256) { require(isExistedKey(_nftContract), "NFTOracle: key not existed"); uint256 len = getPriceFeedLength(_nftContract); require(len > 0 && _numOfRoundBack < len, "NFTOracle: Not enough history"); return nftPriceFeedMap[_nftContract].nftPriceData[len - _numOfRoundBack - 1].price; } function getPreviousTimestamp(address _nftContract, uint256 _numOfRoundBack) public view override returns (uint256) { require(isExistedKey(_nftContract), "NFTOracle: key not existed"); uint256 len = getPriceFeedLength(_nftContract); require(len > 0 && _numOfRoundBack < len, "NFTOracle: Not enough history"); return nftPriceFeedMap[_nftContract].nftPriceData[len - _numOfRoundBack - 1].timestamp; } function getPriceFeedLength(address _nftContract) public view returns (uint256 length) { return nftPriceFeedMap[_nftContract].nftPriceData.length; } function getLatestRoundId(address _nftContract) public view returns (uint256) { uint256 len = getPriceFeedLength(_nftContract); if (len == 0) { return 0; } return nftPriceFeedMap[_nftContract].nftPriceData[len - 1].roundId; } function isExistedKey(address _nftContract) private view returns (bool) { return nftPriceFeedMap[_nftContract].registered; } function requireKeyExisted(address _key, bool _existed) private view { if (_existed) { require(isExistedKey(_key), "NFTOracle: key not existed"); } else { require(!isExistedKey(_key), "NFTOracle: key existed"); } } function checkValidityOfPrice( address _nftContract, uint256 _price, uint256 _timestamp ) private view returns (bool) { uint256 len = getPriceFeedLength(_nftContract); if (len > 0) { uint256 price = nftPriceFeedMap[_nftContract].nftPriceData[len - 1].price; if (_price == price) { return true; } uint256 timestamp = nftPriceFeedMap[_nftContract].nftPriceData[len - 1].timestamp; uint256 percentDeviation; if (_price > price) { percentDeviation = ((_price - price) * DECIMAL_PRECISION) / price; } else { percentDeviation = ((price - _price) * DECIMAL_PRECISION) / price; } uint256 timeDeviation = _timestamp - timestamp; if (percentDeviation > maxPriceDeviation) { return false; } else if (timeDeviation < minUpdateTime) { return false; } else if ((percentDeviation > maxPriceDeviationWithTime) && (timeDeviation < timeIntervalWithPrice)) { return false; } } return true; } function setDataValidityParameters( uint256 _maxPriceDeviation, uint256 _maxPriceDeviationWithTime, uint256 _timeIntervalWithPrice, uint256 _minUpdateTime ) external onlyOwner { maxPriceDeviation = _maxPriceDeviation; maxPriceDeviationWithTime = _maxPriceDeviationWithTime; timeIntervalWithPrice = _timeIntervalWithPrice; minUpdateTime = _minUpdateTime; } function setPause(address _nftContract, bool val) external override onlyOwner { nftPaused[_nftContract] = val; } function setTwapInterval(uint256 _twapInterval) external override onlyOwner { twapInterval = _twapInterval; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Context_init_unchained(); __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_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 { _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); } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; /************ @title INFTOracle interface @notice Interface for NFT price oracle.*/ interface INFTOracle { /* CAUTION: Price uint is ETH based (WEI, 18 decimals) */ // get asset price function getAssetPrice(address _nftContract) external view returns (uint256); // get latest timestamp function getLatestTimestamp(address _nftContract) external view returns (uint256); // get previous price with _back rounds function getPreviousPrice(address _nftContract, uint256 _numOfRoundBack) external view returns (uint256); // get previous timestamp with _back rounds function getPreviousTimestamp(address _nftContract, uint256 _numOfRoundBack) external view returns (uint256); function setAssetData(address _nftContract, uint256 _price) external; function setMultipleAssetsData(address[] calldata _nftContracts, uint256[] calldata _prices) external; function setPause(address _nftContract, bool val) external; function setTwapInterval(uint256 _twapInterval) external; }
// SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.4; // wrap block.xxx functions for testing // only support timestamp and number so far abstract contract BlockContext { //◥◤◥◤◥◤◥◤◥◤◥◤◥◤◥◤ add state variables below ◥◤◥◤◥◤◥◤◥◤◥◤◥◤◥◤// //◢◣◢◣◢◣◢◣◢◣◢◣◢◣◢◣ add state variables above ◢◣◢◣◢◣◢◣◢◣◢◣◢◣◢◣// uint256[50] private __gap; function _blockTimestamp() internal view virtual returns (uint256) { return block.timestamp; } function _blockNumber() internal view virtual returns (uint256) { return block.number; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { __Context_init_unchained(); } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "istanbul", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"AssetAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"AssetRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"}],"name":"FeedAdminUpdated","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"SetAssetData","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"SetAssetTwapPrice","type":"event"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"}],"name":"addAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"}],"name":"calculateTwapPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"}],"name":"getAssetPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"}],"name":"getLatestRoundId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"}],"name":"getLatestTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"},{"internalType":"uint256","name":"_numOfRoundBack","type":"uint256"}],"name":"getPreviousPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"},{"internalType":"uint256","name":"_numOfRoundBack","type":"uint256"}],"name":"getPreviousTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"}],"name":"getPriceFeedLength","outputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"uint256","name":"_maxPriceDeviation","type":"uint256"},{"internalType":"uint256","name":"_maxPriceDeviationWithTime","type":"uint256"},{"internalType":"uint256","name":"_timeIntervalWithPrice","type":"uint256"},{"internalType":"uint256","name":"_minUpdateTime","type":"uint256"},{"internalType":"uint256","name":"_twapInterval","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxPriceDeviation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPriceDeviationWithTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nftPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nftPriceFeedKeys","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nftPriceFeedMap","outputs":[{"internalType":"bool","name":"registered","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeedAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"}],"name":"removeAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setAssetData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_nftContracts","type":"address[]"}],"name":"setAssets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPriceDeviation","type":"uint256"},{"internalType":"uint256","name":"_maxPriceDeviationWithTime","type":"uint256"},{"internalType":"uint256","name":"_timeIntervalWithPrice","type":"uint256"},{"internalType":"uint256","name":"_minUpdateTime","type":"uint256"}],"name":"setDataValidityParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_nftContracts","type":"address[]"},{"internalType":"uint256[]","name":"_prices","type":"uint256[]"}],"name":"setMultipleAssetsData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftContract","type":"address"},{"internalType":"bool","name":"val","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"setPriceFeedAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_twapInterval","type":"uint256"}],"name":"setTwapInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"timeIntervalWithPrice","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":"twapInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"twapPriceMap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c806383c2d72e11610104578063c22dc722116100a2578063ef1d95b111610071578063ef1d95b1146103f8578063f2fde38b1461040b578063fcd766dc1461041e578063fda0c5981461043157600080fd5b8063c22dc722146103ac578063d84f885a146103bf578063de217625146103d2578063e889e5d6146103e557600080fd5b8063985a6de6116100de578063985a6de61461035a57806398f5ec8914610363578063abad1bb314610376578063b3596f071461039957600080fd5b806383c2d72e146103155780638da5cb5b14610340578063975b86621461035157600080fd5b80635e075d701161017c57806369bede4e1161014b57806369bede4e146102be57806369da148d146102f1578063715018a6146102fa57806379c289b11461030257600080fd5b80635e075d70146102725780635ea679ef146102855780635f0ca42a14610298578063650999af146102ab57600080fd5b80633c1d5df0116101b85780633c1d5df01461023057806341a6990f1461023957806345ff4c801461024c5780634a5e42b11461025f57600080fd5b80630e9f781d146101df578063143671ef146101fb578063298410e51461021b575b600080fd5b6101e8609c5481565b6040519081526020015b60405180910390f35b6101e86102093660046119a0565b60a06020526000908152604090205481565b61022e6102293660046119a0565b610444565b005b6101e8609f5481565b6101e86102473660046119a0565b610483565b61022e61025a366004611a1d565b610525565b61022e61026d3660046119a0565b610620565b61022e610280366004611aa6565b6107fd565b61022e610293366004611b0f565b61098e565b61022e6102a6366004611b27565b6109bd565b61022e6102b93660046119a0565b6109fb565b6102e16102cc3660046119a0565b60986020526000908152604090205460ff1681565b60405190151581526020016101f2565b6101e8609d5481565b61022e610a6f565b61022e6103103660046119f4565b610aa5565b609754610328906001600160a01b031681565b6040516001600160a01b0390911681526020016101f2565b6033546001600160a01b0316610328565b6101e8609a5481565b6101e8609b5481565b6101e86103713660046119a0565b610b18565b6102e16103843660046119a0565b609e6020526000908152604090205460ff1681565b6101e86103a73660046119a0565b610b94565b61022e6103ba3660046119ba565b610c9e565b6101e86103cd3660046119f4565b610cf3565b61022e6103e0366004611a66565b610dbd565b6101e86103f33660046119f4565b610e46565b6101e86104063660046119a0565b610f10565b61022e6104193660046119a0565b610f2e565b61032861042c366004611b0f565b610fc6565b6101e861043f3660046119a0565b610ff0565b6033546001600160a01b031633146104775760405162461bcd60e51b815260040161046e90611b8f565b60405180910390fd5b61048081611298565b50565b600061048e8261132f565b6104aa5760405162461bcd60e51b815260040161046e90611b58565b60006104b583610f10565b9050806104c55750600092915050565b6001600160a01b03831660009081526098602052604090206001908101906104ed9083611c9d565b8154811061050b57634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160020154915050919050565b600054610100900460ff166105405760005460ff1615610544565b303b155b6105a75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161046e565b600054610100900460ff161580156105c9576000805461ffff19166101011790555b6105d161134d565b609780546001600160a01b0319166001600160a01b038916179055609a869055609b859055609c849055609d839055609f8290558015610617576000805461ff00191690555b50505050505050565b6033546001600160a01b0316331461064a5760405162461bcd60e51b815260040161046e90611b8f565b610655816001611384565b6001600160a01b0381166000908152609860205260408120805460ff191681559061068360018301826118f8565b505060995460005b818110156107c457826001600160a01b0316609982815481106106be57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156107b25760996106e6600184611c9d565b8154811061070457634e487b7160e01b600052603260045260246000fd5b600091825260209091200154609980546001600160a01b03909216918390811061073e57634e487b7160e01b600052603260045260246000fd5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550609980548061078b57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190556107c4565b806107bc81611cb4565b91505061068b565b506040516001600160a01b038316907f37803e2125c48ee96c38ddf04e826daf335b0e1603579040fd275aba6d06b6fc90600090a25050565b6097546001600160a01b0316336001600160a01b0316146108545760405162461bcd60e51b815260206004820152601160248201527027232a27b930b1b6329d1010b0b236b4b760791b604482015260640161046e565b8281146108a35760405162461bcd60e51b815260206004820181905260248201527f4e46544f7261636c653a2064617461206c656e677468206e6f74206d61746368604482015260640161046e565b4260005b84811015610986576000609e60008888858181106108d557634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108ea91906119a0565b6001600160a01b0316815260208101919091526040016000205460ff169050806109735761097387878481811061093157634e487b7160e01b600052603260045260246000fd5b905060200201602081019061094691906119a0565b86868581811061096657634e487b7160e01b600052603260045260246000fd5b9050602002013585611402565b508061097e81611cb4565b9150506108a7565b505050505050565b6033546001600160a01b031633146109b85760405162461bcd60e51b815260040161046e90611b8f565b609f55565b6033546001600160a01b031633146109e75760405162461bcd60e51b815260040161046e90611b8f565b609a93909355609b91909155609c55609d55565b6033546001600160a01b03163314610a255760405162461bcd60e51b815260040161046e90611b8f565b609780546001600160a01b0319166001600160a01b0383169081179091556040517f97b0055e5a3e9fb6730e963abc01ac48eba73106410fed451e50adf93ca99aff90600090a250565b6033546001600160a01b03163314610a995760405162461bcd60e51b815260040161046e90611b8f565b610aa36000611633565b565b6097546001600160a01b0316336001600160a01b031614610afc5760405162461bcd60e51b815260206004820152601160248201527027232a27b930b1b6329d1010b0b236b4b760791b604482015260640161046e565b81610b0681611685565b42610b12848483611402565b50505050565b600080610b2483610f10565b905080610b345750600092915050565b6001600160a01b0383166000908152609860205260409020600190810190610b5c9083611c9d565b81548110610b7a57634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160000154915050919050565b6000610b9f8261132f565b610bbb5760405162461bcd60e51b815260040161046e90611b58565b6000610bc683610f10565b905060008111610c185760405162461bcd60e51b815260206004820152601860248201527f4e46544f7261636c653a206e6f20707269636520646174610000000000000000604482015260640161046e565b6001600160a01b038316600090815260a0602052604090205480610c97576001600160a01b0384166000908152609860205260409020600190810190610c5e9084611c9d565b81548110610c7c57634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016001015492505050919050565b9392505050565b6033546001600160a01b03163314610cc85760405162461bcd60e51b815260040161046e90611b8f565b6001600160a01b03919091166000908152609e60205260409020805460ff1916911515919091179055565b6000610cfe8361132f565b610d1a5760405162461bcd60e51b815260040161046e90611b58565b6000610d2584610f10565b9050600081118015610d3657508083105b610d525760405162461bcd60e51b815260040161046e90611c0f565b6001600160a01b0384166000908152609860205260409020600190810190610d7a8584611c9d565b610d849190611c9d565b81548110610da257634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016002015491505092915050565b6033546001600160a01b03163314610de75760405162461bcd60e51b815260040161046e90611b8f565b60005b81811015610e4157610e2f838383818110610e1557634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610e2a91906119a0565b611298565b80610e3981611cb4565b915050610dea565b505050565b6000610e518361132f565b610e6d5760405162461bcd60e51b815260040161046e90611b58565b6000610e7884610f10565b9050600081118015610e8957508083105b610ea55760405162461bcd60e51b815260040161046e90611c0f565b6001600160a01b0384166000908152609860205260409020600190810190610ecd8584611c9d565b610ed79190611c9d565b81548110610ef557634e487b7160e01b600052603260045260246000fd5b90600052602060002090600302016001015491505092915050565b6001600160a01b031660009081526098602052604090206001015490565b6033546001600160a01b03163314610f585760405162461bcd60e51b815260040161046e90611b8f565b6001600160a01b038116610fbd5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161046e565b61048081611633565b60998181548110610fd657600080fd5b6000918252602090912001546001600160a01b0316905081565b6000610ffb8261132f565b6110175760405162461bcd60e51b815260040161046e90611b58565b609f546110665760405162461bcd60e51b815260206004820152601e60248201527f4e46544f7261636c653a20696e74657276616c2063616e277420626520300000604482015260640161046e565b600061107183610f10565b9050600081116110935760405162461bcd60e51b815260040161046e90611c0f565b60006110a0600183611c9d565b6001600160a01b038516600090815260986020526040812060010180549293509091839081106110e057634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505090506000816040015190506000609f5461112e4290565b6111389190611c9d565b905080821080611146575083155b1561115957505060200151949350505050565b60006111658342611c9d565b90506000839050600082866020015161117e9190611c7e565b90505b8661119e576111908382611c5e565b9a9950505050505050505050565b6111a9600188611c9d565b6001600160a01b038b166000908152609860205260409020600101805491985090889081106111e857634e487b7160e01b600052603260045260246000fd5b60009182526020918290206040805160608101825260039093029091018054835260018101549383018490526002015490820181905290975090858211611250576112338685611c9d565b61123d9082611c7e565b6112479084611c46565b9250505061128b565b600061125c8386611c9d565b90506112688183611c7e565b6112729085611c46565b935061127e8187611c46565b9550829450505050611181565b609f546111909082611c5e565b6112a3816000611384565b6001600160a01b038116600081815260986020526040808220805460ff1916600190811790915560998054918201815583527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000180546001600160a01b03191684179055517f0e3c58ebfb2e7465fbb1c32e6b4f40c3c4f5ca77e8218a386aff8617831260d79190a250565b6001600160a01b031660009081526098602052604090205460ff1690565b600054610100900460ff166113745760405162461bcd60e51b815260040161046e90611bc4565b61137c6116ef565b610aa3611716565b80156113b3576113938261132f565b6113af5760405162461bcd60e51b815260040161046e90611b58565b5050565b6113bc8261132f565b156113af5760405162461bcd60e51b815260206004820152601660248201527513919513dc9858db194e881ad95e48195e1a5cdd195960521b604482015260640161046e565b61140d836001611384565b61141683610483565b81116114645760405162461bcd60e51b815260206004820152601e60248201527f4e46544f7261636c653a20696e636f72726563742074696d657374616d700000604482015260640161046e565b600082116114b45760405162461bcd60e51b815260206004820152601d60248201527f4e46544f7261636c653a2070726963652063616e206e6f742062652030000000604482015260640161046e565b60006114c1848484611746565b9050806115105760405162461bcd60e51b815260206004820152601d60248201527f4e46544f7261636c653a20696e76616c69642070726963652064617461000000604482015260640161046e565b600061151b85610f10565b6040805160608101825282815260208082018881528284018881526001600160a01b038b1660009081526098845294852060019081018054808301825590875293862085516003909502019384559151918301919091555160029091015591925061158587610ff0565b6001600160a01b038816600081815260a0602090815260409182902084905581518a8152908101899052908101869052919250907ff4eceee965aa1e12d9ec8cec7f3d2845177696804d933fd53613426d6b937d039060600160405180910390a260408051828152602081018790526001600160a01b038916917f58bdf68b6e757afad014720959e6c9ecd94de1cc24b964ebf48b08b50366b321910160405180910390a250505050505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0381166000908152609e602052604090205460ff1680156113af5760405162461bcd60e51b815260206004820181905260248201527f4e46544f7261636c653a206e6674207072696365206665656420706175736564604482015260640161046e565b600054610100900460ff16610aa35760405162461bcd60e51b815260040161046e90611bc4565b600054610100900460ff1661173d5760405162461bcd60e51b815260040161046e90611bc4565b610aa333611633565b60008061175285610f10565b905080156118ed576001600160a01b03851660009081526098602052604081206001908101906117829084611c9d565b815481106117a057634e487b7160e01b600052603260045260246000fd5b9060005260206000209060030201600101549050808514156117c757600192505050610c97565b6001600160a01b03861660009081526098602052604081206001908101906117ef9085611c9d565b8154811061180d57634e487b7160e01b600052603260045260246000fd5b906000526020600020906003020160020154905060008287111561185a5782670de0b6b3a764000061183f828a611c9d565b6118499190611c7e565b6118539190611c5e565b9050611885565b82670de0b6b3a764000061186e8983611c9d565b6118789190611c7e565b6118829190611c5e565b90505b60006118918388611c9d565b9050609a548211156118ab57600095505050505050610c97565b609d548110156118c357600095505050505050610c97565b609b54821180156118d55750609c5481105b156118e857600095505050505050610c97565b505050505b506001949350505050565b508054600082556003029060005260206000209081019061048091905b80821115611936576000808255600182018190556002820155600301611915565b5090565b80356001600160a01b038116811461195157600080fd5b919050565b60008083601f840112611967578182fd5b50813567ffffffffffffffff81111561197e578182fd5b6020830191508360208260051b850101111561199957600080fd5b9250929050565b6000602082840312156119b1578081fd5b610c978261193a565b600080604083850312156119cc578081fd5b6119d58361193a565b9150602083013580151581146119e9578182fd5b809150509250929050565b60008060408385031215611a06578182fd5b611a0f8361193a565b946020939093013593505050565b60008060008060008060c08789031215611a35578182fd5b611a3e8761193a565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b60008060208385031215611a78578182fd5b823567ffffffffffffffff811115611a8e578283fd5b611a9a85828601611956565b90969095509350505050565b60008060008060408587031215611abb578384fd5b843567ffffffffffffffff80821115611ad2578586fd5b611ade88838901611956565b90965094506020870135915080821115611af6578384fd5b50611b0387828801611956565b95989497509550505050565b600060208284031215611b20578081fd5b5035919050565b60008060008060808587031215611b3c578384fd5b5050823594602084013594506040840135936060013592509050565b6020808252601a908201527f4e46544f7261636c653a206b6579206e6f742065786973746564000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601d908201527f4e46544f7261636c653a204e6f7420656e6f75676820686973746f7279000000604082015260600190565b60008219821115611c5957611c59611ccf565b500190565b600082611c7957634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611c9857611c98611ccf565b500290565b600082821015611caf57611caf611ccf565b500390565b6000600019821415611cc857611cc8611ccf565b5060010190565b634e487b7160e01b600052601160045260246000fdfea26469706673582212208895700403dff56607f10679d9150737ec22ac19439ace8c493266471efe6a8964736f6c63430008040033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.