Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0.0603532 ETH
Eth Value
$210.61 (@ $3,489.58/ETH)More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 177 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Deposit Native C... | 21476444 | 52 mins ago | IN | 0.03 ETH | 0.00077614 | ||||
Deposit Native C... | 21473967 | 9 hrs ago | IN | 0.06 ETH | 0.00133849 | ||||
Deposit Native C... | 21468980 | 25 hrs ago | IN | 0.439 ETH | 0.00124206 | ||||
Deposit Native C... | 21468979 | 25 hrs ago | IN | 0.439 ETH | 0.00146119 | ||||
Deposit Native C... | 21459272 | 2 days ago | IN | 0.045 ETH | 0.00118007 | ||||
Deposit Native C... | 21458241 | 2 days ago | IN | 0.07 ETH | 0.00180755 | ||||
Deposit Native C... | 21455899 | 2 days ago | IN | 0.03 ETH | 0.00108601 | ||||
Deposit Native C... | 21453488 | 3 days ago | IN | 0.15 ETH | 0.00128957 | ||||
Deposit Native C... | 21453201 | 3 days ago | IN | 0.1 ETH | 0.00140054 | ||||
Deposit Native C... | 21451847 | 3 days ago | IN | 0.03 ETH | 0.00150382 | ||||
Deposit Native C... | 21448498 | 3 days ago | IN | 0.1082 ETH | 0.0011752 | ||||
Deposit Native C... | 21444346 | 4 days ago | IN | 0.1056 ETH | 0.00847848 | ||||
Deposit Native C... | 21440696 | 5 days ago | IN | 0.14 ETH | 0.00187159 | ||||
Deposit Native C... | 21429157 | 6 days ago | IN | 0.2859 ETH | 0.00429957 | ||||
Deposit Native C... | 21424551 | 7 days ago | IN | 0.042 ETH | 0.0027941 | ||||
Deposit Native C... | 21422571 | 7 days ago | IN | 0.04 ETH | 0.00410704 | ||||
Deposit Native C... | 21417269 | 8 days ago | IN | 0.05 ETH | 0.005557 | ||||
Deposit Native C... | 21412119 | 9 days ago | IN | 0.031 ETH | 0.00355583 | ||||
Deposit Native C... | 21410170 | 9 days ago | IN | 0.025 ETH | 0.00179188 | ||||
Deposit Native C... | 21408542 | 9 days ago | IN | 0.028 ETH | 0.00249842 | ||||
Deposit Native C... | 21407543 | 9 days ago | IN | 0.0258 ETH | 0.00116547 | ||||
Deposit Native C... | 21405898 | 9 days ago | IN | 0.5 ETH | 0.00142851 | ||||
Deposit Native C... | 21404712 | 10 days ago | IN | 0.026 ETH | 0.001385 | ||||
Deposit Native C... | 21402479 | 10 days ago | IN | 0.05 ETH | 0.0018316 | ||||
Deposit Native C... | 21398002 | 10 days ago | IN | 0.0299 ETH | 0.00200594 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
21476444 | 52 mins ago | 0.03 ETH | ||||
21473967 | 9 hrs ago | 0.0108 ETH | ||||
21473967 | 9 hrs ago | 0.0492 ETH | ||||
21468980 | 25 hrs ago | 0.439 ETH | ||||
21468979 | 25 hrs ago | 0.439 ETH | ||||
21459272 | 2 days ago | 0.045 ETH | ||||
21458241 | 2 days ago | 0.0168 ETH | ||||
21458241 | 2 days ago | 0.0532 ETH | ||||
21455899 | 2 days ago | 0.03 ETH | ||||
21453488 | 3 days ago | 0.15 ETH | ||||
21453201 | 3 days ago | 0.1 ETH | ||||
21451847 | 3 days ago | 0.03 ETH | ||||
21448498 | 3 days ago | 0.019476 ETH | ||||
21448498 | 3 days ago | 0.088724 ETH | ||||
21444346 | 4 days ago | 0.019008 ETH | ||||
21444346 | 4 days ago | 0.086592 ETH | ||||
21440696 | 5 days ago | 0.14 ETH | ||||
21429157 | 6 days ago | 0.051462 ETH | ||||
21429157 | 6 days ago | 0.234438 ETH | ||||
21424551 | 7 days ago | 0.042 ETH | ||||
21422571 | 7 days ago | 0.04 ETH | ||||
21417269 | 8 days ago | 0.009 ETH | ||||
21417269 | 8 days ago | 0.041 ETH | ||||
21412119 | 9 days ago | 0.00558 ETH | ||||
21412119 | 9 days ago | 0.02542 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
NativeCurrencyStreamer
Compiler Version
v0.8.27+commit.40a35a09
Optimization Enabled:
Yes with 300 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.27; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol"; import "@pythnetwork/pyth-sdk-solidity/IPyth.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./interfaces/IDataVault.sol"; contract NativeCurrencyStreamer is AccessControl, ReentrancyGuard, Pausable { using SafeERC20 for IERC20; using Address for address; using Strings for string; bytes32 public constant VERIFIED_SOURCE = keccak256("VERIFIED_SOURCE"); address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; uint256 public constant ETH_DECIMALS = 18; uint256 public constant NUMERATOR = 1e18; uint256 private _totalRaised; IDataVault private _vault; IPyth private _priceFeed; bytes32 private _id; uint256 private _threshold; event RecoveredErc(address token, uint256 amount); event RecoveredEth(uint256 amount); event DepositedEth( address depositer, string ratedPerson, uint256 amount, uint256 soldTokens, uint256 usd, uint256 round ); error EndedError(); error EndedRoundError(); error NullAddressError(); error ExceededSupplyError(); error UnattainedThresholdError(); error UnattainedMinAmountError(); error ExceededThresholdError(); error SelfRatingError(); error FailedEthTransferError(); constructor( address payable vault_, address priceFeed_, bytes32 id_, uint256 threshold_ ) { if (vault_ == address(0) || priceFeed_ == address(0)) { revert NullAddressError(); } if (threshold_ == 0) { revert UnattainedThresholdError(); } _vault = IDataVault(vault_); _priceFeed = IPyth(priceFeed_); _id = id_; _threshold = threshold_; _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); } function pause() external onlyRole(DEFAULT_ADMIN_ROLE) { _pause(); } function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) { _unpause(); } function setPriceFeedAddress(address priceFeed_) external onlyRole(DEFAULT_ADMIN_ROLE) { _priceFeed = IPyth(priceFeed_); } function setPriceFeedID(bytes32 id_) external onlyRole(DEFAULT_ADMIN_ROLE) { _id = id_; } function depositNativeCurrency(string calldata ratedPerson_) external payable nonReentrant { _deposit(_msgSender(), ratedPerson_); } function depositNativeCurrencyFor( address user_, string calldata ratedPerson_ ) external payable onlyRole(VERIFIED_SOURCE) nonReentrant { _deposit(user_, ratedPerson_); } function setPriceThreshold(uint256 threshold_) external onlyRole(DEFAULT_ADMIN_ROLE) { _threshold = threshold_; } function recoverEth() external onlyRole(DEFAULT_ADMIN_ROLE) { uint256 balance = address(this).balance; _msgSender().call{value: balance}(""); emit RecoveredEth(balance); } function recoverErc(address token_, uint256 amount_) external onlyRole(DEFAULT_ADMIN_ROLE) { IERC20(token_).safeTransfer(_msgSender(), amount_); emit RecoveredErc(token_, amount_); } function getVault() external view returns (address) { return address(_vault); } function getTotalRaised() external view returns (uint256) { return _totalRaised; } function getThreshold() external view returns (uint256) { return _threshold; } function _deposit( address user_, string calldata ratedPerson_ ) internal whenNotPaused { uint256 amount = msg.value; if (user_ == address(0)) { revert NullAddressError(); } if (!_vault.isActive()) { revert EndedError(); } PythStructs.Price memory priceInfo = _priceFeed.getPriceUnsafe(_id); IDataVault.Round memory round = _vault.getRound(_vault.getCurrentRound()); if (round.roundStatus != IDataVault.RoundStatus.Started) { revert EndedRoundError(); } (uint256 soldTokens, uint256 usd) = _getSoldTokens(amount, priceInfo); soldTokens += _vault.getRewardForMilestone(usd, soldTokens); if (round.supply < round.soldTokens + soldTokens) { revert ExceededSupplyError(); } uint8 decimals = uint8(uint32(-1 * priceInfo.expo)); uint256 price = uint256(uint64(priceInfo.price)); if (block.timestamp - priceInfo.publishTime > _threshold) { revert ExceededThresholdError(); } uint256 funds = (amount * price * NUMERATOR) / (10 ** (ETH_DECIMALS + decimals)); if (_vault.getMin() > funds) { revert UnattainedMinAmountError(); } (string memory ratedPerson, uint256 main, uint256 secondary) = _getRatedPerson( user_, ratedPerson_, amount, priceInfo ); _purchase(amount, main); _totalRaised = _totalRaised + amount; _vault.setRoundStatus(user_, ETH, funds, soldTokens, ratedPerson, main, secondary); emit DepositedEth(user_, ratedPerson, amount, soldTokens, usd, _vault.getCurrentRound()); } function _purchase(uint256 amount_, uint256 reward_) internal { address treasury = _vault.getTreasury(); (bool success, ) = treasury.call{value: amount_ - reward_}(""); if (!success) { revert FailedEthTransferError(); } if (reward_ > 0) { (bool rSuccess, ) = address(_vault).call{value: reward_}(""); if (!rSuccess) revert FailedEthTransferError(); } } function _getRatedPerson( address user_, string calldata ratedPerson_, uint256 amount_, PythStructs.Price memory priceInfo ) internal view returns (string memory, uint256, uint256) { string memory ratedPerson = _vault.getRatedPerson(user_, ratedPerson_); if (ratedPerson.equal("")) { return (ratedPerson, 0, 0); } (uint256 mainRate, uint256 secondaryRate) = _vault.getPersonalRates(ratedPerson); uint256 main = (amount_ * mainRate) / 1000; uint256 secondary = (amount_ * secondaryRate) / 1000; (uint256 soldTokens,) = _getSoldTokens(secondary, priceInfo); return (ratedPerson, main, soldTokens); } function _getSoldTokens( uint256 amount_, PythStructs.Price memory priceInfo ) internal view returns (uint256,uint256) { if (block.timestamp - priceInfo.publishTime > _threshold) { revert ExceededThresholdError(); } uint256 usd = (amount_ * uint256(uint64(priceInfo.price))) / (10 ** uint8(uint32(-1 * priceInfo.expo))); uint256 token = usd * NUMERATOR / _vault.getCurrentPrice(); return (token, usd); } receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/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: * * ```solidity * 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}: * * ```solidity * 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. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @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 returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @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 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. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual 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. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual 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 `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @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 Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @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. */ 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 `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) 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 FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./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); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @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 (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { bool private _paused; /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; 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_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./PythStructs.sol"; import "./IPythEvents.sol"; /// @title Consume prices from the Pyth Network (https://pyth.network/). /// @dev Please refer to the guidance at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how to consume prices safely. /// @author Pyth Data Association interface IPyth is IPythEvents { /// @notice Returns the period (in seconds) that a price feed is considered valid since its publish time function getValidTimePeriod() external view returns (uint validTimePeriod); /// @notice Returns the price and confidence interval. /// @dev Reverts if the price has not been updated within the last `getValidTimePeriod()` seconds. /// @param id The Pyth Price Feed ID of which to fetch the price and confidence interval. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPrice( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price and confidence interval. /// @dev Reverts if the EMA price is not available. /// @param id The Pyth Price Feed ID of which to fetch the EMA price and confidence interval. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPrice( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the price of a price feed without any sanity checks. /// @dev This function returns the most recent price update in this contract without any recency checks. /// This function is unsafe as the returned price update may be arbitrarily far in the past. /// /// Users of this function should check the `publishTime` in the price to ensure that the returned price is /// sufficiently recent for their application. If you are considering using this function, it may be /// safer / easier to use either `getPrice` or `getPriceNoOlderThan`. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPriceUnsafe( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the price that is no older than `age` seconds of the current time. /// @dev This function is a sanity-checked version of `getPriceUnsafe` which is useful in /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently /// recently. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getPriceNoOlderThan( bytes32 id, uint age ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price of a price feed without any sanity checks. /// @dev This function returns the same price as `getEmaPrice` in the case where the price is available. /// However, if the price is not recent this function returns the latest available price. /// /// The returned price can be from arbitrarily far in the past; this function makes no guarantees that /// the returned price is recent or useful for any particular application. /// /// Users of this function should check the `publishTime` in the price to ensure that the returned price is /// sufficiently recent for their application. If you are considering using this function, it may be /// safer / easier to use either `getEmaPrice` or `getEmaPriceNoOlderThan`. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPriceUnsafe( bytes32 id ) external view returns (PythStructs.Price memory price); /// @notice Returns the exponentially-weighted moving average price that is no older than `age` seconds /// of the current time. /// @dev This function is a sanity-checked version of `getEmaPriceUnsafe` which is useful in /// applications that require a sufficiently-recent price. Reverts if the price wasn't updated sufficiently /// recently. /// @return price - please read the documentation of PythStructs.Price to understand how to use this safely. function getEmaPriceNoOlderThan( bytes32 id, uint age ) external view returns (PythStructs.Price memory price); /// @notice Update price feeds with given update messages. /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// Prices will be updated if they are more recent than the current stored prices. /// The call will succeed even if the update is not the most recent. /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid. /// @param updateData Array of price update data. function updatePriceFeeds(bytes[] calldata updateData) external payable; /// @notice Wrapper around updatePriceFeeds that rejects fast if a price update is not necessary. A price update is /// necessary if the current on-chain publishTime is older than the given publishTime. It relies solely on the /// given `publishTimes` for the price feeds and does not read the actual price update publish time within `updateData`. /// /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// /// `priceIds` and `publishTimes` are two arrays with the same size that correspond to senders known publishTime /// of each priceId when calling this method. If all of price feeds within `priceIds` have updated and have /// a newer or equal publish time than the given publish time, it will reject the transaction to save gas. /// Otherwise, it calls updatePriceFeeds method to update the prices. /// /// @dev Reverts if update is not needed or the transferred fee is not sufficient or the updateData is invalid. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param publishTimes Array of publishTimes. `publishTimes[i]` corresponds to known `publishTime` of `priceIds[i]` function updatePriceFeedsIfNecessary( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64[] calldata publishTimes ) external payable; /// @notice Returns the required fee to update an array of price updates. /// @param updateData Array of price update data. /// @return feeAmount The required fee in Wei. function getUpdateFee( bytes[] calldata updateData ) external view returns (uint feeAmount); /// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published /// within `minPublishTime` and `maxPublishTime`. /// /// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price; /// otherwise, please consider using `updatePriceFeeds`. This method may store the price updates on-chain, if they /// are more recent than the current stored prices. /// /// This method requires the caller to pay a fee in wei; the required fee can be computed by calling /// `getUpdateFee` with the length of the `updateData` array. /// /// /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is /// no update for any of the given `priceIds` within the given time range. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`. /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`. /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order). function parsePriceFeedUpdates( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64 minPublishTime, uint64 maxPublishTime ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds); /// @notice Similar to `parsePriceFeedUpdates` but ensures the updates returned are /// the first updates published in minPublishTime. That is, if there are multiple updates for a given timestamp, /// this method will return the first update. This method may store the price updates on-chain, if they /// are more recent than the current stored prices. /// /// /// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is /// no update for any of the given `priceIds` within the given time range and uniqueness condition. /// @param updateData Array of price update data. /// @param priceIds Array of price ids. /// @param minPublishTime minimum acceptable publishTime for the given `priceIds`. /// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`. /// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order). function parsePriceFeedUpdatesUnique( bytes[] calldata updateData, bytes32[] calldata priceIds, uint64 minPublishTime, uint64 maxPublishTime ) external payable returns (PythStructs.PriceFeed[] memory priceFeeds); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @title IPythEvents contains the events that Pyth contract emits. /// @dev This interface can be used for listening to the updates for off-chain and testing purposes. interface IPythEvents { /// @dev Emitted when the price feed with `id` has received a fresh update. /// @param id The Pyth Price Feed ID. /// @param publishTime Publish time of the given price update. /// @param price Price of the given price update. /// @param conf Confidence interval of the given price update. event PriceFeedUpdate( bytes32 indexed id, uint64 publishTime, int64 price, uint64 conf ); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; contract PythStructs { // A price with a degree of uncertainty, represented as a price +- a confidence interval. // // The confidence interval roughly corresponds to the standard error of a normal distribution. // Both the price and confidence are stored in a fixed-point numeric representation, // `x * (10^expo)`, where `expo` is the exponent. // // Please refer to the documentation at https://docs.pyth.network/documentation/pythnet-price-feeds/best-practices for how // to how this price safely. struct Price { // Price int64 price; // Confidence interval around the price uint64 conf; // Price exponent int32 expo; // Unix timestamp describing when the price was published uint publishTime; } // PriceFeed represents a current aggregate price from pyth publisher feeds. struct PriceFeed { // The price ID. bytes32 id; // Latest available price Price price; // Latest available exponentially-weighted moving average price Price emaPrice; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; interface IDataVault { enum RoundStatus { UNDEFINED, Started, Ended } struct Round { bool defined; RoundStatus roundStatus; uint256 price; uint256 soldTokens; uint256 supply; } struct PersonalRates { bool defined; bool enabled; uint256 mainRate; uint256 secondaryRate; } struct RewardMilestone { uint256 reward; uint256 milestone; } function startSale() external; function endSale() external; function setRound(uint256 price_, uint256 supply_) external; function setDefaultRates(uint256 mainRate_, uint256 secondaryRate_) external; function updatePersonalRates( string[] calldata users_, uint256[] calldata mainRate_, uint256[] calldata secondaryRate_ ) external; function setRoundPrice(uint256 index_, uint256 price_) external; function setRoundSupply(uint256 index_, uint256 supply_) external; function startRound(uint256 index_) external; function endRound(uint256 index_) external; function setMin(uint256 amount_) external; function setTreasury(address treasury_) external; function setRoundStatus( address user_, address token_, uint256 amount_, uint256 soldTokens_, string calldata person_, uint256 fReward_, uint256 sReward_ ) external; function enablePersonalRates(string calldata person_) external; function disablePersonalRates(string calldata person_) external; function claimSelectedRewards(address[] memory assets_, string memory ratedPerson_, uint256 deadline_, uint8 v, bytes32 r, bytes32 s) external; function recoverCoin() external; function recoverErc20(address token_, uint256 amount_) external; function getTreasury() external view returns (address); function getMin() external view returns (uint256); function getRoundsCount() external view returns (uint256); function getCurrentRound() external view returns (uint256); function getRound(uint256 index_) external view returns (Round memory); function getTotalSoldTokens() external view returns (uint256); function balanceOf(uint256 round_, address user_) external view returns (uint256); function rewardBalanceOf(address token_, string calldata user_) external view returns (uint256); function getDefaultRates() external view returns (uint256, uint256); function getRatedPerson(address user_, string calldata person_) external view returns (string memory); function getPersonalRates(string calldata person_) external view returns (uint256, uint256); function isActive() external view returns (bool); function isInactive() external view returns (bool); function getCurrentPrice() external view returns (uint256); function setTrustPassedCode(bool value_) external; function getRewardForMilestone(uint256 usd, uint256 token) external view returns(uint256); }
{ "optimizer": { "enabled": true, "runs": 300 }, "viaIR": true, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address payable","name":"vault_","type":"address"},{"internalType":"address","name":"priceFeed_","type":"address"},{"internalType":"bytes32","name":"id_","type":"bytes32"},{"internalType":"uint256","name":"threshold_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"EndedError","type":"error"},{"inputs":[],"name":"EndedRoundError","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExceededSupplyError","type":"error"},{"inputs":[],"name":"ExceededThresholdError","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedEthTransferError","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"NullAddressError","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SelfRatingError","type":"error"},{"inputs":[],"name":"UnattainedMinAmountError","type":"error"},{"inputs":[],"name":"UnattainedThresholdError","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositer","type":"address"},{"indexed":false,"internalType":"string","name":"ratedPerson","type":"string"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"soldTokens","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usd","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"DepositedEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RecoveredErc","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RecoveredEth","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ETH_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NUMERATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERIFIED_SOURCE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"ratedPerson_","type":"string"}],"name":"depositNativeCurrency","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user_","type":"address"},{"internalType":"string","name":"ratedPerson_","type":"string"}],"name":"depositNativeCurrencyFor","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVault","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"recoverErc","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","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":[{"internalType":"address","name":"priceFeed_","type":"address"}],"name":"setPriceFeedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"id_","type":"bytes32"}],"name":"setPriceFeedID","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"threshold_","type":"uint256"}],"name":"setPriceThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6080346100ff57601f611eab38819003918201601f19168301916001600160401b03831184841017610104578084926080946040528339810103126100ff5780516001600160a01b03811691908290036100ff5760208101516001600160a01b038116908190036100ff5760606040830151920151926001805560ff1960025416600255801580156100f7575b6100e65783156100d55760018060a01b0319600454161760045560018060a01b031960055416176005556006556007556100c53361011a565b50604051611ce290816101a98239f35b6338c39e9560e01b60005260046000fd5b63476824bb60e01b60005260046000fd5b50811561008c565b600080fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381166000908152600080516020611e8b833981519152602052604090205460ff166101a2576001600160a01b03166000818152600080516020611e8b83398151915260205260408120805460ff191660011790553391907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4600190565b5060009056fe6080604052600436101561001b575b361561001957600080fd5b005b6000803560e01c8062cf5db41461152d57806301ffc9a7146114d6578063224bb1ef146113ce578063248a9ca3146113985780632f2ff15d1461135757806336568abe146113125780633a0bdd1d14610c165780633f4ba83a14610bae57806344aa886614610b8b5780634fb52c7014610b685780635c975abb14610b455780637c3f2c6f14610b0a5780638456cb5914610aaf5780638d928af814610a8857806391d1485414610a3c57806392cd1ff214610a20578063949565f5146102435780639f55029314610225578063a217fddf14610209578063bcdb446b146101b0578063d547741f14610166578063d8830c7d146101435763e75235b814610123575061000e565b346101405780600319360112610140576020600754604051908152f35b80fd5b50346101405780600319360112610140576020604051670de0b6b3a76400008152f35b5034610140576040366003190112610140576101ac600435610186611589565b906101a76101a282600052600060205260016040600020015490565b6116dc565b6117bd565b5080f35b50346101405780600319360112610140576101c9611689565b7f815a9309d0bd0941820f20874f465a2520e31601d404231cf07c8e65a0511a796020478380808084335af1506101fe611659565b50604051908152a180f35b5034610140578060031936011261014057602090604051908152f35b50346101405780600319360112610140576020600354604051908152f35b50604036600319011261014057610258611573565b9060243567ffffffffffffffff81116107575761027990369060040161159f565b90927fa1ebb7d53776b44b6a78c0be0e62740fc5e5842f5ecb962ccba9b798f5c34698835282602052604083206001600160a01b03331660005260205260ff60406000205416156109e9576102cc61184c565b6102d461193a565b6001600160a01b0381169081156109da576001600160a01b03600454166040516308bcf8b560e21b8152602081600481855afa9081156106b05786916109a0575b5015610991576001600160a01b03600554169560806006546024604051809a81936396834ad360e01b835260048301525afa9687156106b0578697610901575b5060405163a32bf59760e01b815292602084600481865afa9384156108c25787946108cd575b506040519363023c4c9f60e61b8552600485015260a084602481865afa9384156108c257879461083d575b5060208401516003811015610829576000190161081a576103c78834611957565b969060405190633d2708f360e01b8252886004830152806024830152602082604481895afa9081156107a7578a916107e4575b610404925061187b565b94610418866060608084015193015161187b565b116107d55760ff61042f60408b015160030b61189e565b1667ffffffffffffffff8a511661044a60608c0151426118b2565b600754106107c65761045c90346118bf565b90670de0b6b3a7640000820291808304670de0b6b3a764000014901517156107b257601201806012116107b257604d81116107b2579061049f91600a0a906118d2565b9260405163d6362e9760e01b8152602081600481895afa9081156107a7579085918b91610772575b50116107635788996004936020999a936104e2933492611a60565b604051631d8cf42560e11b8152929991969094839182905afa80156106d4578291829161071a575b5081809161051888346118b2565b905af1610523611659565b501561070b5790829188936106df575b61053f3460035461187b565b6003556001600160a01b0360045416803b156106d0578492836040518096819582946336cd28cf60e01b84528c600485015273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee602485015260448401528a606484015260e060848401526105ab8d60e4850190611915565b9160a484015260c483015203925af180156106d4576106bb575b505060049360206001600160a01b038654166040519687809263a32bf59760e01b82525afa9081156106b0578691610657575b7f9dabce3b9e9473d2a085256109a4eedfa18c711cea72edab0a8f655c7c888b839550610637604051958695865260c0602087015260c0860190611915565b923460408601526060850152608084015260a08301520390a16001805580f35b90506020853d6020116106a8575b816106726020938361161b565b810103126106a3577f9dabce3b9e9473d2a085256109a4eedfa18c711cea72edab0a8f655c7c888b839451906105f8565b600080fd5b3d9150610665565b6040513d88823e3d90fd5b816106c59161161b565b6106d05784386105c5565b8480fd5b6040513d84823e3d90fd5b909192808080866001600160a01b03600454165af16106fc611659565b501561070b5790879291610533565b6384081a9360e01b8852600488fd5b9150506020813d60201161075b575b816107366020938361161b565b8101031261075757516001600160a01b03811681036107575781908161050a565b5080fd5b3d9150610729565b63c63d17f960e01b8952600489fd5b9150506020813d60201161079f575b8161078e6020938361161b565b810103126106a357849051386104c7565b3d9150610781565b6040513d8c823e3d90fd5b634e487b7160e01b8a52601160045260248afd5b63eeb07f6d60e01b8a5260048afd5b63179f800360e21b8852600488fd5b90506020823d602011610812575b816107ff6020938361161b565b810103126106a3576104049151906103fa565b3d91506107f2565b6371bb303f60e01b8752600487fd5b634e487b7160e01b88526021600452602488fd5b90935060a0813d60a0116108ba575b8161085960a0938361161b565b810103126108b6576040519061086e826115ff565b6108778161186e565b8252602081015160038110156108b25790608091602084015260408101516040840152606081015160608401520151608082015292386103a6565b8880fd5b8680fd5b3d915061084c565b6040513d89823e3d90fd5b9093506020813d6020116108f9575b816108e96020938361161b565b810103126106a35751923861037b565b3d91506108dc565b9096506080813d608011610989575b8161091d6080938361161b565b810103126109855760405190610932826115cd565b80518060070b8103610981578252602081015167ffffffffffffffff8116810361098157602083015260408101518060030b810361098157906060916040840152015160608201529538610355565b8780fd5b8580fd5b3d9150610910565b6359c36eed60e01b8552600485fd5b90506020813d6020116109d2575b816109bb6020938361161b565b81010312610985576109cc9061186e565b38610315565b3d91506109ae565b63476824bb60e01b8452600484fd5b63e2517d3f60e01b8352336004527fa1ebb7d53776b44b6a78c0be0e62740fc5e5842f5ecb962ccba9b798f5c34698602452604483fd5b5034610140578060031936011261014057602060405160128152f35b5034610140576040366003190112610140576001600160a01b036040610a60611589565b92600435815280602052209116600052602052602060ff604060002054166040519015158152f35b503461014057806003193601126101405760206001600160a01b0360045416604051908152f35b5034610140578060031936011261014057610ac8611689565b610ad061193a565b600160ff1960025416176002557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b503461014057806003193601126101405760206040517fa1ebb7d53776b44b6a78c0be0e62740fc5e5842f5ecb962ccba9b798f5c346988152f35b5034610140578060031936011261014057602060ff600254166040519015158152f35b503461014057602036600319011261014057610b82611689565b60043560075580f35b503461014057602036600319011261014057610ba5611689565b60043560065580f35b5034610140578060031936011261014057610bc7611689565b60025460ff811615610c075760ff19166002557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b638dfc202b60e01b8252600482fd5b5060203660031901126101405760043567ffffffffffffffff811161075757610c4390369060040161159f565b90610c4c61184c565b610c5461193a565b3315611303576001600160a01b03600454166040516308bcf8b560e21b8152602081600481855afa9081156110055785916112c9575b50156112ba576001600160a01b03600554169260806006546024604051809781936396834ad360e01b835260048301525afa938415611005578594611232575b5060405163a32bf59760e01b815293602085600481865afa9485156106b05786956111fe575b506040519463023c4c9f60e61b8652600486015260a085602481865afa9485156106b0578695611181575b506020850151600381101561116d576000190161115e57610d3c8134611957565b949060405190633d2708f360e01b8252866004830152806024830152602082604481895afa9081156110eb578991611128575b610d79925061187b565b95610d8d876060608084015193015161187b565b116111195760ff610da4604084015160030b61189e565b1667ffffffffffffffff835116610dbf6060850151426118b2565b6007541061110a57610dd190346118bf565b90670de0b6b3a7640000820291808304670de0b6b3a764000014901517156110f657601201806012116110f657604d81116110f65790610e1491600a0a906118d2565b9260405163d6362e9760e01b8152602081600481895afa80156110eb5785918a916110b6575b50116110a757610e566004936020979695938a93349133611a60565b604051631d8cf42560e11b8152929891969095839182905afa80156106d45782918291611062575b50818091610e8c88346118b2565b905af1610e97611659565b50156110535790869183611029575b610eb23460035461187b565b6003556001600160a01b036004541690813b1561102557836040518096819582946336cd28cf60e01b845233600485015273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee602485015260448401528b606484015260e06084840152610f1c60e484018c611915565b9160a484015260c483015203925af1801561100557611010575b5060049060206001600160a01b038354166040519384809263a32bf59760e01b82525afa918215611005578592610fab575b509261063792917f9dabce3b9e9473d2a085256109a4eedfa18c711cea72edab0a8f655c7c888b839460405194859433865260c0602087015260c0860190611915565b929150926020833d602011610ffd575b81610fc86020938361161b565b810103126106a357915191929091907f9dabce3b9e9473d2a085256109a4eedfa18c711cea72edab0a8f655c7c888b83610f68565b3d9150610fbb565b6040513d87823e3d90fd5b9361101e816004939661161b565b9390610f36565b8380fd5b9091808080866001600160a01b03600454165af1611045611659565b501561105357908691610ea6565b6384081a9360e01b8752600487fd5b9150506020813d60201161109f575b8161107e6020938361161b565b8101031261075757516001600160a01b038116810361075757819081610e7e565b3d9150611071565b63c63d17f960e01b8852600488fd5b9150506020813d6020116110e3575b816110d26020938361161b565b810103126108b25784905138610e3a565b3d91506110c5565b6040513d8b823e3d90fd5b634e487b7160e01b89526011600452602489fd5b63eeb07f6d60e01b8952600489fd5b63179f800360e21b8752600487fd5b90506020823d602011611156575b816111436020938361161b565b810103126108b257610d79915190610d6f565b3d9150611136565b6371bb303f60e01b8652600486fd5b634e487b7160e01b87526021600452602487fd5b90945060a0813d60a0116111f6575b8161119d60a0938361161b565b8101031261098557604051906111b2826115ff565b6111bb8161186e565b825260208101519060038210156109815760809160208401526040810151604084015260608101516060840152015160808201529338610d1b565b3d9150611190565b9094506020813d60201161122a575b8161121a6020938361161b565b8101031261098557519338610cf0565b3d915061120d565b9093506080813d6080116112b2575b8161124e6080938361161b565b810103126106d05760405190611263826115cd565b80518060070b81036108b6578252602081015167ffffffffffffffff811681036108b65760208301526040810151908160030b82036108b6576060916040840152015160608201529238610cca565b3d9150611241565b6359c36eed60e01b8452600484fd5b90506020813d6020116112fb575b816112e46020938361161b565b810103126106d0576112f59061186e565b38610c8a565b3d91506112d7565b63476824bb60e01b8352600483fd5b50346101405760403660031901126101405761132c611589565b336001600160a01b03821603611348576101ac906004356117bd565b63334bd91960e11b8252600482fd5b5034610140576040366003190112610140576101ac600435611377611589565b906113936101a282600052600060205260016040600020015490565b611723565b50346101405760203660031901126101405760206113c6600435600052600060205260016040600020015490565b604051908152f35b5034610140576040366003190112610140576113e8611573565b906024356113f4611689565b60405163a9059cbb60e01b60208201908152336024830152604480830184905282526001600160a01b038516949161144b91859182919061143660648261161b565b519082895af1611444611659565b9086611c4e565b80519081151591826114b3575b505061149f57604080516001600160a01b0392909216825260208201929092527f2face92d4acd4873a5b75fd062d53f35714c188a885552ee09eedd96a32db7079190a180f35b635274afe760e01b83526004849052602483fd5b81925090602091810103126110255760206114ce910161186e565b153880611458565b50346101405760203660031901126101405760043563ffffffff60e01b811680910361075757602090637965db0b60e01b811490811561151c575b506040519015158152f35b6301ffc9a760e01b14905082611511565b5034610140576020366003190112610140576001600160a01b0361154f611573565b611557611689565b166bffffffffffffffffffffffff60a01b600554161760055580f35b600435906001600160a01b03821682036106a357565b602435906001600160a01b03821682036106a357565b9181601f840112156106a35782359167ffffffffffffffff83116106a357602083818601950101116106a357565b6080810190811067ffffffffffffffff8211176115e957604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176115e957604052565b90601f8019910116810190811067ffffffffffffffff8211176115e957604052565b67ffffffffffffffff81116115e957601f01601f191660200190565b3d15611684573d9061166a8261163d565b91611678604051938461161b565b82523d6000602084013e565b606090565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16156116c257565b63e2517d3f60e01b60005233600452600060245260446000fd5b80600052600060205260406000206001600160a01b03331660005260205260ff604060002054161561170b5750565b63e2517d3f60e01b6000523360045260245260446000fd5b80600052600060205260406000206001600160a01b03831660005260205260ff60406000205416156000146117b65780600052600060205260406000206001600160a01b0383166000526020526040600020600160ff198254161790556001600160a01b03339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4600190565b5050600090565b80600052600060205260406000206001600160a01b03831660005260205260ff604060002054166000146117b65780600052600060205260406000206001600160a01b038316600052602052604060002060ff1981541690556001600160a01b03339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b600080a4600190565b60026001541461185d576002600155565b633ee5aeb560e01b60005260046000fd5b519081151582036106a357565b9190820180921161188857565b634e487b7160e01b600052601160045260246000fd5b60030b600003908160030b91820361188857565b9190820391821161188857565b8181029291811591840414171561188857565b81156118dc570490565b634e487b7160e01b600052601260045260246000fd5b60005b8381106119055750506000910152565b81810151838201526020016118f5565b9060209161192e815180928185528580860191016118f2565b601f01601f1916010190565b60ff6002541661194657565b63d93c066560e01b60005260046000fd5b6119656060830151426118b2565b60075410611a4f57611995604061198a60ff9367ffffffffffffffff865116906118bf565b93015160030b61189e565b1690604d8211611888576119ac91600a0a906118d2565b90670de0b6b3a76400008202828104670de0b6b3a764000014831517156118885760049060206001600160a01b03835416604051938480926375c8e9bf60e11b82525afa908115611a4357600091611a0d575b611a0992506118d2565b9190565b90506020823d602011611a3b575b81611a286020938361161b565b810103126106a357611a099151906119ff565b3d9150611a1b565b6040513d6000823e3d90fd5b63eeb07f6d60e01b60005260046000fd5b6001600160a01b03606460009297959796939682600454169580604051998a95869463330f44a560e11b865216600485015260406024850152816044850152848401378181018301859052601f01601f19168101030181855afa938415611a4357600094611bcd575b506020916000604051611adc858261161b565b52845180159081611b9f575b50611b9157604080518092631996e1cb60e31b82528560048301528180611b12602482018b611915565b03915afa928315611a4357600091600094611b53575b5050611b46611b4c936103e8611b3f81948a6118bf565b04976118bf565b04611957565b5091929190565b915092506040813d604011611b89575b81611b706040938361161b565b810103126106a357805192015191611b466103e8611b28565b3d9150611b63565b505050915090600090600090565b868501207fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47014905038611ae8565b90933d8082843e611bde818461161b565b8201916020818403126107575780519067ffffffffffffffff8211611c4a570182601f8201121561075757805191611c158361163d565b93611c23604051958661161b565b83855260208484010111610140575090611c4391602080850191016118f2565b9238611ac9565b8280fd5b90611c745750805115611c6357805190602001fd5b630a12f52160e11b60005260046000fd5b81511580611ca3575b611c85575090565b6001600160a01b0390639996b31560e01b6000521660045260246000fd5b50803b15611c7d56fea2646970667358221220d90043a83628bc46a07d9a3fbcbdd786bd7ecdfc2fdb6422e1118ddb9412d1ea64736f6c634300081b0033ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5000000000000000000000000c5d9a2f5ca7fd61f45d1fb57202cbc1d308babd00000000000000000000000004305fb66699c3b2702d4d05cf36551390a4c69c6ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace0000000000000000000000000000000000000000000000000000000000034bc0
Deployed Bytecode
0x6080604052600436101561001b575b361561001957600080fd5b005b6000803560e01c8062cf5db41461152d57806301ffc9a7146114d6578063224bb1ef146113ce578063248a9ca3146113985780632f2ff15d1461135757806336568abe146113125780633a0bdd1d14610c165780633f4ba83a14610bae57806344aa886614610b8b5780634fb52c7014610b685780635c975abb14610b455780637c3f2c6f14610b0a5780638456cb5914610aaf5780638d928af814610a8857806391d1485414610a3c57806392cd1ff214610a20578063949565f5146102435780639f55029314610225578063a217fddf14610209578063bcdb446b146101b0578063d547741f14610166578063d8830c7d146101435763e75235b814610123575061000e565b346101405780600319360112610140576020600754604051908152f35b80fd5b50346101405780600319360112610140576020604051670de0b6b3a76400008152f35b5034610140576040366003190112610140576101ac600435610186611589565b906101a76101a282600052600060205260016040600020015490565b6116dc565b6117bd565b5080f35b50346101405780600319360112610140576101c9611689565b7f815a9309d0bd0941820f20874f465a2520e31601d404231cf07c8e65a0511a796020478380808084335af1506101fe611659565b50604051908152a180f35b5034610140578060031936011261014057602090604051908152f35b50346101405780600319360112610140576020600354604051908152f35b50604036600319011261014057610258611573565b9060243567ffffffffffffffff81116107575761027990369060040161159f565b90927fa1ebb7d53776b44b6a78c0be0e62740fc5e5842f5ecb962ccba9b798f5c34698835282602052604083206001600160a01b03331660005260205260ff60406000205416156109e9576102cc61184c565b6102d461193a565b6001600160a01b0381169081156109da576001600160a01b03600454166040516308bcf8b560e21b8152602081600481855afa9081156106b05786916109a0575b5015610991576001600160a01b03600554169560806006546024604051809a81936396834ad360e01b835260048301525afa9687156106b0578697610901575b5060405163a32bf59760e01b815292602084600481865afa9384156108c25787946108cd575b506040519363023c4c9f60e61b8552600485015260a084602481865afa9384156108c257879461083d575b5060208401516003811015610829576000190161081a576103c78834611957565b969060405190633d2708f360e01b8252886004830152806024830152602082604481895afa9081156107a7578a916107e4575b610404925061187b565b94610418866060608084015193015161187b565b116107d55760ff61042f60408b015160030b61189e565b1667ffffffffffffffff8a511661044a60608c0151426118b2565b600754106107c65761045c90346118bf565b90670de0b6b3a7640000820291808304670de0b6b3a764000014901517156107b257601201806012116107b257604d81116107b2579061049f91600a0a906118d2565b9260405163d6362e9760e01b8152602081600481895afa9081156107a7579085918b91610772575b50116107635788996004936020999a936104e2933492611a60565b604051631d8cf42560e11b8152929991969094839182905afa80156106d4578291829161071a575b5081809161051888346118b2565b905af1610523611659565b501561070b5790829188936106df575b61053f3460035461187b565b6003556001600160a01b0360045416803b156106d0578492836040518096819582946336cd28cf60e01b84528c600485015273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee602485015260448401528a606484015260e060848401526105ab8d60e4850190611915565b9160a484015260c483015203925af180156106d4576106bb575b505060049360206001600160a01b038654166040519687809263a32bf59760e01b82525afa9081156106b0578691610657575b7f9dabce3b9e9473d2a085256109a4eedfa18c711cea72edab0a8f655c7c888b839550610637604051958695865260c0602087015260c0860190611915565b923460408601526060850152608084015260a08301520390a16001805580f35b90506020853d6020116106a8575b816106726020938361161b565b810103126106a3577f9dabce3b9e9473d2a085256109a4eedfa18c711cea72edab0a8f655c7c888b839451906105f8565b600080fd5b3d9150610665565b6040513d88823e3d90fd5b816106c59161161b565b6106d05784386105c5565b8480fd5b6040513d84823e3d90fd5b909192808080866001600160a01b03600454165af16106fc611659565b501561070b5790879291610533565b6384081a9360e01b8852600488fd5b9150506020813d60201161075b575b816107366020938361161b565b8101031261075757516001600160a01b03811681036107575781908161050a565b5080fd5b3d9150610729565b63c63d17f960e01b8952600489fd5b9150506020813d60201161079f575b8161078e6020938361161b565b810103126106a357849051386104c7565b3d9150610781565b6040513d8c823e3d90fd5b634e487b7160e01b8a52601160045260248afd5b63eeb07f6d60e01b8a5260048afd5b63179f800360e21b8852600488fd5b90506020823d602011610812575b816107ff6020938361161b565b810103126106a3576104049151906103fa565b3d91506107f2565b6371bb303f60e01b8752600487fd5b634e487b7160e01b88526021600452602488fd5b90935060a0813d60a0116108ba575b8161085960a0938361161b565b810103126108b6576040519061086e826115ff565b6108778161186e565b8252602081015160038110156108b25790608091602084015260408101516040840152606081015160608401520151608082015292386103a6565b8880fd5b8680fd5b3d915061084c565b6040513d89823e3d90fd5b9093506020813d6020116108f9575b816108e96020938361161b565b810103126106a35751923861037b565b3d91506108dc565b9096506080813d608011610989575b8161091d6080938361161b565b810103126109855760405190610932826115cd565b80518060070b8103610981578252602081015167ffffffffffffffff8116810361098157602083015260408101518060030b810361098157906060916040840152015160608201529538610355565b8780fd5b8580fd5b3d9150610910565b6359c36eed60e01b8552600485fd5b90506020813d6020116109d2575b816109bb6020938361161b565b81010312610985576109cc9061186e565b38610315565b3d91506109ae565b63476824bb60e01b8452600484fd5b63e2517d3f60e01b8352336004527fa1ebb7d53776b44b6a78c0be0e62740fc5e5842f5ecb962ccba9b798f5c34698602452604483fd5b5034610140578060031936011261014057602060405160128152f35b5034610140576040366003190112610140576001600160a01b036040610a60611589565b92600435815280602052209116600052602052602060ff604060002054166040519015158152f35b503461014057806003193601126101405760206001600160a01b0360045416604051908152f35b5034610140578060031936011261014057610ac8611689565b610ad061193a565b600160ff1960025416176002557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b503461014057806003193601126101405760206040517fa1ebb7d53776b44b6a78c0be0e62740fc5e5842f5ecb962ccba9b798f5c346988152f35b5034610140578060031936011261014057602060ff600254166040519015158152f35b503461014057602036600319011261014057610b82611689565b60043560075580f35b503461014057602036600319011261014057610ba5611689565b60043560065580f35b5034610140578060031936011261014057610bc7611689565b60025460ff811615610c075760ff19166002557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b638dfc202b60e01b8252600482fd5b5060203660031901126101405760043567ffffffffffffffff811161075757610c4390369060040161159f565b90610c4c61184c565b610c5461193a565b3315611303576001600160a01b03600454166040516308bcf8b560e21b8152602081600481855afa9081156110055785916112c9575b50156112ba576001600160a01b03600554169260806006546024604051809781936396834ad360e01b835260048301525afa938415611005578594611232575b5060405163a32bf59760e01b815293602085600481865afa9485156106b05786956111fe575b506040519463023c4c9f60e61b8652600486015260a085602481865afa9485156106b0578695611181575b506020850151600381101561116d576000190161115e57610d3c8134611957565b949060405190633d2708f360e01b8252866004830152806024830152602082604481895afa9081156110eb578991611128575b610d79925061187b565b95610d8d876060608084015193015161187b565b116111195760ff610da4604084015160030b61189e565b1667ffffffffffffffff835116610dbf6060850151426118b2565b6007541061110a57610dd190346118bf565b90670de0b6b3a7640000820291808304670de0b6b3a764000014901517156110f657601201806012116110f657604d81116110f65790610e1491600a0a906118d2565b9260405163d6362e9760e01b8152602081600481895afa80156110eb5785918a916110b6575b50116110a757610e566004936020979695938a93349133611a60565b604051631d8cf42560e11b8152929891969095839182905afa80156106d45782918291611062575b50818091610e8c88346118b2565b905af1610e97611659565b50156110535790869183611029575b610eb23460035461187b565b6003556001600160a01b036004541690813b1561102557836040518096819582946336cd28cf60e01b845233600485015273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee602485015260448401528b606484015260e06084840152610f1c60e484018c611915565b9160a484015260c483015203925af1801561100557611010575b5060049060206001600160a01b038354166040519384809263a32bf59760e01b82525afa918215611005578592610fab575b509261063792917f9dabce3b9e9473d2a085256109a4eedfa18c711cea72edab0a8f655c7c888b839460405194859433865260c0602087015260c0860190611915565b929150926020833d602011610ffd575b81610fc86020938361161b565b810103126106a357915191929091907f9dabce3b9e9473d2a085256109a4eedfa18c711cea72edab0a8f655c7c888b83610f68565b3d9150610fbb565b6040513d87823e3d90fd5b9361101e816004939661161b565b9390610f36565b8380fd5b9091808080866001600160a01b03600454165af1611045611659565b501561105357908691610ea6565b6384081a9360e01b8752600487fd5b9150506020813d60201161109f575b8161107e6020938361161b565b8101031261075757516001600160a01b038116810361075757819081610e7e565b3d9150611071565b63c63d17f960e01b8852600488fd5b9150506020813d6020116110e3575b816110d26020938361161b565b810103126108b25784905138610e3a565b3d91506110c5565b6040513d8b823e3d90fd5b634e487b7160e01b89526011600452602489fd5b63eeb07f6d60e01b8952600489fd5b63179f800360e21b8752600487fd5b90506020823d602011611156575b816111436020938361161b565b810103126108b257610d79915190610d6f565b3d9150611136565b6371bb303f60e01b8652600486fd5b634e487b7160e01b87526021600452602487fd5b90945060a0813d60a0116111f6575b8161119d60a0938361161b565b8101031261098557604051906111b2826115ff565b6111bb8161186e565b825260208101519060038210156109815760809160208401526040810151604084015260608101516060840152015160808201529338610d1b565b3d9150611190565b9094506020813d60201161122a575b8161121a6020938361161b565b8101031261098557519338610cf0565b3d915061120d565b9093506080813d6080116112b2575b8161124e6080938361161b565b810103126106d05760405190611263826115cd565b80518060070b81036108b6578252602081015167ffffffffffffffff811681036108b65760208301526040810151908160030b82036108b6576060916040840152015160608201529238610cca565b3d9150611241565b6359c36eed60e01b8452600484fd5b90506020813d6020116112fb575b816112e46020938361161b565b810103126106d0576112f59061186e565b38610c8a565b3d91506112d7565b63476824bb60e01b8352600483fd5b50346101405760403660031901126101405761132c611589565b336001600160a01b03821603611348576101ac906004356117bd565b63334bd91960e11b8252600482fd5b5034610140576040366003190112610140576101ac600435611377611589565b906113936101a282600052600060205260016040600020015490565b611723565b50346101405760203660031901126101405760206113c6600435600052600060205260016040600020015490565b604051908152f35b5034610140576040366003190112610140576113e8611573565b906024356113f4611689565b60405163a9059cbb60e01b60208201908152336024830152604480830184905282526001600160a01b038516949161144b91859182919061143660648261161b565b519082895af1611444611659565b9086611c4e565b80519081151591826114b3575b505061149f57604080516001600160a01b0392909216825260208201929092527f2face92d4acd4873a5b75fd062d53f35714c188a885552ee09eedd96a32db7079190a180f35b635274afe760e01b83526004849052602483fd5b81925090602091810103126110255760206114ce910161186e565b153880611458565b50346101405760203660031901126101405760043563ffffffff60e01b811680910361075757602090637965db0b60e01b811490811561151c575b506040519015158152f35b6301ffc9a760e01b14905082611511565b5034610140576020366003190112610140576001600160a01b0361154f611573565b611557611689565b166bffffffffffffffffffffffff60a01b600554161760055580f35b600435906001600160a01b03821682036106a357565b602435906001600160a01b03821682036106a357565b9181601f840112156106a35782359167ffffffffffffffff83116106a357602083818601950101116106a357565b6080810190811067ffffffffffffffff8211176115e957604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176115e957604052565b90601f8019910116810190811067ffffffffffffffff8211176115e957604052565b67ffffffffffffffff81116115e957601f01601f191660200190565b3d15611684573d9061166a8261163d565b91611678604051938461161b565b82523d6000602084013e565b606090565b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff16156116c257565b63e2517d3f60e01b60005233600452600060245260446000fd5b80600052600060205260406000206001600160a01b03331660005260205260ff604060002054161561170b5750565b63e2517d3f60e01b6000523360045260245260446000fd5b80600052600060205260406000206001600160a01b03831660005260205260ff60406000205416156000146117b65780600052600060205260406000206001600160a01b0383166000526020526040600020600160ff198254161790556001600160a01b03339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4600190565b5050600090565b80600052600060205260406000206001600160a01b03831660005260205260ff604060002054166000146117b65780600052600060205260406000206001600160a01b038316600052602052604060002060ff1981541690556001600160a01b03339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b600080a4600190565b60026001541461185d576002600155565b633ee5aeb560e01b60005260046000fd5b519081151582036106a357565b9190820180921161188857565b634e487b7160e01b600052601160045260246000fd5b60030b600003908160030b91820361188857565b9190820391821161188857565b8181029291811591840414171561188857565b81156118dc570490565b634e487b7160e01b600052601260045260246000fd5b60005b8381106119055750506000910152565b81810151838201526020016118f5565b9060209161192e815180928185528580860191016118f2565b601f01601f1916010190565b60ff6002541661194657565b63d93c066560e01b60005260046000fd5b6119656060830151426118b2565b60075410611a4f57611995604061198a60ff9367ffffffffffffffff865116906118bf565b93015160030b61189e565b1690604d8211611888576119ac91600a0a906118d2565b90670de0b6b3a76400008202828104670de0b6b3a764000014831517156118885760049060206001600160a01b03835416604051938480926375c8e9bf60e11b82525afa908115611a4357600091611a0d575b611a0992506118d2565b9190565b90506020823d602011611a3b575b81611a286020938361161b565b810103126106a357611a099151906119ff565b3d9150611a1b565b6040513d6000823e3d90fd5b63eeb07f6d60e01b60005260046000fd5b6001600160a01b03606460009297959796939682600454169580604051998a95869463330f44a560e11b865216600485015260406024850152816044850152848401378181018301859052601f01601f19168101030181855afa938415611a4357600094611bcd575b506020916000604051611adc858261161b565b52845180159081611b9f575b50611b9157604080518092631996e1cb60e31b82528560048301528180611b12602482018b611915565b03915afa928315611a4357600091600094611b53575b5050611b46611b4c936103e8611b3f81948a6118bf565b04976118bf565b04611957565b5091929190565b915092506040813d604011611b89575b81611b706040938361161b565b810103126106a357805192015191611b466103e8611b28565b3d9150611b63565b505050915090600090600090565b868501207fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47014905038611ae8565b90933d8082843e611bde818461161b565b8201916020818403126107575780519067ffffffffffffffff8211611c4a570182601f8201121561075757805191611c158361163d565b93611c23604051958661161b565b83855260208484010111610140575090611c4391602080850191016118f2565b9238611ac9565b8280fd5b90611c745750805115611c6357805190602001fd5b630a12f52160e11b60005260046000fd5b81511580611ca3575b611c85575090565b6001600160a01b0390639996b31560e01b6000521660045260246000fd5b50803b15611c7d56fea2646970667358221220d90043a83628bc46a07d9a3fbcbdd786bd7ecdfc2fdb6422e1118ddb9412d1ea64736f6c634300081b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c5d9a2f5ca7fd61f45d1fb57202cbc1d308babd00000000000000000000000004305fb66699c3b2702d4d05cf36551390a4c69c6ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace0000000000000000000000000000000000000000000000000000000000034bc0
-----Decoded View---------------
Arg [0] : vault_ (address): 0xC5D9a2f5cA7fD61f45d1FB57202cbC1d308babD0
Arg [1] : priceFeed_ (address): 0x4305FB66699C3B2702D4d05CF36551390A4c69C6
Arg [2] : id_ (bytes32): 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace
Arg [3] : threshold_ (uint256): 216000
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000c5d9a2f5ca7fd61f45d1fb57202cbc1d308babd0
Arg [1] : 0000000000000000000000004305fb66699c3b2702d4d05cf36551390a4c69c6
Arg [2] : ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace
Arg [3] : 0000000000000000000000000000000000000000000000000000000000034bc0
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | Ether (ETH) | 100.00% | $3,489.39 | 0.0604 | $210.6 |
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.