Overview
S Balance
0 S
S Value
-More Info
Private Name Tags
ContractCreator
Latest 7 from a total of 7 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set Gov | 670908 | 14 days ago | IN | 0 S | 0.00002973 | ||||
Set Secondary Pr... | 665315 | 14 days ago | IN | 0 S | 0.00005074 | ||||
Set Max Strict P... | 664488 | 14 days ago | IN | 0 S | 0.00002851 | ||||
Set Spread Basis... | 664486 | 14 days ago | IN | 0 S | 0.00002913 | ||||
Set Token Config | 664484 | 14 days ago | IN | 0 S | 0.00007874 | ||||
Set Token Config | 664478 | 14 days ago | IN | 0 S | 0.00007872 | ||||
Set Pyth Network | 664474 | 14 days ago | IN | 0 S | 0.00005075 |
Loading...
Loading
Contract Name:
VaultPriceFeed
Compiler Version
v0.8.20+commit.a1b79de6
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT import "./interfaces/IVaultPriceFeed.sol"; import "../oracle/interfaces/ISecondaryPriceFeed.sol"; import "@pythnetwork/pyth-sdk-solidity/IPyth.sol"; import "../access/Governable.sol"; pragma solidity ^0.8.0; contract VaultPriceFeed is IVaultPriceFeed, Governable { uint256 public constant PRICE_PRECISION = 10 ** 30; uint256 public constant ONE_USD = PRICE_PRECISION; uint256 public constant BASIS_POINTS_DIVISOR = 10000; uint256 public constant MAX_SPREAD_BASIS_POINTS = 50; uint256 public constant MAX_ADJUSTMENT_INTERVAL = 2 hours; uint256 public constant MAX_ADJUSTMENT_BASIS_POINTS = 20; bool public isSecondaryPriceEnabled = true; bool public favorPrimaryPrice = false; uint256 public maxStrictPriceDeviation = 10000000000000000000000000000; address public secondaryPriceFeed; uint256 public spreadThresholdBasisPoints = 30; address public pythNetwork; mapping(address => uint256) public spreadBasisPoints; mapping(address => bytes32) public priceFeeds; mapping(address => uint256) public allowedStaleness; // Pyth can return prices for stablecoins // that differs from 1 USD by a larger percentage than stableSwapFeeBasisPoints // we use strictStableTokens to cap the price to 1 USD // this allows us to configure stablecoins like DAI as being a stableToken // while not being a strictStableToken mapping(address => bool) public strictStableTokens; mapping(address => uint256) public override adjustmentBasisPoints; mapping(address => bool) public override isAdjustmentAdditive; mapping(address => uint256) public lastAdjustmentTimings; constructor() public { } function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external override onlyGov { require( lastAdjustmentTimings[_token] + MAX_ADJUSTMENT_INTERVAL < block.timestamp, "VaultPriceFeed: adjustment frequency exceeded" ); require(_adjustmentBps <= MAX_ADJUSTMENT_BASIS_POINTS, "invalid _adjustmentBps"); isAdjustmentAdditive[_token] = _isAdditive; adjustmentBasisPoints[_token] = _adjustmentBps; lastAdjustmentTimings[_token] = block.timestamp; } function setPythNetwork(address _pythNetwork) external onlyGov { pythNetwork = _pythNetwork; } function setIsSecondaryPriceEnabled(bool _isEnabled) external override onlyGov { isSecondaryPriceEnabled = _isEnabled; } function setSecondaryPriceFeed(address _secondaryPriceFeed) external override onlyGov { secondaryPriceFeed = _secondaryPriceFeed; } function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external override onlyGov { require(_spreadBasisPoints <= MAX_SPREAD_BASIS_POINTS, "VaultPriceFeed: invalid _spreadBasisPoints"); spreadBasisPoints[_token] = _spreadBasisPoints; } function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external override onlyGov { spreadThresholdBasisPoints = _spreadThresholdBasisPoints; } function setFavorPrimaryPrice(bool _favorPrimaryPrice) external override onlyGov { favorPrimaryPrice = _favorPrimaryPrice; } function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external override onlyGov { maxStrictPriceDeviation = _maxStrictPriceDeviation; } function setTokenConfig( address _token, bytes32 _priceFeed, uint256 _allowedStaleness, bool _isStrictStable ) external onlyGov { strictStableTokens[_token] = _isStrictStable; priceFeeds[_token] = _priceFeed; allowedStaleness[_token] = _allowedStaleness; } function getPrice(address _token, bool _maximise, bool /*_includeAmmPrice*/, bool /*_useSwapPricing*/) public override view returns (uint256) { uint256 price = getPriceV1(_token, _maximise); uint256 adjustmentBps = adjustmentBasisPoints[_token]; if (adjustmentBps > 0) { bool isAdditive = isAdjustmentAdditive[_token]; if (isAdditive) { price = price * (BASIS_POINTS_DIVISOR + adjustmentBps) / BASIS_POINTS_DIVISOR; } else { price = price * (BASIS_POINTS_DIVISOR - adjustmentBps) / BASIS_POINTS_DIVISOR; } } return price; } function getPriceV1(address _token, bool _maximise) public view returns (uint256) { uint256 price = getPrimaryPrice(_token, _maximise); if (isSecondaryPriceEnabled && !strictStableTokens[_token]) { price = getSecondaryPrice(_token, price, _maximise); } if (strictStableTokens[_token]) { uint256 delta = price > ONE_USD ? price - ONE_USD : ONE_USD - price; if (delta <= maxStrictPriceDeviation) { return ONE_USD; } // if _maximise and price is e.g. 1.02, return 1.02 if (_maximise && price > ONE_USD) { return price; } // if !_maximise and price is e.g. 0.98, return 0.98 if (!_maximise && price < ONE_USD) { return price; } return ONE_USD; } uint256 _spreadBasisPoints = spreadBasisPoints[_token]; if (_maximise) { return price * (BASIS_POINTS_DIVISOR + _spreadBasisPoints) / BASIS_POINTS_DIVISOR; } return price * (BASIS_POINTS_DIVISOR - _spreadBasisPoints) / BASIS_POINTS_DIVISOR; } function getLatestPrimaryPrice(address _token) public override view returns (uint256) { return _getPythPrice(_token, true, false, true); } function getPrimaryPrice(address _token, bool _maximise) public override view returns (uint256) { return _getPythPrice(_token, false, _maximise, true); } function getPythPrice(address _token) external view returns (uint256) { return _getPythPrice(_token, true, true, false); } function _getPythPrice(address _token, bool _ignoreConfidence, bool _maximise, bool _requireFreshness) internal view returns (uint256) { PythStructs.Price memory priceData = _getPythPriceData(_token); if (_requireFreshness && allowedStaleness[_token] > 0) { require(block.timestamp <= priceData.publishTime + allowedStaleness[_token], "VaultPriceFeed: price stale"); } uint256 price; if (_ignoreConfidence) { price = uint256(uint64(priceData.price)); } else { uint256 scaledConf = uint256(uint64(priceData.conf)); price = _maximise ? uint256(uint64(priceData.price)) + scaledConf : uint256(uint64(priceData.price)) - scaledConf; } require(priceData.expo <= 0, "VaultPriceFeed: invalid price exponent"); uint32 priceExponent = uint32(- priceData.expo); return price * PRICE_PRECISION / (10 ** priceExponent); } function _getPythPriceData(address _token) internal view returns (PythStructs.Price memory) { require(address(pythNetwork) != address(0), "VaultPriceFeed: pyth network address is not configured"); bytes32 id = priceFeeds[_token]; require(id != bytes32(0), "VaultPriceFeed: price id not configured for given token"); PythStructs.Price memory priceData = IPyth(pythNetwork).getEmaPriceUnsafe(id); require(priceData.price > 0, "VaultPriceFeed: invalid price"); return priceData; } function getSecondaryPrice(address _token, uint256 _referencePrice, bool _maximise) public view returns (uint256) { if (secondaryPriceFeed == address(0)) {return _referencePrice;} return ISecondaryPriceFeed(secondaryPriceFeed).getPrice(_token, _referencePrice, _maximise); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./PythStructs.sol"; import "./IPythEvents.sol"; /// @title Consume prices from the Pyth Network (https://pyth.network/). /// @dev Please refer to the guidance at https://docs.pyth.network/consumers/best-practices for how to consume prices safely. /// @author Pyth Data Association interface IPyth is IPythEvents { /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time function getValidTimePeriod() external view returns (uint validTimePeriod); /// @notice Returns the price and confidence interval. /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds. /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPrice( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price and confidence interval. /// @dev Reverts if the EMA price is not available. /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPrice( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the price of a price feed without any sanity checks. /// @dev This function returns the most recent price update in this contract without any recency checks. /// This function is unsafe as the returned price update may be arbitrarily far in the past. /// /// Users of this function should check the `publishTime` in the price to ensure that the returned price is /// sufficiently recent for their application. If you are considering using this function, it may be /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPriceUnsafe( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the price that is no older than `age` seconds of the current time. /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently /// recently. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPriceNoOlderThan( bytes32 id, uint age ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks. /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available. /// However, if the price is not recent this function returns the latest available price. /// /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that /// the returned price is recent or useful for any particular application. /// /// Users of this function should check the `publishTime` in the price to ensure that the returned price is /// sufficiently recent for their application. If you are considering using this function, it may be /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPriceUnsafe( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds /// of the current time. /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently /// recently. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPriceNoOlderThan( bytes32 id, uint age ) external view returns (PythStructs.Price memory price); /// @notice Update price feeds with given update messages. /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// Prices will be updated if they are more recent than the current stored prices. /// The call will succeed even if the update is not the most recent. /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid. /// @param updateData Array of price update data. function updatePriceFeeds(bytes[] calldata updateData) external payable; /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`. /// /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas. /// Otherwise, it calls updatePriceFeeds method to update the prices. /// /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]` function updatePriceFeedsIfNecessary( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64[] calldata publishTimes ) external payable; /// @notice Returns the required fee to update an array of price updates. /// @param updateData Array of price update data. /// @return feeAmount The required fee in Wei. function getUpdateFee( bytes[] calldata updateData ) external view returns (uint feeAmount); /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published /// within `minPublishTime` and `maxPublishTime`. /// /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price; /// otherwise, please consider using `updatePriceFeeds`. This method does not store the price updates on-chain. /// /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// /// /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is /// no update for any of the given `priceIds` within the given time range. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`. /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`. /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order). function parsePriceFeedUpdates( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64 minPublishTime, uint64 maxPublishTime ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @title IPythEvents contains the events that Pyth contract emits. /// @dev This interface can be used for listening to the updates for off-chain and testing purposes. interface IPythEvents { /// @dev Emitted when the price feed with `id` has received a fresh update. /// @param id The Pyth Price Feed ID. /// @param publishTime Publish time of the given price update. /// @param price Price of the given price update. /// @param conf Confidence interval of the given price update. event PriceFeedUpdate( bytes32 indexed id, uint64 publishTime, int64 price, uint64 conf ); /// @dev Emitted when a batch price update is processed successfully. /// @param chainId ID of the source chain that the batch price update comes from. /// @param sequenceNumber Sequence number of the batch price update. event BatchPriceFeedUpdate(uint16 chainId, uint64 sequenceNumber); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; contract PythStructs { // A price with a degree of uncertainty, represented as a price +- a confidence interval. // // The confidence interval roughly corresponds to the standard error of a normal distribution. // Both the price and confidence are stored in a fixed-point numeric representation, // `x * (10^expo)`, where `expo` is the exponent. // // Please refer to the documentation at https://docs.pyth.network/consumers/best-practices for how // to how this price safely. struct Price { // Price int64 price; // Confidence interval around the price uint64 conf; // Price exponent int32 expo; // Unix timestamp describing when the price was published uint publishTime; } // PriceFeed represents a current aggregate price from pyth publisher feeds. struct PriceFeed { // The price ID. bytes32 id; // Latest available price Price price; // Latest available exponentially-weighted moving average price Price emaPrice; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; contract Governable { address public gov; constructor() public { gov = msg.sender; } modifier onlyGov() { require(msg.sender == gov, "Governable: forbidden"); _; } function setGov(address _gov) external onlyGov { gov = _gov; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface IVaultPriceFeed { function adjustmentBasisPoints(address _token) external view returns (uint256); function isAdjustmentAdditive(address _token) external view returns (bool); function pythNetwork() external view returns (address); function setAdjustment(address _token, bool _isAdditive, uint256 _adjustmentBps) external; function setIsSecondaryPriceEnabled(bool _isEnabled) external; function setSpreadBasisPoints(address _token, uint256 _spreadBasisPoints) external; function setSpreadThresholdBasisPoints(uint256 _spreadThresholdBasisPoints) external; function setFavorPrimaryPrice(bool _favorPrimaryPrice) external; function setMaxStrictPriceDeviation(uint256 _maxStrictPriceDeviation) external; function getPrice(address _token, bool _maximise, bool _includeAmmPrice, bool _useSwapPricing) external view returns (uint256); function getLatestPrimaryPrice(address _token) external view returns (uint256); function getPrimaryPrice(address _token, bool _maximise) external view returns (uint256); function setPythNetwork(address _pythNetwork) external; function setTokenConfig( address _token, bytes32 _priceFeed, uint256 _allowedStaleness, bool _isStrictStable ) external; function setSecondaryPriceFeed(address _secondaryPriceFeed) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.12; interface ISecondaryPriceFeed { function getPrice(address _token, uint256 _referencePrice, bool _maximise) external view returns (uint256); }
{ "evmVersion": "paris", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 250 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BASIS_POINTS_DIVISOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ADJUSTMENT_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ADJUSTMENT_INTERVAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SPREAD_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONE_USD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"adjustmentBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowedStaleness","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"favorPrimaryPrice","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getLatestPrimaryPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_maximise","type":"bool"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_maximise","type":"bool"}],"name":"getPriceV1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_maximise","type":"bool"}],"name":"getPrimaryPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getPythPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_referencePrice","type":"uint256"},{"internalType":"bool","name":"_maximise","type":"bool"}],"name":"getSecondaryPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gov","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAdjustmentAdditive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSecondaryPriceEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastAdjustmentTimings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxStrictPriceDeviation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"priceFeeds","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pythNetwork","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"secondaryPriceFeed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_isAdditive","type":"bool"},{"internalType":"uint256","name":"_adjustmentBps","type":"uint256"}],"name":"setAdjustment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_favorPrimaryPrice","type":"bool"}],"name":"setFavorPrimaryPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_gov","type":"address"}],"name":"setGov","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isEnabled","type":"bool"}],"name":"setIsSecondaryPriceEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxStrictPriceDeviation","type":"uint256"}],"name":"setMaxStrictPriceDeviation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pythNetwork","type":"address"}],"name":"setPythNetwork","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_secondaryPriceFeed","type":"address"}],"name":"setSecondaryPriceFeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_spreadBasisPoints","type":"uint256"}],"name":"setSpreadBasisPoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_spreadThresholdBasisPoints","type":"uint256"}],"name":"setSpreadThresholdBasisPoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bytes32","name":"_priceFeed","type":"bytes32"},{"internalType":"uint256","name":"_allowedStaleness","type":"uint256"},{"internalType":"bool","name":"_isStrictStable","type":"bool"}],"name":"setTokenConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"spreadBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"spreadThresholdBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"strictStableTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040526000805461ffff60a01b1916600160a01b1790556b204fce5e3e25026110000000600155601e60035534801561003957600080fd5b50600080546001600160a01b031916331790556114e98061005b6000396000f3fe608060405234801561001057600080fd5b506004361061021c5760003560e01c80636ce8a44b116101255780639dcb511a116100ad578063b8f611051161007c578063b8f61105146104ad578063cc527382146104d0578063cfad57a2146104e3578063d694376c146104f6578063eb1c92a91461050957600080fd5b80639dcb511a14610451578063a27ea38614610471578063a39c73a314610491578063b731dd871461049a57600080fd5b80638b86616c116100f45780638b86616c1461040f57806395082d25146103935780639a0a6635146104225780639b18dc47146104355780639b8893801461043e57600080fd5b80636ce8a44b146103a6578063717cfe7a146103c95780637cdddae6146103e9578063830359f1146103fc57600080fd5b806340507b71116101a857806356bf9de41161017757806356bf9de41461034657806356c8c2c114610359578063593d9e801461036c578063604f37e91461038057806367781c0e1461039357600080fd5b806340507b71146102eb57806348cac2771461030b5780634a4b1f4f1461032b578063553dcbbd1461033357600080fd5b80632fbfe3d3116101ef5780632fbfe3d3146102855780632fc3a70a14610298578063378e7bf7146102ab5780633eba8d36146102b45780633ebbc601146102c757600080fd5b80630957aed914610221578063126082cf1461023c57806312d43a51146102455780631dac763a14610270575b600080fd5b610229603281565b6040519081526020015b60405180910390f35b61022961271081565b600054610258906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b61028361027e366004611060565b61051c565b005b61028361029336600461107b565b610571565b6102296102a63660046110a4565b6105a0565b61022960015481565b6102296102c23660046110f8565b610649565b6000546102db90600160a01b900460ff1681565b6040519015158152602001610233565b6102296102f9366004611060565b60076020526000908152604090205481565b610229610319366004611060565b60096020526000908152604090205481565b610229601481565b600454610258906001600160a01b031681565b610229610354366004611060565b6106ea565b610229610367366004611134565b610701565b6000546102db90600160a81b900460ff1681565b61028361038e366004611167565b610711565b61022968327cb2734119d3b7a9601e1b81565b6102db6103b4366004611060565b600a6020526000908152604090205460ff1681565b6102296103d7366004611060565b600b6020526000908152604090205481565b6102296103f7366004611134565b610759565b61028361040a366004611182565b61090a565b600254610258906001600160a01b031681565b610283610430366004611060565b610977565b610229611c2081565b61028361044c3660046111bd565b6109c3565b61022961045f366004611060565b60066020526000908152604090205481565b61022961047f366004611060565b60056020526000908152604090205481565b61022960035481565b6102836104a836600461107b565b610a6d565b6102db6104bb366004611060565b60086020526000908152604090205460ff1681565b6102296104de366004611060565b610a9c565b6102836104f1366004611060565b610aac565b6102836105043660046111e7565b610af8565b610283610517366004611167565b610c42565b6000546001600160a01b0316331461054f5760405162461bcd60e51b815260040161054690611223565b60405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461059b5760405162461bcd60e51b815260040161054690611223565b600155565b6000806105ad8686610759565b6001600160a01b038716600090815260096020526040902054909150801561063f576001600160a01b0387166000908152600a602052604090205460ff168015610619576127106105fe8382611268565b610608908561127b565b6106129190611292565b925061063d565b61271061062683826112b4565b610630908561127b565b61063a9190611292565b92505b505b5095945050505050565b6002546000906001600160a01b03166106635750816106e3565b600254604051630ffd9c6d60e31b81526001600160a01b03868116600483015260248201869052841515604483015290911690637fece36890606401602060405180830381865afa1580156106bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e091906112c7565b90505b9392505050565b60006106fb82600160006001610c8a565b92915050565b60006106e3836000846001610c8a565b6000546001600160a01b0316331461073b5760405162461bcd60e51b815260040161054690611223565b60008054911515600160a81b0260ff60a81b19909216919091179055565b6000806107668484610701565b600054909150600160a01b900460ff16801561079b57506001600160a01b03841660009081526008602052604090205460ff16155b156107ae576107ab848285610649565b90505b6001600160a01b03841660009081526008602052604090205460ff161561089757600068327cb2734119d3b7a9601e1b82116107ff576107fa8268327cb2734119d3b7a9601e1b6112b4565b610815565b61081568327cb2734119d3b7a9601e1b836112b4565b905060015481116108365768327cb2734119d3b7a9601e1b925050506106fb565b83801561084e575068327cb2734119d3b7a9601e1b82115b1561085b575090506106fb565b83158015610874575068327cb2734119d3b7a9601e1b82105b15610881575090506106fb565b68327cb2734119d3b7a9601e1b925050506106fb565b6001600160a01b03841660009081526005602052604090205483156108e0576127106108c38282611268565b6108cd908461127b565b6108d79190611292565b925050506106fb565b6127106108ed82826112b4565b6108f7908461127b565b6109019190611292565b95945050505050565b6000546001600160a01b031633146109345760405162461bcd60e51b815260040161054690611223565b6001600160a01b03939093166000908152600860209081526040808320805460ff1916961515969096179095556006815284822093909355600790925291902055565b6000546001600160a01b031633146109a15760405162461bcd60e51b815260040161054690611223565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146109ed5760405162461bcd60e51b815260040161054690611223565b6032811115610a515760405162461bcd60e51b815260206004820152602a60248201527f5661756c745072696365466565643a20696e76616c6964205f7370726561644260448201526961736973506f696e747360b01b6064820152608401610546565b6001600160a01b03909116600090815260056020526040902055565b6000546001600160a01b03163314610a975760405162461bcd60e51b815260040161054690611223565b600355565b60006106fb826001806000610c8a565b6000546001600160a01b03163314610ad65760405162461bcd60e51b815260040161054690611223565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610b225760405162461bcd60e51b815260040161054690611223565b6001600160a01b0383166000908152600b60205260409020544290610b4a90611c2090611268565b10610bad5760405162461bcd60e51b815260206004820152602d60248201527f5661756c745072696365466565643a2061646a7573746d656e7420667265717560448201526c195b98de48195e18d959591959609a1b6064820152608401610546565b6014811115610bfe5760405162461bcd60e51b815260206004820152601660248201527f696e76616c6964205f61646a7573746d656e74427073000000000000000000006044820152606401610546565b6001600160a01b03929092166000908152600a60209081526040808320805460ff1916941515949094179093556009815282822093909355600b9092529020429055565b6000546001600160a01b03163314610c6c5760405162461bcd60e51b815260040161054690611223565b60008054911515600160a01b0260ff60a01b19909216919091179055565b600080610c9686610e4d565b9050828015610cbc57506001600160a01b03861660009081526007602052604090205415155b15610d38576001600160a01b0386166000908152600760205260409020546060820151610ce99190611268565b421115610d385760405162461bcd60e51b815260206004820152601b60248201527f5661756c745072696365466565643a207072696365207374616c6500000000006044820152606401610546565b60008515610d525750805167ffffffffffffffff16610d9d565b602082015167ffffffffffffffff1685610d82578251610d7d90829067ffffffffffffffff166112b4565b610d99565b8251610d9990829067ffffffffffffffff16611268565b9150505b6000826040015160030b1315610e045760405162461bcd60e51b815260206004820152602660248201527f5661756c745072696365466565643a20696e76616c69642070726963652065786044820152651c1bdb995b9d60d21b6064820152608401610546565b60008260400151610e14906112e0565b9050610e2181600a6113e7565b610e3768327cb2734119d3b7a9601e1b8461127b565b610e419190611292565b98975050505050505050565b6040805160808101825260008082526020820181905291810182905260608101919091526004546001600160a01b0316610eef5760405162461bcd60e51b815260206004820152603660248201527f5661756c745072696365466565643a2070797468206e6574776f726b2061646460448201527f72657373206973206e6f7420636f6e66696775726564000000000000000000006064820152608401610546565b6001600160a01b03821660009081526006602052604090205480610f7b5760405162461bcd60e51b815260206004820152603760248201527f5661756c745072696365466565643a207072696365206964206e6f7420636f6e60448201527f6669677572656420666f7220676976656e20746f6b656e0000000000000000006064820152608401610546565b60048054604051639474f45b60e01b81529182018390526000916001600160a01b0390911690639474f45b90602401608060405180830381865afa158015610fc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610feb9190611423565b90506000816000015160070b136106e35760405162461bcd60e51b815260206004820152601d60248201527f5661756c745072696365466565643a20696e76616c69642070726963650000006044820152606401610546565b80356001600160a01b038116811461105b57600080fd5b919050565b60006020828403121561107257600080fd5b6106e382611044565b60006020828403121561108d57600080fd5b5035919050565b8035801515811461105b57600080fd5b600080600080608085870312156110ba57600080fd5b6110c385611044565b93506110d160208601611094565b92506110df60408601611094565b91506110ed60608601611094565b905092959194509250565b60008060006060848603121561110d57600080fd5b61111684611044565b92506020840135915061112b60408501611094565b90509250925092565b6000806040838503121561114757600080fd5b61115083611044565b915061115e60208401611094565b90509250929050565b60006020828403121561117957600080fd5b6106e382611094565b6000806000806080858703121561119857600080fd5b6111a185611044565b935060208501359250604085013591506110ed60608601611094565b600080604083850312156111d057600080fd5b6111d983611044565b946020939093013593505050565b6000806000606084860312156111fc57600080fd5b61120584611044565b925061121360208501611094565b9150604084013590509250925092565b60208082526015908201527423b7bb32b93730b136329d103337b93134b23232b760591b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b808201808211156106fb576106fb611252565b80820281158282048414176106fb576106fb611252565b6000826112af57634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156106fb576106fb611252565b6000602082840312156112d957600080fd5b5051919050565b60008160030b637fffffff1981036112fa576112fa611252565b60000392915050565b600181815b8085111561133e57816000190482111561132457611324611252565b8085161561133157918102915b93841c9390800290611308565b509250929050565b600082611355575060016106fb565b81611362575060006106fb565b816001811461137857600281146113825761139e565b60019150506106fb565b60ff84111561139357611393611252565b50506001821b6106fb565b5060208310610133831016604e8410600b84101617156113c1575081810a6106fb565b6113cb8383611303565b80600019048211156113df576113df611252565b029392505050565b60006106e363ffffffff841683611346565b805167ffffffffffffffff8116811461105b57600080fd5b8051600381900b811461105b57600080fd5b60006080828403121561143557600080fd5b6040516080810181811067ffffffffffffffff8211171561146657634e487b7160e01b600052604160045260246000fd5b6040528251600781900b811461147b57600080fd5b8152611489602084016113f9565b602082015261149a60408401611411565b604082015260608301516060820152809150509291505056fea26469706673582212203054a14a58fe2221b3038ba478ebf2b6e6524c790122d38315e09c6f25b46a0764736f6c63430008140033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061021c5760003560e01c80636ce8a44b116101255780639dcb511a116100ad578063b8f611051161007c578063b8f61105146104ad578063cc527382146104d0578063cfad57a2146104e3578063d694376c146104f6578063eb1c92a91461050957600080fd5b80639dcb511a14610451578063a27ea38614610471578063a39c73a314610491578063b731dd871461049a57600080fd5b80638b86616c116100f45780638b86616c1461040f57806395082d25146103935780639a0a6635146104225780639b18dc47146104355780639b8893801461043e57600080fd5b80636ce8a44b146103a6578063717cfe7a146103c95780637cdddae6146103e9578063830359f1146103fc57600080fd5b806340507b71116101a857806356bf9de41161017757806356bf9de41461034657806356c8c2c114610359578063593d9e801461036c578063604f37e91461038057806367781c0e1461039357600080fd5b806340507b71146102eb57806348cac2771461030b5780634a4b1f4f1461032b578063553dcbbd1461033357600080fd5b80632fbfe3d3116101ef5780632fbfe3d3146102855780632fc3a70a14610298578063378e7bf7146102ab5780633eba8d36146102b45780633ebbc601146102c757600080fd5b80630957aed914610221578063126082cf1461023c57806312d43a51146102455780631dac763a14610270575b600080fd5b610229603281565b6040519081526020015b60405180910390f35b61022961271081565b600054610258906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b61028361027e366004611060565b61051c565b005b61028361029336600461107b565b610571565b6102296102a63660046110a4565b6105a0565b61022960015481565b6102296102c23660046110f8565b610649565b6000546102db90600160a01b900460ff1681565b6040519015158152602001610233565b6102296102f9366004611060565b60076020526000908152604090205481565b610229610319366004611060565b60096020526000908152604090205481565b610229601481565b600454610258906001600160a01b031681565b610229610354366004611060565b6106ea565b610229610367366004611134565b610701565b6000546102db90600160a81b900460ff1681565b61028361038e366004611167565b610711565b61022968327cb2734119d3b7a9601e1b81565b6102db6103b4366004611060565b600a6020526000908152604090205460ff1681565b6102296103d7366004611060565b600b6020526000908152604090205481565b6102296103f7366004611134565b610759565b61028361040a366004611182565b61090a565b600254610258906001600160a01b031681565b610283610430366004611060565b610977565b610229611c2081565b61028361044c3660046111bd565b6109c3565b61022961045f366004611060565b60066020526000908152604090205481565b61022961047f366004611060565b60056020526000908152604090205481565b61022960035481565b6102836104a836600461107b565b610a6d565b6102db6104bb366004611060565b60086020526000908152604090205460ff1681565b6102296104de366004611060565b610a9c565b6102836104f1366004611060565b610aac565b6102836105043660046111e7565b610af8565b610283610517366004611167565b610c42565b6000546001600160a01b0316331461054f5760405162461bcd60e51b815260040161054690611223565b60405180910390fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461059b5760405162461bcd60e51b815260040161054690611223565b600155565b6000806105ad8686610759565b6001600160a01b038716600090815260096020526040902054909150801561063f576001600160a01b0387166000908152600a602052604090205460ff168015610619576127106105fe8382611268565b610608908561127b565b6106129190611292565b925061063d565b61271061062683826112b4565b610630908561127b565b61063a9190611292565b92505b505b5095945050505050565b6002546000906001600160a01b03166106635750816106e3565b600254604051630ffd9c6d60e31b81526001600160a01b03868116600483015260248201869052841515604483015290911690637fece36890606401602060405180830381865afa1580156106bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e091906112c7565b90505b9392505050565b60006106fb82600160006001610c8a565b92915050565b60006106e3836000846001610c8a565b6000546001600160a01b0316331461073b5760405162461bcd60e51b815260040161054690611223565b60008054911515600160a81b0260ff60a81b19909216919091179055565b6000806107668484610701565b600054909150600160a01b900460ff16801561079b57506001600160a01b03841660009081526008602052604090205460ff16155b156107ae576107ab848285610649565b90505b6001600160a01b03841660009081526008602052604090205460ff161561089757600068327cb2734119d3b7a9601e1b82116107ff576107fa8268327cb2734119d3b7a9601e1b6112b4565b610815565b61081568327cb2734119d3b7a9601e1b836112b4565b905060015481116108365768327cb2734119d3b7a9601e1b925050506106fb565b83801561084e575068327cb2734119d3b7a9601e1b82115b1561085b575090506106fb565b83158015610874575068327cb2734119d3b7a9601e1b82105b15610881575090506106fb565b68327cb2734119d3b7a9601e1b925050506106fb565b6001600160a01b03841660009081526005602052604090205483156108e0576127106108c38282611268565b6108cd908461127b565b6108d79190611292565b925050506106fb565b6127106108ed82826112b4565b6108f7908461127b565b6109019190611292565b95945050505050565b6000546001600160a01b031633146109345760405162461bcd60e51b815260040161054690611223565b6001600160a01b03939093166000908152600860209081526040808320805460ff1916961515969096179095556006815284822093909355600790925291902055565b6000546001600160a01b031633146109a15760405162461bcd60e51b815260040161054690611223565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146109ed5760405162461bcd60e51b815260040161054690611223565b6032811115610a515760405162461bcd60e51b815260206004820152602a60248201527f5661756c745072696365466565643a20696e76616c6964205f7370726561644260448201526961736973506f696e747360b01b6064820152608401610546565b6001600160a01b03909116600090815260056020526040902055565b6000546001600160a01b03163314610a975760405162461bcd60e51b815260040161054690611223565b600355565b60006106fb826001806000610c8a565b6000546001600160a01b03163314610ad65760405162461bcd60e51b815260040161054690611223565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610b225760405162461bcd60e51b815260040161054690611223565b6001600160a01b0383166000908152600b60205260409020544290610b4a90611c2090611268565b10610bad5760405162461bcd60e51b815260206004820152602d60248201527f5661756c745072696365466565643a2061646a7573746d656e7420667265717560448201526c195b98de48195e18d959591959609a1b6064820152608401610546565b6014811115610bfe5760405162461bcd60e51b815260206004820152601660248201527f696e76616c6964205f61646a7573746d656e74427073000000000000000000006044820152606401610546565b6001600160a01b03929092166000908152600a60209081526040808320805460ff1916941515949094179093556009815282822093909355600b9092529020429055565b6000546001600160a01b03163314610c6c5760405162461bcd60e51b815260040161054690611223565b60008054911515600160a01b0260ff60a01b19909216919091179055565b600080610c9686610e4d565b9050828015610cbc57506001600160a01b03861660009081526007602052604090205415155b15610d38576001600160a01b0386166000908152600760205260409020546060820151610ce99190611268565b421115610d385760405162461bcd60e51b815260206004820152601b60248201527f5661756c745072696365466565643a207072696365207374616c6500000000006044820152606401610546565b60008515610d525750805167ffffffffffffffff16610d9d565b602082015167ffffffffffffffff1685610d82578251610d7d90829067ffffffffffffffff166112b4565b610d99565b8251610d9990829067ffffffffffffffff16611268565b9150505b6000826040015160030b1315610e045760405162461bcd60e51b815260206004820152602660248201527f5661756c745072696365466565643a20696e76616c69642070726963652065786044820152651c1bdb995b9d60d21b6064820152608401610546565b60008260400151610e14906112e0565b9050610e2181600a6113e7565b610e3768327cb2734119d3b7a9601e1b8461127b565b610e419190611292565b98975050505050505050565b6040805160808101825260008082526020820181905291810182905260608101919091526004546001600160a01b0316610eef5760405162461bcd60e51b815260206004820152603660248201527f5661756c745072696365466565643a2070797468206e6574776f726b2061646460448201527f72657373206973206e6f7420636f6e66696775726564000000000000000000006064820152608401610546565b6001600160a01b03821660009081526006602052604090205480610f7b5760405162461bcd60e51b815260206004820152603760248201527f5661756c745072696365466565643a207072696365206964206e6f7420636f6e60448201527f6669677572656420666f7220676976656e20746f6b656e0000000000000000006064820152608401610546565b60048054604051639474f45b60e01b81529182018390526000916001600160a01b0390911690639474f45b90602401608060405180830381865afa158015610fc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610feb9190611423565b90506000816000015160070b136106e35760405162461bcd60e51b815260206004820152601d60248201527f5661756c745072696365466565643a20696e76616c69642070726963650000006044820152606401610546565b80356001600160a01b038116811461105b57600080fd5b919050565b60006020828403121561107257600080fd5b6106e382611044565b60006020828403121561108d57600080fd5b5035919050565b8035801515811461105b57600080fd5b600080600080608085870312156110ba57600080fd5b6110c385611044565b93506110d160208601611094565b92506110df60408601611094565b91506110ed60608601611094565b905092959194509250565b60008060006060848603121561110d57600080fd5b61111684611044565b92506020840135915061112b60408501611094565b90509250925092565b6000806040838503121561114757600080fd5b61115083611044565b915061115e60208401611094565b90509250929050565b60006020828403121561117957600080fd5b6106e382611094565b6000806000806080858703121561119857600080fd5b6111a185611044565b935060208501359250604085013591506110ed60608601611094565b600080604083850312156111d057600080fd5b6111d983611044565b946020939093013593505050565b6000806000606084860312156111fc57600080fd5b61120584611044565b925061121360208501611094565b9150604084013590509250925092565b60208082526015908201527423b7bb32b93730b136329d103337b93134b23232b760591b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b808201808211156106fb576106fb611252565b80820281158282048414176106fb576106fb611252565b6000826112af57634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156106fb576106fb611252565b6000602082840312156112d957600080fd5b5051919050565b60008160030b637fffffff1981036112fa576112fa611252565b60000392915050565b600181815b8085111561133e57816000190482111561132457611324611252565b8085161561133157918102915b93841c9390800290611308565b509250929050565b600082611355575060016106fb565b81611362575060006106fb565b816001811461137857600281146113825761139e565b60019150506106fb565b60ff84111561139357611393611252565b50506001821b6106fb565b5060208310610133831016604e8410600b84101617156113c1575081810a6106fb565b6113cb8383611303565b80600019048211156113df576113df611252565b029392505050565b60006106e363ffffffff841683611346565b805167ffffffffffffffff8116811461105b57600080fd5b8051600381900b811461105b57600080fd5b60006080828403121561143557600080fd5b6040516080810181811067ffffffffffffffff8211171561146657634e487b7160e01b600052604160045260246000fd5b6040528251600781900b811461147b57600080fd5b8152611489602084016113f9565b602082015261149a60408401611411565b604082015260608301516060820152809150509291505056fea26469706673582212203054a14a58fe2221b3038ba478ebf2b6e6524c790122d38315e09c6f25b46a0764736f6c63430008140033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 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.