Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
||||
---|---|---|---|---|---|---|---|
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21639007 | 2 days ago | 0 ETH | |||||
21638936 | 2 days ago | 0 ETH | |||||
21638936 | 2 days ago | 0 ETH | |||||
21638936 | 2 days ago | 0 ETH | |||||
21638936 | 2 days ago | 0 ETH | |||||
21638936 | 2 days ago | 0 ETH | |||||
21638936 | 2 days ago | 0 ETH | |||||
21638936 | 2 days ago | 0 ETH | |||||
21638936 | 2 days ago | 0 ETH | |||||
21638936 | 2 days ago | 0 ETH |
Loading...
Loading
Contract Name:
PriceFeed
Compiler Version
v0.8.19+commit.7dd6d404
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import "IAggregatorV3Interface.sol"; import "Address.sol"; import "PrismaMath.sol"; import "PrismaOwnable.sol"; /** @title Prisma Multi Token Price Feed @notice Based on Gravita's PriceFeed: https://github.com/Gravita-Protocol/Gravita-SmartContracts/blob/9b69d555f3567622b0f84df8c7f1bb5cd9323573/contracts/PriceFeed.sol Prisma's implementation additionally caches price values within a block and incorporates exchange rate settings for derivative tokens (e.g. stETH -> wstETH). */ contract PriceFeed is PrismaOwnable { struct OracleRecord { IAggregatorV3Interface chainLinkOracle; uint8 decimals; uint32 heartbeat; bytes4 sharePriceSignature; uint8 sharePriceDecimals; bool isFeedWorking; bool isEthIndexed; } struct PriceRecord { uint96 scaledPrice; uint32 timestamp; uint32 lastUpdated; uint80 roundId; } struct FeedResponse { uint80 roundId; int256 answer; uint256 timestamp; bool success; } // Custom Errors -------------------------------------------------------------------------------------------------- error PriceFeed__InvalidFeedResponseError(address token); error PriceFeed__FeedFrozenError(address token); error PriceFeed__UnknownFeedError(address token); error PriceFeed__HeartbeatOutOfBoundsError(); // Events --------------------------------------------------------------------------------------------------------- event NewOracleRegistered(address token, address chainlinkAggregator, bool isEthIndexed); event PriceFeedStatusUpdated(address token, address oracle, bool isWorking); event PriceRecordUpdated(address indexed token, uint256 _price); /** Constants ---------------------------------------------------------------------------------------------------- */ // Used to convert a chainlink price answer to an 18-digit precision uint uint256 public constant TARGET_DIGITS = 18; // Responses are considered stale this many seconds after the oracle's heartbeat uint256 public constant RESPONSE_TIMEOUT_BUFFER = 1 hours; // Maximum deviation allowed between two consecutive Chainlink oracle prices. 18-digit precision. uint256 public constant MAX_PRICE_DEVIATION_FROM_PREVIOUS_ROUND = 5e17; // 50% // State ------------------------------------------------------------------------------------------------------------ mapping(address => OracleRecord) public oracleRecords; mapping(address => PriceRecord) public priceRecords; struct OracleSetup { address token; address chainlink; uint32 heartbeat; bytes4 sharePriceSignature; uint8 sharePriceDecimals; bool isEthIndexed; } constructor(address _prismaCore, address ethFeed, OracleSetup[] memory oracles) PrismaOwnable(_prismaCore) { _setOracle(address(0), ethFeed, 3600, 0, 0, false); for (uint i = 0; i < oracles.length; i++) { OracleSetup memory o = oracles[i]; _setOracle(o.token, o.chainlink, o.heartbeat, o.sharePriceSignature, o.sharePriceDecimals, o.isEthIndexed); } } // Admin routines --------------------------------------------------------------------------------------------------- /** @notice Set the oracle for a specific token @param _token Address of the LST to set the oracle for @param _chainlinkOracle Address of the chainlink oracle for this LST @param _heartbeat Oracle heartbeat, in seconds @param sharePriceSignature Four byte function selector to be used when calling `_collateral`, in order to obtain the share price @param sharePriceDecimals Decimal precision used in the returned share price @param _isEthIndexed True if the base currency is ETH */ function setOracle( address _token, address _chainlinkOracle, uint32 _heartbeat, bytes4 sharePriceSignature, uint8 sharePriceDecimals, bool _isEthIndexed ) external onlyOwner { _setOracle(_token, _chainlinkOracle, _heartbeat, sharePriceSignature, sharePriceDecimals, _isEthIndexed); } function _setOracle( address _token, address _chainlinkOracle, uint32 _heartbeat, bytes4 sharePriceSignature, uint8 sharePriceDecimals, bool _isEthIndexed ) internal { if (_heartbeat > 86400) revert PriceFeed__HeartbeatOutOfBoundsError(); IAggregatorV3Interface newFeed = IAggregatorV3Interface(_chainlinkOracle); (FeedResponse memory currResponse, FeedResponse memory prevResponse, ) = _fetchFeedResponses(newFeed, 0); if (!_isFeedWorking(currResponse, prevResponse)) { revert PriceFeed__InvalidFeedResponseError(_token); } if (_isPriceStale(currResponse.timestamp, _heartbeat)) { revert PriceFeed__FeedFrozenError(_token); } OracleRecord memory record = OracleRecord({ chainLinkOracle: newFeed, decimals: newFeed.decimals(), heartbeat: _heartbeat, sharePriceSignature: sharePriceSignature, sharePriceDecimals: sharePriceDecimals, isFeedWorking: true, isEthIndexed: _isEthIndexed }); oracleRecords[_token] = record; PriceRecord memory _priceRecord = priceRecords[_token]; _processFeedResponses(_token, record, currResponse, prevResponse, _priceRecord); emit NewOracleRegistered(_token, _chainlinkOracle, _isEthIndexed); } // Public functions ------------------------------------------------------------------------------------------------- /** @notice Get the latest price returned from the oracle @dev You can obtain these values by calling `TroveManager.fetchPrice()` rather than directly interacting with this contract. @param _token Token to fetch the price for @return The latest valid price for the requested token */ function fetchPrice(address _token) public returns (uint256) { PriceRecord memory priceRecord = priceRecords[_token]; OracleRecord memory oracle = oracleRecords[_token]; uint256 scaledPrice = priceRecord.scaledPrice; // We short-circuit only if the price was already correct in the current block if (priceRecord.lastUpdated != block.timestamp) { if (priceRecord.lastUpdated == 0) { revert PriceFeed__UnknownFeedError(_token); } (FeedResponse memory currResponse, FeedResponse memory prevResponse, bool updated) = _fetchFeedResponses( oracle.chainLinkOracle, priceRecord.roundId ); if (updated) { scaledPrice = _processFeedResponses(_token, oracle, currResponse, prevResponse, priceRecord); } else { if (_isPriceStale(priceRecord.timestamp, oracle.heartbeat)) { revert PriceFeed__FeedFrozenError(_token); } priceRecord.lastUpdated = uint32(block.timestamp); priceRecords[_token] = priceRecord; } } if (oracle.isEthIndexed) { uint256 ethPrice = fetchPrice(address(0)); return (ethPrice * scaledPrice) / 1 ether; } return scaledPrice; } // Internal functions ----------------------------------------------------------------------------------------------- function _processFeedResponses( address _token, OracleRecord memory oracle, FeedResponse memory _currResponse, FeedResponse memory _prevResponse, PriceRecord memory priceRecord ) internal returns (uint256) { uint8 decimals = oracle.decimals; bool isValidResponse = _isFeedWorking(_currResponse, _prevResponse) && !_isPriceStale(_currResponse.timestamp, oracle.heartbeat) && !_isPriceChangeAboveMaxDeviation(_currResponse, _prevResponse, decimals); if (isValidResponse) { uint256 scaledPrice = _scalePriceByDigits(uint256(_currResponse.answer), decimals); if (oracle.sharePriceSignature != 0) { (bool success, bytes memory returnData) = _token.staticcall(abi.encode(oracle.sharePriceSignature)); require(success, "Share price not available"); scaledPrice = (scaledPrice * abi.decode(returnData, (uint256))) / (10 ** oracle.sharePriceDecimals); } if (!oracle.isFeedWorking) { _updateFeedStatus(_token, oracle, true); } _storePrice(_token, scaledPrice, _currResponse.timestamp, _currResponse.roundId); return scaledPrice; } else { if (oracle.isFeedWorking) { _updateFeedStatus(_token, oracle, false); } if (_isPriceStale(priceRecord.timestamp, oracle.heartbeat)) { revert PriceFeed__FeedFrozenError(_token); } return priceRecord.scaledPrice; } } function _fetchFeedResponses( IAggregatorV3Interface oracle, uint80 lastRoundId ) internal view returns (FeedResponse memory currResponse, FeedResponse memory prevResponse, bool updated) { currResponse = _fetchCurrentFeedResponse(oracle); if (lastRoundId == 0 || currResponse.roundId > lastRoundId) { prevResponse = _fetchPrevFeedResponse(oracle, currResponse.roundId); updated = true; } } function _isPriceStale(uint256 _priceTimestamp, uint256 _heartbeat) internal view returns (bool) { return block.timestamp - _priceTimestamp > _heartbeat + RESPONSE_TIMEOUT_BUFFER; } function _isFeedWorking( FeedResponse memory _currentResponse, FeedResponse memory _prevResponse ) internal view returns (bool) { return _isValidResponse(_currentResponse) && _isValidResponse(_prevResponse); } function _isValidResponse(FeedResponse memory _response) internal view returns (bool) { return (_response.success) && (_response.roundId != 0) && (_response.timestamp != 0) && (_response.timestamp <= block.timestamp) && (_response.answer != 0); } function _isPriceChangeAboveMaxDeviation( FeedResponse memory _currResponse, FeedResponse memory _prevResponse, uint8 decimals ) internal pure returns (bool) { uint256 currentScaledPrice = _scalePriceByDigits(uint256(_currResponse.answer), decimals); uint256 prevScaledPrice = _scalePriceByDigits(uint256(_prevResponse.answer), decimals); uint256 minPrice = PrismaMath._min(currentScaledPrice, prevScaledPrice); uint256 maxPrice = PrismaMath._max(currentScaledPrice, prevScaledPrice); /* * Use the larger price as the denominator: * - If price decreased, the percentage deviation is in relation to the previous price. * - If price increased, the percentage deviation is in relation to the current price. */ uint256 percentDeviation = ((maxPrice - minPrice) * PrismaMath.DECIMAL_PRECISION) / maxPrice; return percentDeviation > MAX_PRICE_DEVIATION_FROM_PREVIOUS_ROUND; } function _scalePriceByDigits(uint256 _price, uint256 _answerDigits) internal pure returns (uint256) { if (_answerDigits == TARGET_DIGITS) { return _price; } else if (_answerDigits < TARGET_DIGITS) { // Scale the returned price value up to target precision return _price * (10 ** (TARGET_DIGITS - _answerDigits)); } else { // Scale the returned price value down to target precision return _price / (10 ** (_answerDigits - TARGET_DIGITS)); } } function _updateFeedStatus(address _token, OracleRecord memory _oracle, bool _isWorking) internal { oracleRecords[_token].isFeedWorking = _isWorking; emit PriceFeedStatusUpdated(_token, address(_oracle.chainLinkOracle), _isWorking); } function _storePrice(address _token, uint256 _price, uint256 _timestamp, uint80 roundId) internal { priceRecords[_token] = PriceRecord({ scaledPrice: uint96(_price), timestamp: uint32(_timestamp), lastUpdated: uint32(block.timestamp), roundId: roundId }); emit PriceRecordUpdated(_token, _price); } function _fetchCurrentFeedResponse( IAggregatorV3Interface _priceAggregator ) internal view returns (FeedResponse memory response) { try _priceAggregator.latestRoundData() returns ( uint80 roundId, int256 answer, uint256 /* startedAt */, uint256 timestamp, uint80 /* answeredInRound */ ) { // If call to Chainlink succeeds, return the response and success = true response.roundId = roundId; response.answer = answer; response.timestamp = timestamp; response.success = true; } catch { // If call to Chainlink aggregator reverts, return a zero response with success = false return response; } } function _fetchPrevFeedResponse( IAggregatorV3Interface _priceAggregator, uint80 _currentRoundId ) internal view returns (FeedResponse memory prevResponse) { if (_currentRoundId == 0) { return prevResponse; } unchecked { try _priceAggregator.getRoundData(_currentRoundId - 1) returns ( uint80 roundId, int256 answer, uint256 /* startedAt */, uint256 timestamp, uint80 /* answeredInRound */ ) { prevResponse.roundId = roundId; prevResponse.answer = answer; prevResponse.timestamp = timestamp; prevResponse.success = true; } catch {} } } }
// SPDX-License-Identifier: MIT // Code from https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol pragma solidity 0.8.19; interface IAggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData( uint80 _roundId ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; library PrismaMath { uint256 internal constant DECIMAL_PRECISION = 1e18; /* Precision for Nominal ICR (independent of price). Rationale for the value: * * - Making it “too high” could lead to overflows. * - Making it “too low” could lead to an ICR equal to zero, due to truncation from Solidity floor division. * * This value of 1e20 is chosen for safety: the NICR will only overflow for numerator > ~1e39, * and will only truncate to 0 if the denominator is at least 1e20 times greater than the numerator. * */ uint256 internal constant NICR_PRECISION = 1e20; function _min(uint256 _a, uint256 _b) internal pure returns (uint256) { return (_a < _b) ? _a : _b; } function _max(uint256 _a, uint256 _b) internal pure returns (uint256) { return (_a >= _b) ? _a : _b; } /* * Multiply two decimal numbers and use normal rounding rules: * -round product up if 19'th mantissa digit >= 5 * -round product down if 19'th mantissa digit < 5 * * Used only inside the exponentiation, _decPow(). */ function decMul(uint256 x, uint256 y) internal pure returns (uint256 decProd) { uint256 prod_xy = x * y; decProd = (prod_xy + (DECIMAL_PRECISION / 2)) / DECIMAL_PRECISION; } /* * _decPow: Exponentiation function for 18-digit decimal base, and integer exponent n. * * Uses the efficient "exponentiation by squaring" algorithm. O(log(n)) complexity. * * Called by two functions that represent time in units of minutes: * 1) TroveManager._calcDecayedBaseRate * 2) CommunityIssuance._getCumulativeIssuanceFraction * * The exponent is capped to avoid reverting due to overflow. The cap 525600000 equals * "minutes in 1000 years": 60 * 24 * 365 * 1000 * * If a period of > 1000 years is ever used as an exponent in either of the above functions, the result will be * negligibly different from just passing the cap, since: * * In function 1), the decayed base rate will be 0 for 1000 years or > 1000 years * In function 2), the difference in tokens issued at 1000 years and any time > 1000 years, will be negligible */ function _decPow(uint256 _base, uint256 _minutes) internal pure returns (uint256) { if (_minutes > 525600000) { _minutes = 525600000; } // cap to avoid overflow if (_minutes == 0) { return DECIMAL_PRECISION; } uint256 y = DECIMAL_PRECISION; uint256 x = _base; uint256 n = _minutes; // Exponentiation-by-squaring while (n > 1) { if (n % 2 == 0) { x = decMul(x, x); n = n / 2; } else { // if (n % 2 != 0) y = decMul(x, y); x = decMul(x, x); n = (n - 1) / 2; } } return decMul(x, y); } function _getAbsoluteDifference(uint256 _a, uint256 _b) internal pure returns (uint256) { return (_a >= _b) ? _a - _b : _b - _a; } function _computeNominalCR(uint256 _coll, uint256 _debt) internal pure returns (uint256) { if (_debt > 0) { return (_coll * NICR_PRECISION) / _debt; } // Return the maximal value for uint256 if the Trove has a debt of 0. Represents "infinite" CR. else { // if (_debt == 0) return 2 ** 256 - 1; } } function _computeCR(uint256 _coll, uint256 _debt, uint256 _price) internal pure returns (uint256) { if (_debt > 0) { uint256 newCollRatio = (_coll * _price) / _debt; return newCollRatio; } // Return the maximal value for uint256 if the Trove has a debt of 0. Represents "infinite" CR. else { // if (_debt == 0) return 2 ** 256 - 1; } } function _computeCR(uint256 _coll, uint256 _debt) internal pure returns (uint256) { if (_debt > 0) { uint256 newCollRatio = (_coll) / _debt; return newCollRatio; } // Return the maximal value for uint256 if the Trove has a debt of 0. Represents "infinite" CR. else { // if (_debt == 0) return 2 ** 256 - 1; } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import "IPrismaCore.sol"; /** @title Prisma Ownable @notice Contracts inheriting `PrismaOwnable` have the same owner as `PrismaCore`. The ownership cannot be independently modified or renounced. */ contract PrismaOwnable { IPrismaCore public immutable PRISMA_CORE; constructor(address _prismaCore) { PRISMA_CORE = IPrismaCore(_prismaCore); } modifier onlyOwner() { require(msg.sender == PRISMA_CORE.owner(), "Only owner"); _; } function owner() public view returns (address) { return PRISMA_CORE.owner(); } function guardian() public view returns (address) { return PRISMA_CORE.guardian(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IPrismaCore { event FeeReceiverSet(address feeReceiver); event GuardianSet(address guardian); event NewOwnerAccepted(address oldOwner, address owner); event NewOwnerCommitted(address owner, address pendingOwner, uint256 deadline); event NewOwnerRevoked(address owner, address revokedOwner); event Paused(); event PriceFeedSet(address priceFeed); event Unpaused(); function acceptTransferOwnership() external; function commitTransferOwnership(address newOwner) external; function revokeTransferOwnership() external; function setFeeReceiver(address _feeReceiver) external; function setGuardian(address _guardian) external; function setPaused(bool _paused) external; function setPriceFeed(address _priceFeed) external; function OWNERSHIP_TRANSFER_DELAY() external view returns (uint256); function feeReceiver() external view returns (address); function guardian() external view returns (address); function owner() external view returns (address); function ownershipTransferDeadline() external view returns (uint256); function paused() external view returns (bool); function pendingOwner() external view returns (address); function priceFeed() external view returns (address); function startTime() external view returns (uint256); }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "PriceFeed.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_prismaCore","type":"address"},{"internalType":"address","name":"ethFeed","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"chainlink","type":"address"},{"internalType":"uint32","name":"heartbeat","type":"uint32"},{"internalType":"bytes4","name":"sharePriceSignature","type":"bytes4"},{"internalType":"uint8","name":"sharePriceDecimals","type":"uint8"},{"internalType":"bool","name":"isEthIndexed","type":"bool"}],"internalType":"struct PriceFeed.OracleSetup[]","name":"oracles","type":"tuple[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"PriceFeed__FeedFrozenError","type":"error"},{"inputs":[],"name":"PriceFeed__HeartbeatOutOfBoundsError","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"PriceFeed__InvalidFeedResponseError","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"PriceFeed__UnknownFeedError","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"chainlinkAggregator","type":"address"},{"indexed":false,"internalType":"bool","name":"isEthIndexed","type":"bool"}],"name":"NewOracleRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"oracle","type":"address"},{"indexed":false,"internalType":"bool","name":"isWorking","type":"bool"}],"name":"PriceFeedStatusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"_price","type":"uint256"}],"name":"PriceRecordUpdated","type":"event"},{"inputs":[],"name":"MAX_PRICE_DEVIATION_FROM_PREVIOUS_ROUND","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRISMA_CORE","outputs":[{"internalType":"contract IPrismaCore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RESPONSE_TIMEOUT_BUFFER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TARGET_DIGITS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"fetchPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"guardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"oracleRecords","outputs":[{"internalType":"contract IAggregatorV3Interface","name":"chainLinkOracle","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint32","name":"heartbeat","type":"uint32"},{"internalType":"bytes4","name":"sharePriceSignature","type":"bytes4"},{"internalType":"uint8","name":"sharePriceDecimals","type":"uint8"},{"internalType":"bool","name":"isFeedWorking","type":"bool"},{"internalType":"bool","name":"isEthIndexed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"priceRecords","outputs":[{"internalType":"uint96","name":"scaledPrice","type":"uint96"},{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint32","name":"lastUpdated","type":"uint32"},{"internalType":"uint80","name":"roundId","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_chainlinkOracle","type":"address"},{"internalType":"uint32","name":"_heartbeat","type":"uint32"},{"internalType":"bytes4","name":"sharePriceSignature","type":"bytes4"},{"internalType":"uint8","name":"sharePriceDecimals","type":"uint8"},{"internalType":"bool","name":"_isEthIndexed","type":"bool"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b506040516200273b3803806200273b833981016040819052620000349162000d5c565b6001600160a01b03831660805262000054600083610e10828080620000d0565b60005b8151811015620000c657600082828151811062000078576200007862000ed4565b60200260200101519050620000b0816000015182602001518360400151846060015185608001518660a00151620000d060201b60201c565b5080620000bd8162000f00565b91505062000057565b5050505062001177565b620151808463ffffffff161115620000fb57604051632280d48b60e21b815260040160405180910390fd5b846000806200010b8382620004ba565b5090925090506200011d828262000557565b6200014b576040516312b2728d60e21b81526001600160a01b038a1660048201526024015b60405180910390fd5b6040820151620001629063ffffffff891662000580565b156200018d57604051633beb416d60e11b81526001600160a01b038a16600482015260240162000142565b60006040518060e00160405280856001600160a01b03168152602001856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001e8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020e919062000f1c565b60ff1681526020018963ffffffff168152602001886001600160e01b03191681526020018760ff1681526020016001151581526020018615158152509050806000808c6001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a81548160ff021916908360ff16021790555060408201518160000160156101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160196101000a81548163ffffffff021916908360e01c0217905550608082015181600001601d6101000a81548160ff021916908360ff16021790555060a082015181600001601e6101000a81548160ff02191690831515021790555060c082015181600001601f6101000a81548160ff0219169083151502179055509050506000600160008c6001600160a01b03166001600160a01b031681526020019081526020016000206040518060800160405290816000820160009054906101000a90046001600160601b03166001600160601b03166001600160601b0316815260200160008201600c9054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160109054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160149054906101000a90046001600160501b03166001600160501b03166001600160501b0316815250509050620004618b83868685620005a460201b60201c565b50604080516001600160a01b038d811682528c1660208201528715158183015290517f232f76b91cfa7f741ffa01f8740254f5f4cf520aa1119cc0bdfe8975ec8959969181900360600190a15050505050505050505050565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260006200050f856200081a565b92506001600160501b038416158062000534575082516001600160501b038086169116115b156200055057825162000549908690620008cb565b9150600190505b9250925092565b600062000564836200099b565b801562000577575062000577826200099b565b90505b92915050565b600062000590610e108362000f3a565b6200059c844262000f50565b119392505050565b602084015160009081620005b9868662000557565b8015620005e35750620005e18660400151886040015163ffffffff166200058060201b60201c565b155b8015620005fa5750620005f8868684620009eb565b155b90508015620007975760006200061e87602001518460ff1662000a8d60201b60201c565b60608901519091506001600160e01b0319161562000758576060880151604080516001600160e01b0319909216602083015260009182916001600160a01b038d16910160408051601f19818403018152908290526200067d9162000f66565b600060405180830381855afa9150503d8060008114620006ba576040519150601f19603f3d011682016040523d82523d6000602084013e620006bf565b606091505b509150915081620007135760405162461bcd60e51b815260206004820152601960248201527f5368617265207072696365206e6f7420617661696c61626c6500000000000000604482015260640162000142565b60808a01516200072590600a62001094565b818060200190518101906200073b9190620010a5565b620007479085620010bf565b620007539190620010d9565b925050505b8760a001516200077057620007708989600162000afe565b6200078c898289604001518a6000015162000b7a60201b60201c565b925062000811915050565b8660a0015115620007b057620007b08888600062000afe565b620007d6846020015163ffffffff16886040015163ffffffff166200058060201b60201c565b156200080157604051633beb416d60e11b81526001600160a01b038916600482015260240162000142565b505081516001600160601b031690505b95945050505050565b604080516080810182526000808252602082018190529181018290526060810191909152816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa9250505080156200089b575060408051601f3d908101601f19168201909252620008989181019062001114565b60015b620008a557919050565b506001600160501b0390931684525060208301526040820152600160608201525b919050565b6040805160808101825260008082526020820181905291810182905260608101919091526001600160501b038216156200057a57604051639a6fc8f560e01b81526001600160501b0360001984011660048201526001600160a01b03841690639a6fc8f59060240160a060405180830381865afa9250505080156200096f575060408051601f3d908101601f191682019092526200096c9181019062001114565b60015b156200057a57506001600160501b03909316845250602083015260408201526001606082015292915050565b600081606001518015620009b8575081516001600160501b031615155b8015620009c85750604082015115155b8015620009d9575042826040015111155b80156200057a57505060200151151590565b60008062000a0785602001518460ff1662000a8d60201b60201c565b9050600062000a2485602001518560ff1662000a8d60201b60201c565b9050600062000a34838362000c83565b9050600062000a44848462000c9b565b9050600081670de0b6b3a764000062000a5e858362000f50565b62000a6a9190620010bf565b62000a769190620010d9565b6706f05b59d3b20000109998505050505050505050565b60006012820362000aa05750816200057a565b601282101562000ad85762000ab782601262000f50565b62000ac490600a62001169565b62000ad09084620010bf565b90506200057a565b62000ae560128362000f50565b62000af290600a62001169565b62000ad09084620010d9565b6001600160a01b0383811660008181526020818152604091829020805460ff60f01b1916600160f01b8715159081029190911790915586518351948552909416908301528101919091527f027ca86d0a5e661ac88cfa6260082c9353c57cb9e7c95f72fb6cb28033432bd39060600160405180910390a1505050565b604080516080810182526001600160601b03808616825263ffffffff80861660208085019182524283168587019081526001600160501b03808916606088019081526001600160a01b038d16600081815260019095529389902097518854955193519151909216600160a01b02600160a01b600160f01b0319918716600160801b0291909116600160801b600160f01b0319939096166c01000000000000000000000000026001600160801b031990951691909616179290921791909116919091179190911790915590517f07529ee41a2aab62dbd5cc22c9f45bd6db300404e0a697d2e80349b69ca3087e9062000c759086815260200190565b60405180910390a250505050565b600081831062000c94578162000577565b5090919050565b60008183101562000c94578162000577565b80516001600160a01b0381168114620008c657600080fd5b634e487b7160e01b600052604160045260246000fd5b60405160c081016001600160401b038111828210171562000d005762000d0062000cc5565b60405290565b604051601f8201601f191681016001600160401b038111828210171562000d315762000d3162000cc5565b604052919050565b805160ff81168114620008c657600080fd5b80518015158114620008c657600080fd5b6000806000606080858703121562000d7357600080fd5b62000d7e8562000cad565b9350602062000d8f81870162000cad565b604087810151919550906001600160401b038082111562000daf57600080fd5b818901915089601f83011262000dc457600080fd5b81518181111562000dd95762000dd962000cc5565b62000de9858260051b0162000d06565b818152858101925060c091820284018601918c83111562000e0957600080fd5b938601935b8285101562000ec25780858e03121562000e285760008081fd5b62000e3262000cdb565b62000e3d8662000cad565b815262000e4c88870162000cad565b888201528686015163ffffffff8116811462000e685760008081fd5b81880152858901516001600160e01b03198116811462000e885760008081fd5b818a0152608062000e9b87820162000d39565b9082015260a062000eae87820162000d4b565b908201528452938401939286019262000e0e565b50809750505050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820162000f155762000f1562000eea565b5060010190565b60006020828403121562000f2f57600080fd5b620005778262000d39565b808201808211156200057a576200057a62000eea565b818103818111156200057a576200057a62000eea565b6000825160005b8181101562000f89576020818601810151858301520162000f6d565b506000920191825250919050565b600181815b8085111562000fd857816000190482111562000fbc5762000fbc62000eea565b8085161562000fca57918102915b93841c939080029062000f9c565b509250929050565b60008262000ff1575060016200057a565b8162001000575060006200057a565b8160018114620010195760028114620010245762001044565b60019150506200057a565b60ff84111562001038576200103862000eea565b50506001821b6200057a565b5060208310610133831016604e8410600b841016171562001069575081810a6200057a565b62001075838362000f97565b80600019048211156200108c576200108c62000eea565b029392505050565b60006200057760ff84168362000fe0565b600060208284031215620010b857600080fd5b5051919050565b80820281158282048414176200057a576200057a62000eea565b600082620010f757634e487b7160e01b600052601260045260246000fd5b500490565b80516001600160501b0381168114620008c657600080fd5b600080600080600060a086880312156200112d57600080fd5b6200113886620010fc565b94506020860151935060408601519250606086015191506200115d60808701620010fc565b90509295509295909350565b600062000577838362000fe0565b608051611593620011a860003960008181610270015281816102ab01528181610334015261064701526115936000f3fe608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b146101bd578063a2a870a9146101c5578063ace1798e14610258578063cc9641a81461026b578063ec6e407d1461029257600080fd5b80631be5c92f146100a357806325838f23146100be578063452a9320146100c757806358a6aa88146100e75780637cdde506146100f6575b600080fd5b6100ab601281565b6040519081526020015b60405180910390f35b6100ab610e1081565b6100cf6102a7565b6040516001600160a01b0390911681526020016100b5565b6100ab6706f05b59d3b2000081565b610162610104366004611237565b6000602081905290815260409020546001600160a01b0381169060ff600160a01b820481169163ffffffff600160a81b82041691600160c81b820460e01b91600160e81b8104821691600160f01b8204811691600160f81b90041687565b604080516001600160a01b03909816885260ff968716602089015263ffffffff909516948701949094526001600160e01b0319909216606086015292909216608084015290151560a0830152151560c082015260e0016100b5565b6100cf610330565b61021b6101d3366004611237565b6001602052600090815260409020546001600160601b0381169063ffffffff600160601b8204811691600160801b8104909116906001600160501b03600160a01b9091041684565b604080516001600160601b0395909516855263ffffffff938416602086015291909216908301526001600160501b031660608201526080016100b5565b6100ab610266366004611237565b610390565b6100cf7f000000000000000000000000000000000000000000000000000000000000000081565b6102a56102a0366004611263565b610645565b005b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663452a93206040518163ffffffff1660e01b8152600401602060405180830381865afa158015610307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032b9190611300565b905090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610307573d6000803e3d6000fd5b6001600160a01b03808216600081815260016020908152604080832081516080808201845291546001600160601b03808216835263ffffffff600160601b8304811684880152600160801b830481168487019081526001600160501b03600160a01b9485900416606080870191909152998952888852868920875160e08082018a5291549c8d16815260ff958d04861699810199909952600160a81b8c048316978901979097526001600160e01b0319600160c81b8c0490971b9690961698870198909852600160e81b8904821693860193909352600160f01b88048116151560a0860152600160f81b909704909616151560c08401528551915193959492939116911642146105fe57826040015163ffffffff166000036104d557604051638e7a3d6d60e01b81526001600160a01b03861660048201526024015b60405180910390fd5b60008060006104ec8560000151876060015161072a565b925092509250801561050c57610505888685858a61078a565b93506105fa565b61052a866020015163ffffffff16866040015163ffffffff166109c1565b1561055357604051633beb416d60e11b81526001600160a01b03891660048201526024016104cc565b63ffffffff42811660408089019182526001600160a01b038b1660009081526001602090815291902089518154928b0151935160608c01516001600160501b0316600160a01b0269ffffffffffffffffffff60a01b19918716600160801b0291909116600160801b600160f01b031995909616600160601b026001600160801b03199094166001600160601b03909216919091179290921792909216929092179190911790555b5050505b8160c001511561063d5760006106146000610390565b9050670de0b6b3a76400006106298383611333565b610633919061134a565b9695505050505050565b949350505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c79190611300565b6001600160a01b0316336001600160a01b0316146107145760405162461bcd60e51b815260206004820152600a60248201526927b7363c9037bbb732b960b11b60448201526064016104cc565b6107228686868686866109e3565b505050505050565b6107326111ec565b61073a6111ec565b600061074585610db1565b92506001600160501b0384161580610769575082516001600160501b038086169116115b156107835761077c858460000151610e42565b9150600190505b9250925092565b60208401516000908161079d8686610ef1565b80156107be57506107bc8660400151886040015163ffffffff166109c1565b155b80156107d257506107d0868684610f13565b155b9050801561094b5760006107ed87602001518460ff16610f9b565b60608901519091506001600160e01b03191615610918576060880151604080516001600160e01b0319909216602083015260009182916001600160a01b038d16910160408051601f19818403018152908290526108499161136c565b600060405180830381855afa9150503d8060008114610884576040519150601f19603f3d011682016040523d82523d6000602084013e610889565b606091505b5091509150816108db5760405162461bcd60e51b815260206004820152601960248201527f5368617265207072696365206e6f7420617661696c61626c650000000000000060448201526064016104cc565b60808a01516108eb90600a61147f565b818060200190518101906108ff919061148e565b6109099085611333565b610913919061134a565b925050505b8760a0015161092d5761092d89896001610ffc565b610941898289604001518a60000151611078565b92506109b8915050565b8660a00151156109615761096188886000610ffc565b61097f846020015163ffffffff16886040015163ffffffff166109c1565b156109a857604051633beb416d60e11b81526001600160a01b03891660048201526024016104cc565b505081516001600160601b031690505b95945050505050565b60006109cf610e10836114a7565b6109d984426114ba565b1190505b92915050565b620151808463ffffffff161115610a0d57604051632280d48b60e21b815260040160405180910390fd5b84600080610a1b838261072a565b5091509150610a2a8282610ef1565b610a52576040516312b2728d60e21b81526001600160a01b038a1660048201526024016104cc565b610a6682604001518863ffffffff166109c1565b15610a8f57604051633beb416d60e11b81526001600160a01b038a1660048201526024016104cc565b60006040518060e00160405280856001600160a01b03168152602001856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ae9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0d91906114cd565b60ff1681526020018963ffffffff168152602001886001600160e01b03191681526020018760ff1681526020016001151581526020018615158152509050806000808c6001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a81548160ff021916908360ff16021790555060408201518160000160156101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160196101000a81548163ffffffff021916908360e01c0217905550608082015181600001601d6101000a81548160ff021916908360ff16021790555060a082015181600001601e6101000a81548160ff02191690831515021790555060c082015181600001601f6101000a81548160ff0219169083151502179055509050506000600160008c6001600160a01b03166001600160a01b031681526020019081526020016000206040518060800160405290816000820160009054906101000a90046001600160601b03166001600160601b03166001600160601b0316815260200160008201600c9054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160109054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160149054906101000a90046001600160501b03166001600160501b03166001600160501b0316815250509050610d588b8386868561078a565b50604080516001600160a01b038d811682528c1660208201528715158183015290517f232f76b91cfa7f741ffa01f8740254f5f4cf520aa1119cc0bdfe8975ec8959969181900360600190a15050505050505050505050565b610db96111ec565b816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa925050508015610e13575060408051601f3d908101601f19168201909252610e1091810190611501565b60015b610e1c57919050565b506001600160501b0390931684525060208301526040820152600160608201525b919050565b610e4a6111ec565b6001600160501b038216156109dd57604051639a6fc8f560e01b81526001600160501b0360001984011660048201526001600160a01b03841690639a6fc8f59060240160a060405180830381865afa925050508015610ec6575060408051601f3d908101601f19168201909252610ec391810190611501565b60015b156109dd57506001600160501b03909316845250602083015260408201526001606082015292915050565b6000610efc8361117a565b8015610f0c5750610f0c8261117a565b9392505050565b600080610f2785602001518460ff16610f9b565b90506000610f3c85602001518560ff16610f9b565b90506000610f4a83836111c6565b90506000610f5884846111dc565b9050600081670de0b6b3a7640000610f7085836114ba565b610f7a9190611333565b610f84919061134a565b6706f05b59d3b20000109998505050505050505050565b600060128203610fac5750816109dd565b6012821015610fdc57610fc08260126114ba565b610fcb90600a611551565b610fd59084611333565b90506109dd565b610fe76012836114ba565b610ff290600a611551565b610fd5908461134a565b6001600160a01b0383811660008181526020818152604091829020805460ff60f01b1916600160f01b8715159081029190911790915586518351948552909416908301528101919091527f027ca86d0a5e661ac88cfa6260082c9353c57cb9e7c95f72fb6cb28033432bd39060600160405180910390a1505050565b604080516080810182526001600160601b03808616825263ffffffff80861660208085019182524283168587019081526001600160501b03808916606088019081526001600160a01b038d16600081815260019095529389902097518854955193519151909216600160a01b0269ffffffffffffffffffff60a01b19918716600160801b0291909116600160801b600160f01b031993909616600160601b026001600160801b031990951691909616179290921791909116919091179190911790915590517f07529ee41a2aab62dbd5cc22c9f45bd6db300404e0a697d2e80349b69ca3087e9061116c9086815260200190565b60405180910390a250505050565b600081606001518015611196575081516001600160501b031615155b80156111a55750604082015115155b80156111b5575042826040015111155b80156109dd57505060200151151590565b60008183106111d55781610f0c565b5090919050565b6000818310156111d55781610f0c565b604051806080016040528060006001600160501b0316815260200160008152602001600081526020016000151581525090565b6001600160a01b038116811461123457600080fd5b50565b60006020828403121561124957600080fd5b8135610f0c8161121f565b60ff8116811461123457600080fd5b60008060008060008060c0878903121561127c57600080fd5b86356112878161121f565b955060208701356112978161121f565b9450604087013563ffffffff811681146112b057600080fd5b935060608701356001600160e01b0319811681146112cd57600080fd5b925060808701356112dd81611254565b915060a087013580151581146112f257600080fd5b809150509295509295509295565b60006020828403121561131257600080fd5b8151610f0c8161121f565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109dd576109dd61131d565b60008261136757634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b8181101561138d5760208186018101518583015201611373565b506000920191825250919050565b600181815b808511156113d65781600019048211156113bc576113bc61131d565b808516156113c957918102915b93841c93908002906113a0565b509250929050565b6000826113ed575060016109dd565b816113fa575060006109dd565b8160018114611410576002811461141a57611436565b60019150506109dd565b60ff84111561142b5761142b61131d565b50506001821b6109dd565b5060208310610133831016604e8410600b8410161715611459575081810a6109dd565b611463838361139b565b80600019048211156114775761147761131d565b029392505050565b6000610f0c60ff8416836113de565b6000602082840312156114a057600080fd5b5051919050565b808201808211156109dd576109dd61131d565b818103818111156109dd576109dd61131d565b6000602082840312156114df57600080fd5b8151610f0c81611254565b80516001600160501b0381168114610e3d57600080fd5b600080600080600060a0868803121561151957600080fd5b611522866114ea565b9450602086015193506040860151925060608601519150611545608087016114ea565b90509295509295909350565b6000610f0c83836113de56fea264697066735822122004df91b68548f7ab02277736b055bd2eda1e51f907dae4a2bcbfc8e18a74bed664736f6c634300081300330000000000000000000000005d17ea085f2ff5da3e6979d5d26f1dbab664ccf80000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000040000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0000000000000000000000000cfe54b5cd566ab89272946f602d76ea879cab4a80000000000000000000000000000000000000000000000000000000000000e10035faf820000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ae78736cd615f374d3085123a210448e74fc6393000000000000000000000000536218f9e9eb48863970252233c8f271f554c2d00000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000be9895146f7af43049ca1c1ae358b0541ea49704000000000000000000000000f017fcb346a1885194689ba23eff2fe6fa5c483b0000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000ac3e018457b222d93114458476f3e3416abbe38f000000000000000000000000b9af7723cfbd4469a7e8aa60b93428d648bda99d0000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80638da5cb5b116100665780638da5cb5b146101bd578063a2a870a9146101c5578063ace1798e14610258578063cc9641a81461026b578063ec6e407d1461029257600080fd5b80631be5c92f146100a357806325838f23146100be578063452a9320146100c757806358a6aa88146100e75780637cdde506146100f6575b600080fd5b6100ab601281565b6040519081526020015b60405180910390f35b6100ab610e1081565b6100cf6102a7565b6040516001600160a01b0390911681526020016100b5565b6100ab6706f05b59d3b2000081565b610162610104366004611237565b6000602081905290815260409020546001600160a01b0381169060ff600160a01b820481169163ffffffff600160a81b82041691600160c81b820460e01b91600160e81b8104821691600160f01b8204811691600160f81b90041687565b604080516001600160a01b03909816885260ff968716602089015263ffffffff909516948701949094526001600160e01b0319909216606086015292909216608084015290151560a0830152151560c082015260e0016100b5565b6100cf610330565b61021b6101d3366004611237565b6001602052600090815260409020546001600160601b0381169063ffffffff600160601b8204811691600160801b8104909116906001600160501b03600160a01b9091041684565b604080516001600160601b0395909516855263ffffffff938416602086015291909216908301526001600160501b031660608201526080016100b5565b6100ab610266366004611237565b610390565b6100cf7f0000000000000000000000005d17ea085f2ff5da3e6979d5d26f1dbab664ccf881565b6102a56102a0366004611263565b610645565b005b60007f0000000000000000000000005d17ea085f2ff5da3e6979d5d26f1dbab664ccf86001600160a01b031663452a93206040518163ffffffff1660e01b8152600401602060405180830381865afa158015610307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032b9190611300565b905090565b60007f0000000000000000000000005d17ea085f2ff5da3e6979d5d26f1dbab664ccf86001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610307573d6000803e3d6000fd5b6001600160a01b03808216600081815260016020908152604080832081516080808201845291546001600160601b03808216835263ffffffff600160601b8304811684880152600160801b830481168487019081526001600160501b03600160a01b9485900416606080870191909152998952888852868920875160e08082018a5291549c8d16815260ff958d04861699810199909952600160a81b8c048316978901979097526001600160e01b0319600160c81b8c0490971b9690961698870198909852600160e81b8904821693860193909352600160f01b88048116151560a0860152600160f81b909704909616151560c08401528551915193959492939116911642146105fe57826040015163ffffffff166000036104d557604051638e7a3d6d60e01b81526001600160a01b03861660048201526024015b60405180910390fd5b60008060006104ec8560000151876060015161072a565b925092509250801561050c57610505888685858a61078a565b93506105fa565b61052a866020015163ffffffff16866040015163ffffffff166109c1565b1561055357604051633beb416d60e11b81526001600160a01b03891660048201526024016104cc565b63ffffffff42811660408089019182526001600160a01b038b1660009081526001602090815291902089518154928b0151935160608c01516001600160501b0316600160a01b0269ffffffffffffffffffff60a01b19918716600160801b0291909116600160801b600160f01b031995909616600160601b026001600160801b03199094166001600160601b03909216919091179290921792909216929092179190911790555b5050505b8160c001511561063d5760006106146000610390565b9050670de0b6b3a76400006106298383611333565b610633919061134a565b9695505050505050565b949350505050565b7f0000000000000000000000005d17ea085f2ff5da3e6979d5d26f1dbab664ccf86001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c79190611300565b6001600160a01b0316336001600160a01b0316146107145760405162461bcd60e51b815260206004820152600a60248201526927b7363c9037bbb732b960b11b60448201526064016104cc565b6107228686868686866109e3565b505050505050565b6107326111ec565b61073a6111ec565b600061074585610db1565b92506001600160501b0384161580610769575082516001600160501b038086169116115b156107835761077c858460000151610e42565b9150600190505b9250925092565b60208401516000908161079d8686610ef1565b80156107be57506107bc8660400151886040015163ffffffff166109c1565b155b80156107d257506107d0868684610f13565b155b9050801561094b5760006107ed87602001518460ff16610f9b565b60608901519091506001600160e01b03191615610918576060880151604080516001600160e01b0319909216602083015260009182916001600160a01b038d16910160408051601f19818403018152908290526108499161136c565b600060405180830381855afa9150503d8060008114610884576040519150601f19603f3d011682016040523d82523d6000602084013e610889565b606091505b5091509150816108db5760405162461bcd60e51b815260206004820152601960248201527f5368617265207072696365206e6f7420617661696c61626c650000000000000060448201526064016104cc565b60808a01516108eb90600a61147f565b818060200190518101906108ff919061148e565b6109099085611333565b610913919061134a565b925050505b8760a0015161092d5761092d89896001610ffc565b610941898289604001518a60000151611078565b92506109b8915050565b8660a00151156109615761096188886000610ffc565b61097f846020015163ffffffff16886040015163ffffffff166109c1565b156109a857604051633beb416d60e11b81526001600160a01b03891660048201526024016104cc565b505081516001600160601b031690505b95945050505050565b60006109cf610e10836114a7565b6109d984426114ba565b1190505b92915050565b620151808463ffffffff161115610a0d57604051632280d48b60e21b815260040160405180910390fd5b84600080610a1b838261072a565b5091509150610a2a8282610ef1565b610a52576040516312b2728d60e21b81526001600160a01b038a1660048201526024016104cc565b610a6682604001518863ffffffff166109c1565b15610a8f57604051633beb416d60e11b81526001600160a01b038a1660048201526024016104cc565b60006040518060e00160405280856001600160a01b03168152602001856001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ae9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0d91906114cd565b60ff1681526020018963ffffffff168152602001886001600160e01b03191681526020018760ff1681526020016001151581526020018615158152509050806000808c6001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160000160146101000a81548160ff021916908360ff16021790555060408201518160000160156101000a81548163ffffffff021916908363ffffffff16021790555060608201518160000160196101000a81548163ffffffff021916908360e01c0217905550608082015181600001601d6101000a81548160ff021916908360ff16021790555060a082015181600001601e6101000a81548160ff02191690831515021790555060c082015181600001601f6101000a81548160ff0219169083151502179055509050506000600160008c6001600160a01b03166001600160a01b031681526020019081526020016000206040518060800160405290816000820160009054906101000a90046001600160601b03166001600160601b03166001600160601b0316815260200160008201600c9054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160109054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160149054906101000a90046001600160501b03166001600160501b03166001600160501b0316815250509050610d588b8386868561078a565b50604080516001600160a01b038d811682528c1660208201528715158183015290517f232f76b91cfa7f741ffa01f8740254f5f4cf520aa1119cc0bdfe8975ec8959969181900360600190a15050505050505050505050565b610db96111ec565b816001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa925050508015610e13575060408051601f3d908101601f19168201909252610e1091810190611501565b60015b610e1c57919050565b506001600160501b0390931684525060208301526040820152600160608201525b919050565b610e4a6111ec565b6001600160501b038216156109dd57604051639a6fc8f560e01b81526001600160501b0360001984011660048201526001600160a01b03841690639a6fc8f59060240160a060405180830381865afa925050508015610ec6575060408051601f3d908101601f19168201909252610ec391810190611501565b60015b156109dd57506001600160501b03909316845250602083015260408201526001606082015292915050565b6000610efc8361117a565b8015610f0c5750610f0c8261117a565b9392505050565b600080610f2785602001518460ff16610f9b565b90506000610f3c85602001518560ff16610f9b565b90506000610f4a83836111c6565b90506000610f5884846111dc565b9050600081670de0b6b3a7640000610f7085836114ba565b610f7a9190611333565b610f84919061134a565b6706f05b59d3b20000109998505050505050505050565b600060128203610fac5750816109dd565b6012821015610fdc57610fc08260126114ba565b610fcb90600a611551565b610fd59084611333565b90506109dd565b610fe76012836114ba565b610ff290600a611551565b610fd5908461134a565b6001600160a01b0383811660008181526020818152604091829020805460ff60f01b1916600160f01b8715159081029190911790915586518351948552909416908301528101919091527f027ca86d0a5e661ac88cfa6260082c9353c57cb9e7c95f72fb6cb28033432bd39060600160405180910390a1505050565b604080516080810182526001600160601b03808616825263ffffffff80861660208085019182524283168587019081526001600160501b03808916606088019081526001600160a01b038d16600081815260019095529389902097518854955193519151909216600160a01b0269ffffffffffffffffffff60a01b19918716600160801b0291909116600160801b600160f01b031993909616600160601b026001600160801b031990951691909616179290921791909116919091179190911790915590517f07529ee41a2aab62dbd5cc22c9f45bd6db300404e0a697d2e80349b69ca3087e9061116c9086815260200190565b60405180910390a250505050565b600081606001518015611196575081516001600160501b031615155b80156111a55750604082015115155b80156111b5575042826040015111155b80156109dd57505060200151151590565b60008183106111d55781610f0c565b5090919050565b6000818310156111d55781610f0c565b604051806080016040528060006001600160501b0316815260200160008152602001600081526020016000151581525090565b6001600160a01b038116811461123457600080fd5b50565b60006020828403121561124957600080fd5b8135610f0c8161121f565b60ff8116811461123457600080fd5b60008060008060008060c0878903121561127c57600080fd5b86356112878161121f565b955060208701356112978161121f565b9450604087013563ffffffff811681146112b057600080fd5b935060608701356001600160e01b0319811681146112cd57600080fd5b925060808701356112dd81611254565b915060a087013580151581146112f257600080fd5b809150509295509295509295565b60006020828403121561131257600080fd5b8151610f0c8161121f565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176109dd576109dd61131d565b60008261136757634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b8181101561138d5760208186018101518583015201611373565b506000920191825250919050565b600181815b808511156113d65781600019048211156113bc576113bc61131d565b808516156113c957918102915b93841c93908002906113a0565b509250929050565b6000826113ed575060016109dd565b816113fa575060006109dd565b8160018114611410576002811461141a57611436565b60019150506109dd565b60ff84111561142b5761142b61131d565b50506001821b6109dd565b5060208310610133831016604e8410600b8410161715611459575081810a6109dd565b611463838361139b565b80600019048211156114775761147761131d565b029392505050565b6000610f0c60ff8416836113de565b6000602082840312156114a057600080fd5b5051919050565b808201808211156109dd576109dd61131d565b818103818111156109dd576109dd61131d565b6000602082840312156114df57600080fd5b8151610f0c81611254565b80516001600160501b0381168114610e3d57600080fd5b600080600080600060a0868803121561151957600080fd5b611522866114ea565b9450602086015193506040860151925060608601519150611545608087016114ea565b90509295509295909350565b6000610f0c83836113de56fea264697066735822122004df91b68548f7ab02277736b055bd2eda1e51f907dae4a2bcbfc8e18a74bed664736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005d17ea085f2ff5da3e6979d5d26f1dbab664ccf80000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000040000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0000000000000000000000000cfe54b5cd566ab89272946f602d76ea879cab4a80000000000000000000000000000000000000000000000000000000000000e10035faf820000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ae78736cd615f374d3085123a210448e74fc6393000000000000000000000000536218f9e9eb48863970252233c8f271f554c2d00000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000be9895146f7af43049ca1c1ae358b0541ea49704000000000000000000000000f017fcb346a1885194689ba23eff2fe6fa5c483b0000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000ac3e018457b222d93114458476f3e3416abbe38f000000000000000000000000b9af7723cfbd4469a7e8aa60b93428d648bda99d0000000000000000000000000000000000000000000000000000000000015180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : _prismaCore (address): 0x5d17eA085F2FF5da3e6979D5d26F1dBaB664ccf8
Arg [1] : ethFeed (address): 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
Arg [2] : oracles (tuple[]): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput],System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput],System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput],System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
-----Encoded View---------------
28 Constructor Arguments found :
Arg [0] : 0000000000000000000000005d17ea085f2ff5da3e6979d5d26f1dbab664ccf8
Arg [1] : 0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [4] : 0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0
Arg [5] : 000000000000000000000000cfe54b5cd566ab89272946f602d76ea879cab4a8
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000e10
Arg [7] : 035faf8200000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000012
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 000000000000000000000000ae78736cd615f374d3085123a210448e74fc6393
Arg [11] : 000000000000000000000000536218f9e9eb48863970252233c8f271f554c2d0
Arg [12] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [16] : 000000000000000000000000be9895146f7af43049ca1c1ae358b0541ea49704
Arg [17] : 000000000000000000000000f017fcb346a1885194689ba23eff2fe6fa5c483b
Arg [18] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [19] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [20] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [21] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [22] : 000000000000000000000000ac3e018457b222d93114458476f3e3416abbe38f
Arg [23] : 000000000000000000000000b9af7723cfbd4469a7e8aa60b93428d648bda99d
Arg [24] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [25] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [26] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [27] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.