Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
RWAOracleExternalComparisonCheck
Compiler Version
v0.8.16+commit.07a7930e
Contract Source Code (Solidity Standard Json-Input format)
/**SPDX-License-Identifier: BUSL-1.1 ▄▄█████████▄ ╓██▀└ ,╓▄▄▄, '▀██▄ ██▀ ▄██▀▀╙╙▀▀██▄ └██µ ,, ,, , ,,, ,,, ██ ,██¬ ▄████▄ ▀█▄ ╙█▄ ▄███▀▀███▄ ███▄ ██ ███▀▀▀███▄ ▄███▀▀███, ██ ██ ╒█▀' ╙█▌ ╙█▌ ██ ▐██ ███ █████, ██ ██▌ └██▌ ██▌ └██▌ ██ ▐█▌ ██ ╟█ █▌ ╟█ ██▌ ▐██ ██ └███ ██ ██▌ ╟██ j██ ╟██ ╟█ ██ ╙██ ▄█▀ ▐█▌ ██ ╙██ ██▌ ██ ╙████ ██▌ ▄██▀ ██▌ ,██▀ ██ "██, ╙▀▀███████████⌐ ╙████████▀ ██ ╙██ ███████▀▀ ╙███████▀` ██▄ ╙▀██▄▄▄▄▄,,, ¬─ '─¬ ╙▀██▄ '╙╙╙▀▀▀▀▀▀▀▀ ╙▀▀██████R⌐ */ pragma solidity 0.8.16; import "contracts/lending/chainlink/AggregatorV3Interface.sol"; import "contracts/lending/rwaOracles/IRWAOracleExternalComparisonCheck.sol"; import "contracts/cash/external/openzeppelin/contracts/access/AccessControlEnumerable.sol"; contract RWAOracleExternalComparisonCheck is IRWAOracleExternalComparisonCheck, AccessControlEnumerable { /// @notice Helper struct for storing SHV data from Chainlink struct ChainlinkRoundData { uint80 roundId; int256 answer; uint256 startedAt; uint256 updatedAt; uint80 answeredInRound; } // Price of RWA token (OUSG, OSTB, OHYG, etc.) int256 public rwaPrice; // Timestamp in which the RWA token price was last set uint256 public priceTimestamp; // The associated Chainlink price update associated with the stored // `rwaPrice` ChainlinkRoundData public lastSetRound; // Chainlink oracle whose tracked instrument is used to constrain price updates. AggregatorV3Interface public immutable chainlinkOracle; // Description of oracle set in Constructor string public description; // How recent a Chainlink update needs to be in order to be associated to // a RWA price change. uint256 public constant MAX_CL_WINDOW = 25 hours; // Helper constant that allows us to specify basis points in calculations int256 public constant BPS_DENOMINATOR = 10_000; // Amount of bps that the RWA price can differ from the SHV change. For // example, if SHV changes by 1% in between RWA price updates, // RWA token can change between .26% and 1.74% uint256 public constant MAX_CHANGE_DIFF_BPS = 74; // Max amount of bps that RWA price in a single price update. uint256 public constant MAX_ABSOLUTE_DIFF_BPS = 200; // Minimum time between price updates uint256 public constant MIN_PRICE_UPDATE_WINDOW = 23 hours; /// @notice How many decimals `rwaPrice` is represented in /// @dev UNUSED AND UNENFORCED - This is present only for operational /// clarity. uint256 public constant decimals = 18; // Role that can set RWA price bytes32 public constant SETTER_ROLE = keccak256("SETTER_ROLE"); /** * @notice constructor * * @param _initialPrice The initial RWA price * @param _chainlinkOracle Chainlink oracle to compare differences with * @param _description Human readable description * @param _admin admin which holds the DEFAULT_ADMIN_ROLE * @param _setter setter address which holds the role to set rwa price */ constructor( int256 _initialPrice, address _chainlinkOracle, string memory _description, address _admin, address _setter ) { if (_admin == address(0) || _setter == address(0)) { revert InvalidAddress(); } chainlinkOracle = AggregatorV3Interface(_chainlinkOracle); // Revert if Chainlink oracle is not reporting 8 decimals if (chainlinkOracle.decimals() != 8) { revert CorruptedChainlinkResponse(); } ChainlinkRoundData memory round = _getLatestChainlinkRoundData(); if (block.timestamp > round.updatedAt + MAX_CL_WINDOW) { revert ChainlinkOraclePriceStale(); } description = _description; rwaPrice = _initialPrice; priceTimestamp = block.timestamp; lastSetRound = round; _grantRole(DEFAULT_ADMIN_ROLE, _admin); _grantRole(SETTER_ROLE, _setter); } /** * @notice Retrieve the last set RWA price data * * @dev `price` is in 18 decimals, `timestamp` is unix seconds since epoch */ function getPriceData() external view override returns (uint256 price, uint256 timestamp) { price = uint256(rwaPrice); timestamp = priceTimestamp; } /** * @notice Sets the price of RWA if all the following criteria are met: * - It is able to pull a consistent and recent Chainlink price that is * different than the last used Chainlink round * - The price wasn't updated too recently (`MIN_PRICE_UPDATE_WINDOW` * seconds) * - The change in RWA price is < MAX_ABSOLUTE_DIFF_BPS * - The change in RWA price has not deviated `MAX_CHANGE_DIFF_BPS` more * than the change in the Chainlink price. * If the change in Chainlink price is larger than `MAX_ABSOLUTE_DIFF_BPS + * MAX_CHANGE_DIFF_BPS` it is deemed malfunctioning and ignored. * * @param newPrice The new price of some RWA token (In `decimals` decimals) * * @dev The decimal representation is not enforced yet must be respected by * the caller of this function and deployer of this contract */ function setPrice(int256 newPrice) external override onlyRole(SETTER_ROLE) { // RWA price must be greater than zero if (newPrice <= 0) { revert InvalidRWAPrice(); } ChainlinkRoundData memory round = _getLatestChainlinkRoundData(); // Chainlink price update must be recent if (block.timestamp > round.updatedAt + MAX_CL_WINDOW) { revert ChainlinkOraclePriceStale(); } // Chainlink price update must not be comparing the same rounds against // eachother if (round.roundId == lastSetRound.roundId) { revert ChainlinkRoundNotUpdated(); } // Ensure at least `MIN_PRICE_UPDATE_WINDOW` seconds have passed since // last RWA price update if (block.timestamp < priceTimestamp + MIN_PRICE_UPDATE_WINDOW) { revert PriceUpdateWindowViolation(); } int256 rwaPriceChangeBps = _getPriceChangeBps(rwaPrice, newPrice); // Never allow a price change that violates the max absolute change // threshold. if (_abs_unsigned(rwaPriceChangeBps) > MAX_ABSOLUTE_DIFF_BPS) { revert AbsoluteDifferenceConstraintViolated(); } int256 chainlinkPriceChangeBps = _getPriceChangeBps( lastSetRound.answer, round.answer ); if ( _abs_unsigned(chainlinkPriceChangeBps) <= MAX_ABSOLUTE_DIFF_BPS + MAX_CHANGE_DIFF_BPS ) { // Chainlink price change is sane, so we compare rwa price changes // against the Chainlink price changes. uint256 changeDifferenceBps = _abs_unsigned( rwaPriceChangeBps - chainlinkPriceChangeBps ); if (changeDifferenceBps > MAX_CHANGE_DIFF_BPS) { revert DeltaDifferenceConstraintViolation(); } } else { emit ChainlinkPriceIgnored( lastSetRound.answer, lastSetRound.roundId, round.answer, round.roundId ); } emit RWAExternalComparisonCheckPriceSet( lastSetRound.answer, lastSetRound.roundId, round.answer, round.roundId, rwaPrice, newPrice ); rwaPrice = newPrice; priceTimestamp = block.timestamp; lastSetRound = round; } /** * @notice Retrieve latest Chainlink data * * @dev Reverts if any corruption is detected in Chainlink response */ function _getLatestChainlinkRoundData() private view returns (ChainlinkRoundData memory round) { ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) = chainlinkOracle.latestRoundData(); if ( answer < 0 || roundId != answeredInRound || roundId == 0 || updatedAt == 0 || updatedAt > block.timestamp ) { revert CorruptedChainlinkResponse(); } round = ChainlinkRoundData( roundId, answer, startedAt, updatedAt, answeredInRound ); } /** * @notice Compute the price change in basis point * * @param previousPrice Previous price * @param newPrice New price * * @dev The price change can be negative. */ function _getPriceChangeBps( int256 previousPrice, int256 newPrice ) private pure returns (int256 changeBps) { int256 change = newPrice - previousPrice; changeBps = (change * BPS_DENOMINATOR) / previousPrice; } /** * @notice returns the absolute value of the input. * * @param x the number to return absolute value of. */ function _abs_unsigned(int256 x) private pure returns (uint256) { return x >= 0 ? uint256(x) : uint256(-x); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "contracts/cash/external/openzeppelin/contracts/access/IAccessControl.sol"; import "contracts/cash/external/openzeppelin/contracts/utils/Context.sol"; import "contracts/cash/external/openzeppelin/contracts/utils/Strings.sol"; import "contracts/cash/external/openzeppelin/contracts/utils/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require( account == _msgSender(), "AccessControl: can only renounce roles for self" ); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "contracts/cash/external/openzeppelin/contracts/access/IAccessControlEnumerable.sol"; import "contracts/cash/external/openzeppelin/contracts/access/AccessControl.sol"; import "contracts/cash/external/openzeppelin/contracts/utils/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged( bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole ); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted( bytes32 indexed role, address indexed account, address indexed sender ); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked( bytes32 indexed role, address indexed account, address indexed sender ); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "contracts/cash/external/openzeppelin/contracts/access/IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "contracts/cash/external/openzeppelin/contracts/utils/IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); 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: BUSL-1.1 ▄▄█████████▄ ╓██▀└ ,╓▄▄▄, '▀██▄ ██▀ ▄██▀▀╙╙▀▀██▄ └██µ ,, ,, , ,,, ,,, ██ ,██¬ ▄████▄ ▀█▄ ╙█▄ ▄███▀▀███▄ ███▄ ██ ███▀▀▀███▄ ▄███▀▀███, ██ ██ ╒█▀' ╙█▌ ╙█▌ ██ ▐██ ███ █████, ██ ██▌ └██▌ ██▌ └██▌ ██ ▐█▌ ██ ╟█ █▌ ╟█ ██▌ ▐██ ██ └███ ██ ██▌ ╟██ j██ ╟██ ╟█ ██ ╙██ ▄█▀ ▐█▌ ██ ╙██ ██▌ ██ ╙████ ██▌ ▄██▀ ██▌ ,██▀ ██ "██, ╙▀▀███████████⌐ ╙████████▀ ██ ╙██ ███████▀▀ ╙███████▀` ██▄ ╙▀██▄▄▄▄▄,,, ¬─ '─¬ ╙▀██▄ '╙╙╙▀▀▀▀▀▀▀▀ ╙▀▀██████R⌐ */ pragma solidity 0.8.16; interface IRWAOracle { /// @notice Retrieve RWA price data function getPriceData() external view returns (uint256 price, uint256 timestamp); }
/**SPDX-License-Identifier: BUSL-1.1 ▄▄█████████▄ ╓██▀└ ,╓▄▄▄, '▀██▄ ██▀ ▄██▀▀╙╙▀▀██▄ └██µ ,, ,, , ,,, ,,, ██ ,██¬ ▄████▄ ▀█▄ ╙█▄ ▄███▀▀███▄ ███▄ ██ ███▀▀▀███▄ ▄███▀▀███, ██ ██ ╒█▀' ╙█▌ ╙█▌ ██ ▐██ ███ █████, ██ ██▌ └██▌ ██▌ └██▌ ██ ▐█▌ ██ ╟█ █▌ ╟█ ██▌ ▐██ ██ └███ ██ ██▌ ╟██ j██ ╟██ ╟█ ██ ╙██ ▄█▀ ▐█▌ ██ ╙██ ██▌ ██ ╙████ ██▌ ▄██▀ ██▌ ,██▀ ██ "██, ╙▀▀███████████⌐ ╙████████▀ ██ ╙██ ███████▀▀ ╙███████▀` ██▄ ╙▀██▄▄▄▄▄,,, ¬─ '─¬ ╙▀██▄ '╙╙╙▀▀▀▀▀▀▀▀ ╙▀▀██████R⌐ */ pragma solidity 0.8.16; import "contracts/lending/rwaOracles/IRWAOracle.sol"; interface IRWAOracleExternalComparisonCheck is IRWAOracle { /// @notice Set the RWA price function setPrice(int256 newPrice) external; /// EVENTS /// /** * @dev Event for when the price is set nominally * * @param oldChainlinkPrice Old Chainlink price * @param oldRoundId Chainlink round ID of old price * @param newChainlinkPrice New Chainlink price * @param newRoundId Chainlink round ID of old price * @param oldRWAPrice Old RWA price * @param newRWAPrice New RWA price */ event RWAExternalComparisonCheckPriceSet( int256 oldChainlinkPrice, uint80 indexed oldRoundId, int256 newChainlinkPrice, uint80 indexed newRoundId, int256 oldRWAPrice, int256 newRWAPrice ); /** * @dev Event for when the Chainlink price is out of reasonable bounds is * is ignored * * @param oldChainlinkPrice Old Chainlink price * @param oldRoundId Chainlink round ID of old price * @param newChainlinkPrice New Chainlink price * @param newRoundId Chainlink round ID of old price */ event ChainlinkPriceIgnored( int256 oldChainlinkPrice, uint80 indexed oldRoundId, int256 newChainlinkPrice, uint80 indexed newRoundId ); /// ERRORS /// error CorruptedChainlinkResponse(); error ChainlinkOraclePriceStale(); error DeltaDifferenceConstraintViolation(); error AbsoluteDifferenceConstraintViolated(); error PriceUpdateWindowViolation(); error InvalidRWAPrice(); error ChainlinkRoundNotUpdated(); error InvalidAddress(); }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 100 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"int256","name":"_initialPrice","type":"int256"},{"internalType":"address","name":"_chainlinkOracle","type":"address"},{"internalType":"string","name":"_description","type":"string"},{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_setter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AbsoluteDifferenceConstraintViolated","type":"error"},{"inputs":[],"name":"ChainlinkOraclePriceStale","type":"error"},{"inputs":[],"name":"ChainlinkRoundNotUpdated","type":"error"},{"inputs":[],"name":"CorruptedChainlinkResponse","type":"error"},{"inputs":[],"name":"DeltaDifferenceConstraintViolation","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidRWAPrice","type":"error"},{"inputs":[],"name":"PriceUpdateWindowViolation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int256","name":"oldChainlinkPrice","type":"int256"},{"indexed":true,"internalType":"uint80","name":"oldRoundId","type":"uint80"},{"indexed":false,"internalType":"int256","name":"newChainlinkPrice","type":"int256"},{"indexed":true,"internalType":"uint80","name":"newRoundId","type":"uint80"}],"name":"ChainlinkPriceIgnored","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int256","name":"oldChainlinkPrice","type":"int256"},{"indexed":true,"internalType":"uint80","name":"oldRoundId","type":"uint80"},{"indexed":false,"internalType":"int256","name":"newChainlinkPrice","type":"int256"},{"indexed":true,"internalType":"uint80","name":"newRoundId","type":"uint80"},{"indexed":false,"internalType":"int256","name":"oldRWAPrice","type":"int256"},{"indexed":false,"internalType":"int256","name":"newRWAPrice","type":"int256"}],"name":"RWAExternalComparisonCheckPriceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"BPS_DENOMINATOR","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ABSOLUTE_DIFF_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_CHANGE_DIFF_BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_CL_WINDOW","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_PRICE_UPDATE_WINDOW","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkOracle","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPriceData","outputs":[{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastSetRound","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rwaPrice","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"newPrice","type":"int256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b5060405162001aeb38038062001aeb8339810160408190526200003491620004d9565b6001600160a01b03821615806200005257506001600160a01b038116155b15620000715760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03841660808190526040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa158015620000bc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000e29190620005f0565b60ff16600814620001065760405163645e584160e01b815260040160405180910390fd5b600062000112620001f2565b905062015f9081606001516200012991906200061c565b4211156200014a576040516373a3618160e11b815260040160405180910390fd5b6009620001588582620006cc565b506002869055426003558051600480546001600160501b039283166001600160501b031991821617909155602083015160055560408301516006556060830151600755608083015160088054919093169116179055620001ba60008462000350565b620001e67f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda8362000350565b505050505050620007f9565b620002376040518060a0016040528060006001600160501b0316815260200160008152602001600081526020016000815260200160006001600160501b031681525090565b60008060008060006080516001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa15801562000280573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002a69190620007b0565b945094509450945094506000841280620002d25750806001600160501b0316856001600160501b031614155b80620002e557506001600160501b038516155b80620002ef575081155b80620002fa57504282115b15620003195760405163645e584160e01b815260040160405180910390fd5b6040805160a0810182526001600160501b039687168152602081019590955284019290925260608301529091166080820152919050565b6200036782826200039360201b620008091760201c565b60008281526001602090815260409091206200038e9183906200088d62000434821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000430576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620003ef3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b60006200044b836001600160a01b03841662000454565b90505b92915050565b60008181526001830160205260408120546200049d575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200044e565b5060006200044e565b80516001600160a01b0381168114620004be57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a08688031215620004f257600080fd5b85519450602062000505818801620004a6565b60408801519095506001600160401b03808211156200052357600080fd5b818901915089601f8301126200053857600080fd5b8151818111156200054d576200054d620004c3565b604051601f8201601f19908116603f01168101908382118183101715620005785762000578620004c3565b816040528281528c868487010111156200059157600080fd5b600093505b82841015620005b5578484018601518185018701529285019262000596565b6000868483010152809850505050505050620005d460608701620004a6565b9150620005e460808701620004a6565b90509295509295909350565b6000602082840312156200060357600080fd5b815160ff811681146200061557600080fd5b9392505050565b808201808211156200044e57634e487b7160e01b600052601160045260246000fd5b600181811c908216806200065357607f821691505b6020821081036200067457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200038e57600081815260208120601f850160051c81016020861015620006a35750805b601f850160051c820191505b81811015620006c457828155600101620006af565b505050505050565b81516001600160401b03811115620006e857620006e8620004c3565b6200070081620006f984546200063e565b846200067a565b602080601f8311600181146200073857600084156200071f5750858301515b600019600386901b1c1916600185901b178555620006c4565b600085815260208120601f198616915b82811015620007695788860151825594840194600190910190840162000748565b5085821015620007885787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b80516001600160501b0381168114620004be57600080fd5b600080600080600060a08688031215620007c957600080fd5b620007d48662000798565b9450602086015193506040860151925060608601519150620005e46080870162000798565b6080516112cf6200081c6000396000818161032801526109e301526112cf6000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c8063961d899c116100c3578063d547741f1161007c578063d547741f14610307578063e1a452181461031a578063ef06e72c14610323578063f7a308061461034a578063f83f2b4d1461035d578063fff641511461036757600080fd5b8063961d899c14610298578063a2011b3f146102a1578063a217fddf146102c8578063a4a28168146102d0578063b59754bc146102eb578063ca15c873146102f457600080fd5b806336568abe1161011557806336568abe146101d057806359643fc0146101e35780637284e416146101eb5780637a533efe146102005780639010d07c1461025a57806391d148541461028557600080fd5b806301ffc9a714610152578063248a9ca31461017a5780632bedabf7146101ab5780632f2ff15d146101b3578063313ce567146101c8575b600080fd5b610165610160366004610edb565b610371565b60405190151581526020015b60405180910390f35b61019d610188366004610f05565b60009081526020819052604090206001015490565b604051908152602001610171565b61019d60c881565b6101c66101c1366004610f1e565b61039c565b005b61019d601281565b6101c66101de366004610f1e565b6103c7565b61019d604a81565b6101f361044a565b6040516101719190610f7e565b600454600554600654600754600854610226946001600160501b03908116949392911685565b604080516001600160501b03968716815260208101959095528401929092526060830152909116608082015260a001610171565b61026d610268366004610fb1565b6104d8565b6040516001600160a01b039091168152602001610171565b610165610293366004610f1e565b6104f7565b61019d60025481565b61019d7f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda81565b61019d600081565b60025460035460408051928352602083019190915201610171565b61019d60035481565b61019d610302366004610f05565b610520565b6101c6610315366004610f1e565b610537565b61019d61271081565b61026d7f000000000000000000000000000000000000000000000000000000000000000081565b6101c6610358366004610f05565b61055d565b61019d62015f9081565b61019d6201437081565b60006001600160e01b03198216635a05180f60e01b14806103965750610396826108a2565b92915050565b6000828152602081905260409020600101546103b881336108d7565b6103c2838361093b565b505050565b6001600160a01b038116331461043c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610446828261095d565b5050565b6009805461045790610fd3565b80601f016020809104026020016040519081016040528092919081815260200182805461048390610fd3565b80156104d05780601f106104a5576101008083540402835291602001916104d0565b820191906000526020600020905b8154815290600101906020018083116104b357829003601f168201915b505050505081565b60008281526001602052604081206104f0908361097f565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008181526001602052604081206103969061098b565b60008281526020819052604090206001015461055381336108d7565b6103c2838361095d565b7f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda61058881336108d7565b600082136105a9576040516330a7c22160e11b815260040160405180910390fd5b60006105b3610995565b905062015f9081606001516105c89190611023565b4211156105e8576040516373a3618160e11b815260040160405180910390fd5b60045481516001600160501b039182169116036106185760405163061b3c8360e31b815260040160405180910390fd5b620143706003546106299190611023565b4210156106495760405163143a0ddf60e11b815260040160405180910390fd5b600061065760025485610b08565b905060c861066482610b36565b111561068357604051630bc5108b60e31b815260040160405180910390fd5b60006106986004600101548460200151610b08565b90506106a6604a60c8611023565b6106af82610b36565b116106f25760006106c86106c38385611036565b610b36565b9050604a8111156106ec5760405163fa95c4d360e01b815260040160405180910390fd5b50610747565b825160045460055460208087015160408051938452918301526001600160501b0393841693909216917f271ba03d8a3d6cc035f6017474b953f4bdf2d46e896c23549072a43a2cc78c58910160405180910390a35b825160045460055460208087015160025460408051948552928401919091528282015260608201899052516001600160501b0393841693909216917f3cc2938e8035ab592372e28987d89549a1f8bb703601bc3dbd894f18f5c20a069181900360800190a35050600292909255504260035580516004805469ffffffffffffffffffff199081166001600160501b0393841617909155602083015160055560408301516006556060830151600755608090920151600880549093169116179055565b61081382826104f7565b610446576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556108493390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006104f0836001600160a01b038416610b52565b60006001600160e01b03198216637965db0b60e01b148061039657506301ffc9a760e01b6001600160e01b0319831614610396565b6108e182826104f7565b610446576108f9816001600160a01b03166014610ba1565b610904836020610ba1565b604051602001610915929190611056565b60408051601f198184030181529082905262461bcd60e51b825261043391600401610f7e565b6109458282610809565b60008281526001602052604090206103c2908261088d565b6109678282610d3d565b60008281526001602052604090206103c29082610da2565b60006104f08383610db7565b6000610396825490565b6109d96040518060a0016040528060006001600160501b0316815260200160008152602001600081526020016000815260200160006001600160501b031681525090565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610a3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6391906110e1565b945094509450945094506000841280610a8e5750806001600160501b0316856001600160501b031614155b80610aa057506001600160501b038516155b80610aa9575081155b80610ab357504282115b15610ad15760405163645e584160e01b815260040160405180910390fd5b6040805160a0810182526001600160501b039687168152602081019590955284019290925260608301529091166080820152919050565b600080610b158484611036565b905083610b2461271083611131565b610b2e91906111b6565b949350505050565b600080821215610b4e57610b49826111f2565b610396565b5090565b6000818152600183016020526040812054610b9957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610396565b506000610396565b60606000610bb083600261120e565b610bbb906002611023565b67ffffffffffffffff811115610bd357610bd361122d565b6040519080825280601f01601f191660200182016040528015610bfd576020820181803683370190505b509050600360fc1b81600081518110610c1857610c18611243565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610c4757610c47611243565b60200101906001600160f81b031916908160001a9053506000610c6b84600261120e565b610c76906001611023565b90505b6001811115610cee576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610caa57610caa611243565b1a60f81b828281518110610cc057610cc0611243565b60200101906001600160f81b031916908160001a90535060049490941c93610ce781611259565b9050610c79565b5083156104f05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610433565b610d4782826104f7565b15610446576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006104f0836001600160a01b038416610de1565b6000826000018281548110610dce57610dce611243565b9060005260206000200154905092915050565b60008181526001830160205260408120548015610eca576000610e05600183611270565b8554909150600090610e1990600190611270565b9050818114610e7e576000866000018281548110610e3957610e39611243565b9060005260206000200154905080876000018481548110610e5c57610e5c611243565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e8f57610e8f611283565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610396565b6000915050610396565b5092915050565b600060208284031215610eed57600080fd5b81356001600160e01b0319811681146104f057600080fd5b600060208284031215610f1757600080fd5b5035919050565b60008060408385031215610f3157600080fd5b8235915060208301356001600160a01b0381168114610f4f57600080fd5b809150509250929050565b60005b83811015610f75578181015183820152602001610f5d565b50506000910152565b6020815260008251806020840152610f9d816040850160208701610f5a565b601f01601f19169190910160400192915050565b60008060408385031215610fc457600080fd5b50508035926020909101359150565b600181811c90821680610fe757607f821691505b60208210810361100757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156103965761039661100d565b8181036000831280158383131683831282161715610ed457610ed461100d565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351611088816017850160208801610f5a565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516110b9816028840160208801610f5a565b01602801949350505050565b80516001600160501b03811681146110dc57600080fd5b919050565b600080600080600060a086880312156110f957600080fd5b611102866110c5565b9450602086015193506040860151925060608601519150611125608087016110c5565b90509295509295909350565b60006001600160ff1b03818413828413808216868404861116156111575761115761100d565b600160ff1b60008712828116878305891216156111765761117661100d565b600087129250878205871284841616156111925761119261100d565b878505871281841616156111a8576111a861100d565b505050929093029392505050565b6000826111d357634e487b7160e01b600052601260045260246000fd5b600160ff1b8214600019841416156111ed576111ed61100d565b500590565b6000600160ff1b82016112075761120761100d565b5060000390565b60008160001904831182151516156112285761122861100d565b500290565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816112685761126861100d565b506000190190565b818103818111156103965761039661100d565b634e487b7160e01b600052603160045260246000fdfea26469706673582212200124cd3493a81c960678cbe07310ab3e256721e7e57a8ce00dc8fad8a306fa2a64736f6c63430008100033000000000000000000000000000000000000000000000005780786fae0599c00000000000000000000000000c04611c43842220fd941515f86d1dddb15f04e4600000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000118919e891d0205a7492650ad32e727617fa9452000000000000000000000000118919e891d0205a7492650ad32e727617fa945200000000000000000000000000000000000000000000000000000000000000084f5553472f555344000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c8063961d899c116100c3578063d547741f1161007c578063d547741f14610307578063e1a452181461031a578063ef06e72c14610323578063f7a308061461034a578063f83f2b4d1461035d578063fff641511461036757600080fd5b8063961d899c14610298578063a2011b3f146102a1578063a217fddf146102c8578063a4a28168146102d0578063b59754bc146102eb578063ca15c873146102f457600080fd5b806336568abe1161011557806336568abe146101d057806359643fc0146101e35780637284e416146101eb5780637a533efe146102005780639010d07c1461025a57806391d148541461028557600080fd5b806301ffc9a714610152578063248a9ca31461017a5780632bedabf7146101ab5780632f2ff15d146101b3578063313ce567146101c8575b600080fd5b610165610160366004610edb565b610371565b60405190151581526020015b60405180910390f35b61019d610188366004610f05565b60009081526020819052604090206001015490565b604051908152602001610171565b61019d60c881565b6101c66101c1366004610f1e565b61039c565b005b61019d601281565b6101c66101de366004610f1e565b6103c7565b61019d604a81565b6101f361044a565b6040516101719190610f7e565b600454600554600654600754600854610226946001600160501b03908116949392911685565b604080516001600160501b03968716815260208101959095528401929092526060830152909116608082015260a001610171565b61026d610268366004610fb1565b6104d8565b6040516001600160a01b039091168152602001610171565b610165610293366004610f1e565b6104f7565b61019d60025481565b61019d7f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda81565b61019d600081565b60025460035460408051928352602083019190915201610171565b61019d60035481565b61019d610302366004610f05565b610520565b6101c6610315366004610f1e565b610537565b61019d61271081565b61026d7f000000000000000000000000c04611c43842220fd941515f86d1dddb15f04e4681565b6101c6610358366004610f05565b61055d565b61019d62015f9081565b61019d6201437081565b60006001600160e01b03198216635a05180f60e01b14806103965750610396826108a2565b92915050565b6000828152602081905260409020600101546103b881336108d7565b6103c2838361093b565b505050565b6001600160a01b038116331461043c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610446828261095d565b5050565b6009805461045790610fd3565b80601f016020809104026020016040519081016040528092919081815260200182805461048390610fd3565b80156104d05780601f106104a5576101008083540402835291602001916104d0565b820191906000526020600020905b8154815290600101906020018083116104b357829003601f168201915b505050505081565b60008281526001602052604081206104f0908361097f565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008181526001602052604081206103969061098b565b60008281526020819052604090206001015461055381336108d7565b6103c2838361095d565b7f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda61058881336108d7565b600082136105a9576040516330a7c22160e11b815260040160405180910390fd5b60006105b3610995565b905062015f9081606001516105c89190611023565b4211156105e8576040516373a3618160e11b815260040160405180910390fd5b60045481516001600160501b039182169116036106185760405163061b3c8360e31b815260040160405180910390fd5b620143706003546106299190611023565b4210156106495760405163143a0ddf60e11b815260040160405180910390fd5b600061065760025485610b08565b905060c861066482610b36565b111561068357604051630bc5108b60e31b815260040160405180910390fd5b60006106986004600101548460200151610b08565b90506106a6604a60c8611023565b6106af82610b36565b116106f25760006106c86106c38385611036565b610b36565b9050604a8111156106ec5760405163fa95c4d360e01b815260040160405180910390fd5b50610747565b825160045460055460208087015160408051938452918301526001600160501b0393841693909216917f271ba03d8a3d6cc035f6017474b953f4bdf2d46e896c23549072a43a2cc78c58910160405180910390a35b825160045460055460208087015160025460408051948552928401919091528282015260608201899052516001600160501b0393841693909216917f3cc2938e8035ab592372e28987d89549a1f8bb703601bc3dbd894f18f5c20a069181900360800190a35050600292909255504260035580516004805469ffffffffffffffffffff199081166001600160501b0393841617909155602083015160055560408301516006556060830151600755608090920151600880549093169116179055565b61081382826104f7565b610446576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556108493390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006104f0836001600160a01b038416610b52565b60006001600160e01b03198216637965db0b60e01b148061039657506301ffc9a760e01b6001600160e01b0319831614610396565b6108e182826104f7565b610446576108f9816001600160a01b03166014610ba1565b610904836020610ba1565b604051602001610915929190611056565b60408051601f198184030181529082905262461bcd60e51b825261043391600401610f7e565b6109458282610809565b60008281526001602052604090206103c2908261088d565b6109678282610d3d565b60008281526001602052604090206103c29082610da2565b60006104f08383610db7565b6000610396825490565b6109d96040518060a0016040528060006001600160501b0316815260200160008152602001600081526020016000815260200160006001600160501b031681525090565b60008060008060007f000000000000000000000000c04611c43842220fd941515f86d1dddb15f04e466001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610a3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6391906110e1565b945094509450945094506000841280610a8e5750806001600160501b0316856001600160501b031614155b80610aa057506001600160501b038516155b80610aa9575081155b80610ab357504282115b15610ad15760405163645e584160e01b815260040160405180910390fd5b6040805160a0810182526001600160501b039687168152602081019590955284019290925260608301529091166080820152919050565b600080610b158484611036565b905083610b2461271083611131565b610b2e91906111b6565b949350505050565b600080821215610b4e57610b49826111f2565b610396565b5090565b6000818152600183016020526040812054610b9957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610396565b506000610396565b60606000610bb083600261120e565b610bbb906002611023565b67ffffffffffffffff811115610bd357610bd361122d565b6040519080825280601f01601f191660200182016040528015610bfd576020820181803683370190505b509050600360fc1b81600081518110610c1857610c18611243565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610c4757610c47611243565b60200101906001600160f81b031916908160001a9053506000610c6b84600261120e565b610c76906001611023565b90505b6001811115610cee576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610caa57610caa611243565b1a60f81b828281518110610cc057610cc0611243565b60200101906001600160f81b031916908160001a90535060049490941c93610ce781611259565b9050610c79565b5083156104f05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610433565b610d4782826104f7565b15610446576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006104f0836001600160a01b038416610de1565b6000826000018281548110610dce57610dce611243565b9060005260206000200154905092915050565b60008181526001830160205260408120548015610eca576000610e05600183611270565b8554909150600090610e1990600190611270565b9050818114610e7e576000866000018281548110610e3957610e39611243565b9060005260206000200154905080876000018481548110610e5c57610e5c611243565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610e8f57610e8f611283565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610396565b6000915050610396565b5092915050565b600060208284031215610eed57600080fd5b81356001600160e01b0319811681146104f057600080fd5b600060208284031215610f1757600080fd5b5035919050565b60008060408385031215610f3157600080fd5b8235915060208301356001600160a01b0381168114610f4f57600080fd5b809150509250929050565b60005b83811015610f75578181015183820152602001610f5d565b50506000910152565b6020815260008251806020840152610f9d816040850160208701610f5a565b601f01601f19169190910160400192915050565b60008060408385031215610fc457600080fd5b50508035926020909101359150565b600181811c90821680610fe757607f821691505b60208210810361100757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156103965761039661100d565b8181036000831280158383131683831282161715610ed457610ed461100d565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351611088816017850160208801610f5a565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516110b9816028840160208801610f5a565b01602801949350505050565b80516001600160501b03811681146110dc57600080fd5b919050565b600080600080600060a086880312156110f957600080fd5b611102866110c5565b9450602086015193506040860151925060608601519150611125608087016110c5565b90509295509295909350565b60006001600160ff1b03818413828413808216868404861116156111575761115761100d565b600160ff1b60008712828116878305891216156111765761117661100d565b600087129250878205871284841616156111925761119261100d565b878505871281841616156111a8576111a861100d565b505050929093029392505050565b6000826111d357634e487b7160e01b600052601260045260246000fd5b600160ff1b8214600019841416156111ed576111ed61100d565b500590565b6000600160ff1b82016112075761120761100d565b5060000390565b60008160001904831182151516156112285761122861100d565b500290565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816112685761126861100d565b506000190190565b818103818111156103965761039661100d565b634e487b7160e01b600052603160045260246000fdfea26469706673582212200124cd3493a81c960678cbe07310ab3e256721e7e57a8ce00dc8fad8a306fa2a64736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000005780786fae0599c00000000000000000000000000c04611c43842220fd941515f86d1dddb15f04e4600000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000118919e891d0205a7492650ad32e727617fa9452000000000000000000000000118919e891d0205a7492650ad32e727617fa945200000000000000000000000000000000000000000000000000000000000000084f5553472f555344000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _initialPrice (int256): 100882750390000000000
Arg [1] : _chainlinkOracle (address): 0xc04611C43842220fd941515F86d1DDdB15F04e46
Arg [2] : _description (string): OUSG/USD
Arg [3] : _admin (address): 0x118919e891D0205A7492650AD32E727617FA9452
Arg [4] : _setter (address): 0x118919e891D0205A7492650AD32E727617FA9452
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000005780786fae0599c00
Arg [1] : 000000000000000000000000c04611c43842220fd941515f86d1dddb15f04e46
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [3] : 000000000000000000000000118919e891d0205a7492650ad32e727617fa9452
Arg [4] : 000000000000000000000000118919e891d0205a7492650ad32e727617fa9452
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [6] : 4f5553472f555344000000000000000000000000000000000000000000000000
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.