More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 105 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Start Round | 21472827 | 5 mins ago | IN | 0 ETH | 0.00097471 | ||||
End Round | 21472802 | 10 mins ago | IN | 0 ETH | 0.00078545 | ||||
Claim Selected R... | 21470582 | 7 hrs ago | IN | 0 ETH | 0.00045294 | ||||
Claim Selected R... | 21464812 | 27 hrs ago | IN | 0 ETH | 0.0005276 | ||||
Start Round | 21451334 | 3 days ago | IN | 0 ETH | 0.00057928 | ||||
End Round | 21451309 | 3 days ago | IN | 0 ETH | 0.00060635 | ||||
Claim Selected R... | 21433940 | 5 days ago | IN | 0 ETH | 0.00093703 | ||||
Start Round | 21429817 | 6 days ago | IN | 0 ETH | 0.00130064 | ||||
End Round | 21429792 | 6 days ago | IN | 0 ETH | 0.00104891 | ||||
Claim Selected R... | 21429162 | 6 days ago | IN | 0 ETH | 0.00128738 | ||||
Claim Selected R... | 21415549 | 8 days ago | IN | 0 ETH | 0.00171267 | ||||
Start Round | 21408271 | 9 days ago | IN | 0 ETH | 0.00069441 | ||||
End Round | 21408246 | 9 days ago | IN | 0 ETH | 0.00055955 | ||||
Claim Selected R... | 21407844 | 9 days ago | IN | 0 ETH | 0.00052948 | ||||
Claim Selected R... | 21404472 | 9 days ago | IN | 0 ETH | 0.00084642 | ||||
Set Round | 21393221 | 11 days ago | IN | 0 ETH | 0.00122193 | ||||
Set Round | 21393219 | 11 days ago | IN | 0 ETH | 0.00131929 | ||||
Set Round | 21393217 | 11 days ago | IN | 0 ETH | 0.00133853 | ||||
Set Round | 21393215 | 11 days ago | IN | 0 ETH | 0.00133779 | ||||
Set Round | 21393213 | 11 days ago | IN | 0 ETH | 0.00134019 | ||||
Set Round | 21393212 | 11 days ago | IN | 0 ETH | 0.00129727 | ||||
Set Round | 21393211 | 11 days ago | IN | 0 ETH | 0.00129721 | ||||
Set Round | 21393209 | 11 days ago | IN | 0 ETH | 0.00133275 | ||||
Set Round | 21393207 | 11 days ago | IN | 0 ETH | 0.00135916 | ||||
Claim Selected R... | 21392383 | 11 days ago | IN | 0 ETH | 0.00084913 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
21470582 | 7 hrs ago | 0.038484 ETH | ||||
21464812 | 27 hrs ago | 0.0168 ETH | ||||
21458241 | 2 days ago | 0.0168 ETH | ||||
21448498 | 3 days ago | 0.019476 ETH | ||||
21444346 | 3 days ago | 0.019008 ETH | ||||
21433940 | 5 days ago | 0.257796 ETH | ||||
21429162 | 6 days ago | 0.051462 ETH | ||||
21429157 | 6 days ago | 0.051462 ETH | ||||
21417269 | 7 days ago | 0.009 ETH | ||||
21412119 | 8 days ago | 0.00558 ETH | ||||
21408542 | 8 days ago | 0.00504 ETH | ||||
21407844 | 9 days ago | 0.10404 ETH | ||||
21405898 | 9 days ago | 0.09 ETH | ||||
21404472 | 9 days ago | 0.00672 ETH | ||||
21398002 | 10 days ago | 0.005382 ETH | ||||
21392383 | 11 days ago | 0.0192 ETH | ||||
21390975 | 11 days ago | 0.00576 ETH | ||||
21385509 | 12 days ago | 0.00672 ETH | ||||
21382687 | 12 days ago | 0.013806 ETH | ||||
21382644 | 12 days ago | 0.010566 ETH | ||||
21382569 | 12 days ago | 0.072 ETH | ||||
21381886 | 12 days ago | 0.0192 ETH | ||||
21377072 | 13 days ago | 0.027 ETH | ||||
21377065 | 13 days ago | 0.027 ETH | ||||
21370754 | 14 days ago | 0.016182 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
DataVault
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 {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; import {IDataVault} from "./interfaces/IDataVault.sol"; import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; contract DataVault is AccessControl, ReentrancyGuard, EIP712, IDataVault { using ECDSA for bytes32; using Strings for string; using SafeERC20 for IERC20; bytes32 public constant STREAMER_ROLE = keccak256("STREAMER_ROLE"); bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 public constant SERVER_ROLE = keccak256("SERVER_ROLE"); bytes32 internal constant SIGN_TYPEHASH = keccak256("ClaimSelectedRewards(address[] assets,string ratedPerson,address user,uint256 deadline)"); address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address internal constant TOKEN_ADDRESS = 0x0000000000000000000000000000000000000001; address private signer; address private _treasury; RoundStatus private _roundStatus; Round[] private _rounds; uint256 private _currentRound; uint256 private _min; uint256 private _main = 50; uint256 private _secondary = 50; uint256 private _totalSoldTokens; mapping(address => uint256) private _amounts; mapping(address => mapping(uint256 => uint256)) private _roundBalances; mapping(string => PersonalRates) private _personalRates; mapping(address => string) private _ratedPeople; mapping(string => mapping(address => uint256)) private _personalRatesAmounts; mapping(bytes32 => bool) private _proofs; RewardMilestone[] private _rewardMilestones; bool private _trust; event UpdatedRoundStatus(RoundStatus roundStatus); event StartedRound(uint256 round); event EndedRound(uint256 round); event AddedRound(uint256 price, uint256 supply); event UpdatedPrice(uint256 round, uint256 price); event UpdatedSupply(uint256 round, uint256 supply); event UpdatedMin(uint256 amount); event UpdatedTreasury(address treasury); event UpdatedDefaultRates(uint256 mainRate, uint256 secondaryRate); event UpdatedPersonalRates(string ratedPerson, uint256 mainRate, uint256 secondaryRate); event EnabledPersonalRates(string ratedPerson); event DisabledPersonalRates(string ratedPerson); event ClaimedRewards(string ratedPerson, address token, uint256 amount); error InvalidArraysError(); error StartedError(); error EndedError(); error NullAddressError(); error UndefinedRoundError(uint256 index_); error StartedRoundError(uint256 index_); error EndedRoundError(uint256 index_); error ExceededSupplyError(uint256 index_); error UnattainedMinAmountError(uint256 amount_, uint256 min_); error UnattainedMainRateError(uint256 reward_); error UnattainedSecondaryRateError(uint256 reward_); error UndefinedPersonalRatesError(string ratedPerson_); error EnabledPersonalRatesError(string ratedPerson_); error DisabledPersonalRatesError(string ratedPerson_); error UndefinedTokenError(); error FailedEthTransferError(); error UndefinedBESignerError(); error ExpiredDeadlineError(uint256 deadline_); error InvalidMessageSignerError(address recovered_); error UsedHashError(); constructor(address treasury_, address signer_) EIP712("DataVault", "v1.0") { if (treasury_ == address(0)) { revert NullAddressError(); } _treasury = treasury_; signer = signer_; _min = 1000000000000000000; _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); _grantRole(STREAMER_ROLE, _msgSender()); _grantRole(ADMIN_ROLE, _msgSender()); _grantRole(SERVER_ROLE, _msgSender()); } function startSale() external onlyRole(DEFAULT_ADMIN_ROLE) { if (_roundStatus != RoundStatus.UNDEFINED) { revert StartedError(); } _roundStatus = RoundStatus.Started; emit UpdatedRoundStatus(_roundStatus); } function endSale() external onlyRole(DEFAULT_ADMIN_ROLE) { if (!isActive()) { revert EndedError(); } _roundStatus = RoundStatus.Ended; emit UpdatedRoundStatus(_roundStatus); } function setRound( uint256 price_, uint256 supply_ ) external onlyRole(ADMIN_ROLE) { if (isInactive()) { revert EndedError(); } _rounds.push( Round({ defined: true, roundStatus: RoundStatus.UNDEFINED, price: price_, soldTokens: 0, supply: supply_ }) ); emit AddedRound(price_, supply_); } function setDefaultRates( uint256 mainRate_, uint256 secondaryRate_ ) external onlyRole(ADMIN_ROLE) { if (isInactive()) { revert EndedError(); } if (mainRate_ > 1000) { revert UnattainedMainRateError(mainRate_); } if (secondaryRate_ > 1000) { revert UnattainedSecondaryRateError(secondaryRate_); } _main = mainRate_; _secondary = secondaryRate_; emit UpdatedDefaultRates(_main, _secondary); } function updatePersonalRates( string[] calldata ratedPerson_, uint256[] calldata mainRate_, uint256[] calldata secondaryRate_ ) external onlyRole(SERVER_ROLE) { if (isInactive()) { revert EndedError(); } if (ratedPerson_.length != mainRate_.length || ratedPerson_.length != secondaryRate_.length) { revert InvalidArraysError(); } for (uint256 index = 0; index < ratedPerson_.length; index++) { _personalRates[ratedPerson_[index]] = PersonalRates({ defined: true, enabled: true, mainRate: mainRate_[index], secondaryRate: secondaryRate_[index] }); emit UpdatedPersonalRates(ratedPerson_[index], mainRate_[index], secondaryRate_[index]); } } function setRoundPrice( uint256 index_, uint256 price_ ) external onlyRole(ADMIN_ROLE) { if (isInactive()) { revert EndedError(); } if (!_rounds[index_].defined) { revert UndefinedRoundError(index_); } if (_rounds[index_].roundStatus != RoundStatus.UNDEFINED) { revert StartedRoundError(index_); } _rounds[index_].price = price_; emit UpdatedPrice(index_, price_); } function setRoundSupply( uint256 index_, uint256 supply_ ) external onlyRole(ADMIN_ROLE) { if (isInactive()) { revert EndedError(); } if (!_rounds[index_].defined) { revert UndefinedRoundError(index_); } if (_rounds[index_].roundStatus == RoundStatus.Ended) { revert EndedRoundError(index_); } if (_rounds[index_].soldTokens > supply_) { revert ExceededSupplyError(index_); } _rounds[index_].supply = supply_; emit UpdatedSupply(index_, supply_); } function startRound(uint256 index_) external onlyRole(SERVER_ROLE) { if (!isActive()) { revert EndedError(); } if (!_rounds[index_].defined) { revert UndefinedRoundError(index_); } if (_rounds[_currentRound].roundStatus == RoundStatus.Started) { _rounds[_currentRound].roundStatus = RoundStatus.Ended; } _rounds[index_].roundStatus = RoundStatus.Started; _currentRound = index_; emit StartedRound(index_); } function endRound(uint256 index_) external onlyRole(SERVER_ROLE) { if (!_rounds[index_].defined) { revert UndefinedRoundError(index_); } _rounds[index_].roundStatus = RoundStatus.Ended; emit EndedRound(index_); } function setMin(uint256 amount_) external onlyRole(ADMIN_ROLE) { _min = amount_; emit UpdatedMin(_min); } function setSigner(address signer_) external onlyRole(DEFAULT_ADMIN_ROLE) { if (signer_ == address(0)) { revert NullAddressError(); } signer = signer_; } function setTreasury(address treasury_) external onlyRole(DEFAULT_ADMIN_ROLE) { if (treasury_ == address(0)) { revert NullAddressError(); } _treasury = treasury_; emit UpdatedTreasury(_treasury); } function setRoundStatus( address user_, address token_, uint256 amount_, uint256 sold_, string calldata ratedPerson_, uint256 main_, uint256 secondary_ ) external onlyRole(STREAMER_ROLE) { _amounts[user_] = _amounts[user_] + amount_; _totalSoldTokens = _totalSoldTokens + sold_; _rounds[_currentRound].soldTokens = _rounds[_currentRound].soldTokens + sold_; _roundBalances[user_][_currentRound] = _roundBalances[user_][_currentRound] + sold_; if (!ratedPerson_.equal("")) { if (!_personalRates[ratedPerson_].defined) { _personalRates[ratedPerson_].defined = true; _personalRates[ratedPerson_].enabled = true; emit UpdatedPersonalRates(ratedPerson_, _main, _secondary); } _personalRatesAmounts[ratedPerson_][token_] += main_; _personalRatesAmounts[ratedPerson_][TOKEN_ADDRESS] += secondary_; _ratedPeople[user_] = ratedPerson_; } } function setTrustPassedCode(bool value_) external onlyRole(ADMIN_ROLE) { _trust = value_; } function enablePersonalRates(string calldata ratedPerson_) external onlyRole(ADMIN_ROLE) { if (!_personalRates[ratedPerson_].defined) { revert UndefinedPersonalRatesError(ratedPerson_); } if (_personalRates[ratedPerson_].enabled) { revert EnabledPersonalRatesError(ratedPerson_); } _personalRates[ratedPerson_].enabled = true; emit EnabledPersonalRates(ratedPerson_); } function disablePersonalRates(string calldata ratedPerson_) external onlyRole(ADMIN_ROLE) { if (!_personalRates[ratedPerson_].defined) { revert UndefinedPersonalRatesError(ratedPerson_); } if (!_personalRates[ratedPerson_].enabled) { revert DisabledPersonalRatesError(ratedPerson_); } _personalRates[ratedPerson_].enabled = false; emit DisabledPersonalRates(ratedPerson_); } function claimSelectedRewards(address[] memory assets_, string memory ratedPerson_, uint256 deadline_, uint8 v, bytes32 r, bytes32 s) external nonReentrant { address user_ = _msgSender(); if (signer == address(0)) { revert UndefinedBESignerError(); } if (deadline_ <= block.timestamp) { revert ExpiredDeadlineError(deadline_); } bytes32 hash = _hashTypedDataV4( keccak256( abi.encode( SIGN_TYPEHASH, keccak256(abi.encodePacked(assets_)), keccak256(bytes(ratedPerson_)), user_, deadline_ ) ) ); address recovered = hash.recover(v, r, s); if (recovered != signer) { revert InvalidMessageSignerError(recovered); } if (_proofs[hash]) { revert UsedHashError(); } _proofs[hash] = true; if (assets_.length == 0) { revert UndefinedTokenError(); } if (!_personalRates[ratedPerson_].defined) { revert UndefinedPersonalRatesError(ratedPerson_); } if (!_personalRates[ratedPerson_].enabled) { revert DisabledPersonalRatesError(ratedPerson_); } for (uint256 i = 0; i < assets_.length; i++) { address token = assets_[i]; uint256 balance = _personalRatesAmounts[ratedPerson_][token]; if (balance == 0) { continue; } _personalRatesAmounts[ratedPerson_][token] = 0; if (token == ETH_ADDRESS) { (bool success, ) = user_.call{value: balance}(""); if (!success) revert FailedEthTransferError(); } else { IERC20(token).safeTransfer(user_, balance); } emit ClaimedRewards(ratedPerson_, token, balance); } } function setRewardMilestones(uint256[] calldata reward_, uint256[] calldata milestone_) external onlyRole(ADMIN_ROLE) { if (reward_.length != milestone_.length) { revert InvalidArraysError(); } delete _rewardMilestones; for (uint256 idx = 0; idx < reward_.length; idx++) { if (idx == 0) { if (reward_[0] == 0 || milestone_[0] == 0) { revert InvalidArraysError(); } } else { if (reward_[idx - 1] > reward_[idx] || milestone_[idx - 1] > milestone_[idx]) { revert InvalidArraysError(); } } _rewardMilestones.push(RewardMilestone({ reward: reward_[idx], milestone: milestone_[idx] })); } } function recoverCoin() external onlyRole(DEFAULT_ADMIN_ROLE) { uint256 balance = address(this).balance; _msgSender().call{value: balance}(""); } function recoverErc20(address token_, uint256 amount_) external onlyRole(DEFAULT_ADMIN_ROLE) { IERC20(token_).safeTransfer(_msgSender(), amount_); } function getTreasury() external view returns (address) { return _treasury; } function getMin() external view returns (uint256) { return _min; } function getRoundsCount() external view returns (uint256) { return _rounds.length; } function getCurrentRound() external view returns (uint256) { return _currentRound; } function getRound(uint256 index_) external view returns (Round memory) { return _rounds[index_]; } function getTotalSoldTokens() external view returns (uint256) { return _totalSoldTokens; } function balanceOf(uint256 round_, address user_) external view returns (uint256) { return _roundBalances[user_][round_]; } function rewardBalanceOf(address token_, string calldata user_) external view returns (uint256) { return _personalRatesAmounts[user_][token_]; } function getDefaultRates() external view returns (uint256, uint256) { return (_main, _secondary); } function getRatedPerson(address user_, string calldata ratedPerson_) external view returns (string memory) { if (_trust) { return ratedPerson_; } PersonalRates memory rec = _personalRates[_ratedPeople[user_]]; if (rec.defined && rec.enabled) { return _ratedPeople[user_]; } rec = _personalRates[ratedPerson_]; if (!rec.defined || rec.enabled) { return ratedPerson_; } return ""; } function getPersonalRates(string calldata ratedPerson_) external view returns (uint256, uint256) { PersonalRates memory rec = _personalRates[ratedPerson_]; if (rec.defined) { return ( Math.max(rec.mainRate, _main), Math.max(rec.secondaryRate, _secondary) ); } return (_main, _secondary); } function getRewardMilestones() external view returns (RewardMilestone[] memory) { return _rewardMilestones; } function isActive() public view returns (bool) { return _roundStatus == RoundStatus.Started; } function isInactive() public view returns (bool) { return _roundStatus == RoundStatus.Ended; } function getCurrentPrice() public view returns (uint256) { if (_rounds[_currentRound].roundStatus == RoundStatus.Started) { return _rounds[_currentRound].price; } return 0; } function getRewardForMilestone(uint256 usd, uint256 token) external view returns(uint256) { if (_rewardMilestones.length == 0) { return 0; } int256 target = -1; for (uint256 index = 0; index < _rewardMilestones.length; index++) { if (usd >= _rewardMilestones[index].milestone) { target = int256(index); } else { break; } } if (target == -1) { return 0; } return token * _rewardMilestones[uint256(target)].reward / (10 ** 18); } 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) (interfaces/IERC5267.sol) pragma solidity ^0.8.20; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// 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/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.20; import {MessageHashUtils} from "./MessageHashUtils.sol"; import {ShortStrings, ShortString} from "../ShortStrings.sol"; import {IERC5267} from "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * @custom:oz-upgrades-unsafe-allow state-variable-immutable */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {IERC-5267}. */ function eip712Domain() public view virtual returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _EIP712Name(), _EIP712Version(), block.chainid, address(this), bytes32(0), new uint256[](0) ); } /** * @dev The name parameter for the EIP712 domain. * * NOTE: By default this function reads _name which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Name() internal view returns (string memory) { return _name.toStringWithFallback(_nameFallback); } /** * @dev The version parameter for the EIP712 domain. * * NOTE: By default this function reads _version which is an immutable value. * It only reads from storage if necessary (in case the value is too large to fit in a ShortString). */ // solhint-disable-next-line func-name-mixedcase function _EIP712Version() internal view returns (string memory) { return _version.toStringWithFallback(_versionFallback); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// 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/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/ShortStrings.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using * {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// 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: 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","name":"treasury_","type":"address"},{"internalType":"address","name":"signer_","type":"address"}],"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":[{"internalType":"string","name":"ratedPerson_","type":"string"}],"name":"DisabledPersonalRatesError","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"string","name":"ratedPerson_","type":"string"}],"name":"EnabledPersonalRatesError","type":"error"},{"inputs":[],"name":"EndedError","type":"error"},{"inputs":[{"internalType":"uint256","name":"index_","type":"uint256"}],"name":"EndedRoundError","type":"error"},{"inputs":[{"internalType":"uint256","name":"index_","type":"uint256"}],"name":"ExceededSupplyError","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline_","type":"uint256"}],"name":"ExpiredDeadlineError","type":"error"},{"inputs":[],"name":"FailedEthTransferError","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidArraysError","type":"error"},{"inputs":[{"internalType":"address","name":"recovered_","type":"address"}],"name":"InvalidMessageSignerError","type":"error"},{"inputs":[],"name":"InvalidShortString","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":"StartedError","type":"error"},{"inputs":[{"internalType":"uint256","name":"index_","type":"uint256"}],"name":"StartedRoundError","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[{"internalType":"uint256","name":"reward_","type":"uint256"}],"name":"UnattainedMainRateError","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount_","type":"uint256"},{"internalType":"uint256","name":"min_","type":"uint256"}],"name":"UnattainedMinAmountError","type":"error"},{"inputs":[{"internalType":"uint256","name":"reward_","type":"uint256"}],"name":"UnattainedSecondaryRateError","type":"error"},{"inputs":[],"name":"UndefinedBESignerError","type":"error"},{"inputs":[{"internalType":"string","name":"ratedPerson_","type":"string"}],"name":"UndefinedPersonalRatesError","type":"error"},{"inputs":[{"internalType":"uint256","name":"index_","type":"uint256"}],"name":"UndefinedRoundError","type":"error"},{"inputs":[],"name":"UndefinedTokenError","type":"error"},{"inputs":[],"name":"UsedHashError","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"supply","type":"uint256"}],"name":"AddedRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"ratedPerson","type":"string"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimedRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"ratedPerson","type":"string"}],"name":"DisabledPersonalRates","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"ratedPerson","type":"string"}],"name":"EnabledPersonalRates","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"EndedRound","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":"uint256","name":"round","type":"uint256"}],"name":"StartedRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"mainRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"secondaryRate","type":"uint256"}],"name":"UpdatedDefaultRates","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UpdatedMin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"ratedPerson","type":"string"},{"indexed":false,"internalType":"uint256","name":"mainRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"secondaryRate","type":"uint256"}],"name":"UpdatedPersonalRates","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"UpdatedPrice","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum IDataVault.RoundStatus","name":"roundStatus","type":"uint8"}],"name":"UpdatedRoundStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"supply","type":"uint256"}],"name":"UpdatedSupply","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"treasury","type":"address"}],"name":"UpdatedTreasury","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SERVER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STREAMER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"round_","type":"uint256"},{"internalType":"address","name":"user_","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets_","type":"address[]"},{"internalType":"string","name":"ratedPerson_","type":"string"},{"internalType":"uint256","name":"deadline_","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"claimSelectedRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"ratedPerson_","type":"string"}],"name":"disablePersonalRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"ratedPerson_","type":"string"}],"name":"enablePersonalRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index_","type":"uint256"}],"name":"endRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDefaultRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"ratedPerson_","type":"string"}],"name":"getPersonalRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user_","type":"address"},{"internalType":"string","name":"ratedPerson_","type":"string"}],"name":"getRatedPerson","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usd","type":"uint256"},{"internalType":"uint256","name":"token","type":"uint256"}],"name":"getRewardForMilestone","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardMilestones","outputs":[{"components":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"milestone","type":"uint256"}],"internalType":"struct IDataVault.RewardMilestone[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index_","type":"uint256"}],"name":"getRound","outputs":[{"components":[{"internalType":"bool","name":"defined","type":"bool"},{"internalType":"enum IDataVault.RoundStatus","name":"roundStatus","type":"uint8"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"soldTokens","type":"uint256"},{"internalType":"uint256","name":"supply","type":"uint256"}],"internalType":"struct IDataVault.Round","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRoundsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalSoldTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTreasury","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":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isInactive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recoverCoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"recoverErc20","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":"token_","type":"address"},{"internalType":"string","name":"user_","type":"string"}],"name":"rewardBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mainRate_","type":"uint256"},{"internalType":"uint256","name":"secondaryRate_","type":"uint256"}],"name":"setDefaultRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"setMin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"reward_","type":"uint256[]"},{"internalType":"uint256[]","name":"milestone_","type":"uint256[]"}],"name":"setRewardMilestones","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price_","type":"uint256"},{"internalType":"uint256","name":"supply_","type":"uint256"}],"name":"setRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index_","type":"uint256"},{"internalType":"uint256","name":"price_","type":"uint256"}],"name":"setRoundPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user_","type":"address"},{"internalType":"address","name":"token_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"},{"internalType":"uint256","name":"sold_","type":"uint256"},{"internalType":"string","name":"ratedPerson_","type":"string"},{"internalType":"uint256","name":"main_","type":"uint256"},{"internalType":"uint256","name":"secondary_","type":"uint256"}],"name":"setRoundStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index_","type":"uint256"},{"internalType":"uint256","name":"supply_","type":"uint256"}],"name":"setRoundSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer_","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"treasury_","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value_","type":"bool"}],"name":"setTrustPassedCode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index_","type":"uint256"}],"name":"startRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startSale","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":[{"internalType":"string[]","name":"ratedPerson_","type":"string[]"},{"internalType":"uint256[]","name":"mainRate_","type":"uint256[]"},{"internalType":"uint256[]","name":"secondaryRate_","type":"uint256[]"}],"name":"updatePersonalRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
61016080604052346101ec576040816135a3803803809161002082856101f1565b8339810103126101ec5761003f60206100388361022a565b920161022a565b9060405161004e6040826101f1565b6009815260208101906811185d1855985d5b1d60ba1b8252604051916100756040846101f1565b60048352602083019163076312e360e41b835260018055610095816104a6565b610120526100a28461066a565b61014052519020918260e05251902080610100524660a0526040519060208201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f8452604083015260608201524660808201523060a082015260a0815261010b60c0826101f1565b5190206080523060c05260326009819055600a556001600160a01b031680156101db5760018060a01b0319600554161760055560018060a01b031660018060a01b03196004541617600455670de0b6b3a764000060085561016b3361023e565b50610175336102ba565b5061017f33610376565b506101893361040e565b50604051612d1a9081610809823960805181612a9c015260a05181612b59015260c05181612a6d015260e05181612aeb01526101005181612b1101526101205181610c7c01526101405181610ca50152f35b63476824bb60e01b60005260046000fd5b600080fd5b601f909101601f19168101906001600160401b0382119082101761021457604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036101ec57565b6001600160a01b0381166000908152600080516020613583833981519152602052604090205460ff166102b4576001600160a01b0316600081815260008051602061358383398151915260205260408120805460ff191660011790553391906000805160206135238339815191528180a4600190565b50600090565b6001600160a01b03811660009081527f73a0e851d3bf6fc5b7d715a1724e56c8ed39eb00b9b99e8a3f26be26e3bdaa18602052604090205460ff166102b4576001600160a01b031660008181527f73a0e851d3bf6fc5b7d715a1724e56c8ed39eb00b9b99e8a3f26be26e3bdaa1860205260408120805460ff191660011790553391907f41d12fe3b2ffe2aea01a3e08ec191d0142900efe396c6cd50b857af5b6f1bdae906000805160206135238339815191529080a4600190565b6001600160a01b0381166000908152600080516020613543833981519152602052604090205460ff166102b4576001600160a01b0316600081815260008051602061354383398151915260205260408120805460ff191660011790553391907fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775906000805160206135238339815191529080a4600190565b6001600160a01b0381166000908152600080516020613563833981519152602052604090205460ff166102b4576001600160a01b0316600081815260008051602061356383398151915260205260408120805460ff191660011790553391907fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc77906000805160206135238339815191529080a4600190565b9081516020811060001461053e575090601f8151116104e25760208151910151602082106104d2571790565b6000198260200360031b1b161790565b6040519063305a27a960e01b8252602060048301528181519182602483015260005b8381106105265750508160006044809484010152601f80199101168101030190fd5b60208282018101516044878401015285935001610504565b6001600160401b03811161021457600254600181811c91168015610660575b602082101461064a57601f8111610614575b50602092601f82116001146105af57928192936000926105a4575b50508160011b916000199060031b1c19161760025560ff90565b01519050388061058a565b601f198216936002600052806000209160005b8681106105fc57508360019596106105e3575b505050811b0160025560ff90565b015160001960f88460031b161c191690553880806105d5565b919260206001819286850151815501940192016105c2565b6002600052601f6020600020910160051c810190601f830160051c015b81811061063e575061056f565b60008155600101610631565b634e487b7160e01b600052602260045260246000fd5b90607f169061055d565b908151602081106000146106f2575090601f8151116106965760208151910151602082106104d2571790565b6040519063305a27a960e01b8252602060048301528181519182602483015260005b8381106106da5750508160006044809484010152601f80199101168101030190fd5b602082820181015160448784010152859350016106b8565b6001600160401b03811161021457600354600181811c911680156107fe575b602082101461064a57601f81116107c8575b50602092601f82116001146107635792819293600092610758575b50508160011b916000199060031b1c19161760035560ff90565b01519050388061073e565b601f198216936003600052806000209160005b8681106107b05750836001959610610797575b505050811b0160035560ff90565b015160001960f88460031b161c19169055388080610789565b91926020600181928685015181550194019201610776565b6003600052601f6020600020910160051c810190601f830160051c015b8181106107f25750610723565b600081556001016107e5565b90607f169061071156fe608080604052600436101561001d575b50361561001b57600080fd5b005b60003560e01c90816301ffc9a714611f145750806318cf283414611ed95780631ff6297a14611de357806322f3e2d414611dc8578063248a9ca314611d9b5780632f2ff15d14611d5b57806336568abe14611d155780633656eec214611ccd57806336cd28cf146118ed578063380d831b1461187b57806338b993c3146118565780633b19e84a1461182f5780633c61d4e4146117f65780633ce00bb41461175d5780633d2708f31461174457806345dc3dd8146116f85780634a5eb6b4146115445780635762e8d31461145b57806359be5e451461143d5780635a1e6ca1146113ca5780635e829a02146113a55780635fc3d52d146112c7578063661e894a1461129557806367c1535a1461106d5780636c19e78314611020578063719b403014610fda578063738a8ce614610fa257806373b8116614610ebf57806375b238fc14610e8457806382ba614f14610d6057806384b0196e14610c635780638f1327c014610ba057806391d1485414610b525780639528e50914610aa957806396b1d1711461098d578063a09686c41461096f578063a217fddf14610953578063a23b892714610928578063a32bf5971461090a578063b66a0e5d14610865578063c9d6da0e1461082a578063ccb70e58146107e3578063d547741f1461079e578063d6362e9714610780578063eb91d37e1461075d578063edb98444146102bb5763f0f442601461022f573861000f565b346102b65760203660031901126102b6576001600160a01b03610250611faa565b6102586126fe565b1680156102a5576020817fa6df481f77da1f4c92eb330341e03585d46106fcf522f8e6b6b2afbea56eefdc926bffffffffffffffffffffffff60a01b6005541617600555604051908152a1005b63476824bb60e01b60005260046000fd5b600080fd5b346102b65760c03660031901126102b6576004356001600160401b0381116102b657366023820112156102b65780600401356102f681612110565b9161030460405193846120ef565b81835260208301906024829360051b820101903682116102b657602401915b81831061073d575050506024356001600160401b0381116102b657366023820112156102b65761035d903690602481600401359101612142565b91604435916064359060ff821682036102b65760026001541461072c5760026001556001600160a01b036004541690811561071b57428511156107065760405184516020820192839160005b8181106106e75750505060426001600160a01b0393836103d8610471956104689503601f1981018352826120ef565b51902089519860208b01998a20906040519160208301937f58608e4a50d264a85b93374dac212e30d21fb0a6dabeee929f72849ffac603e585526040840152606083015233608083015260a082015260a0815261043660c0826120ef565b519020610441612a63565b906040519161190160f01b835260028301526022820152209460a435906084359087612b7f565b90929192612c14565b169081036106d3575080600052601160205260ff604060002054166106c25760005260116020526040600020600160ff198254161790558051156106b15760ff60405160208186516104c4818389612049565b8101600e81520301902054161561068f5760ff60405160208186516104ea818389612049565b8101600e8152030190205460081c16156106695760005b81518110156106635760006001600160a01b0360208360051b850101511690604051602081885161053381838b612049565b810160108152030190206001600160a01b0383168252602052604081205490811561065857604051602081895161056b81838c612049565b810160108152030190206001600160a01b038416825260205280604081205573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8314600014610621578080808085335af16105b8612592565b50156106125750600192917faec851c2cc83142ae5384e6176b76831016318af3db6d8fc92eb74690f49ead4915b604051918291606083526105fd606084018b61206c565b91602084015260408301520390a15b01610501565b6384081a9360e01b8152600490fd5b5060019291816106537faec851c2cc83142ae5384e6176b76831016318af3db6d8fc92eb74690f49ead493338461292c565b6105e6565b50505060019061060c565b60018055005b60405163255bb00160e11b8152602060048201528061068b602482018661206c565b0390fd5b60405163201171e760e11b8152602060048201528061068b602482018661206c565b630e27f0bb60e11b60005260046000fd5b636b9150e960e11b60005260046000fd5b631715df1760e21b60005260045260246000fd5b82516001600160a01b03168452602093840193909201916001016103a9565b846373548f1360e01b60005260045260246000fd5b63a7b918af60e01b60005260046000fd5b633ee5aeb560e01b60005260046000fd5b82356001600160a01b03811681036102b657815260209283019201610323565b346102b65760003660031901126102b6576020610778612651565b604051908152f35b346102b65760003660031901126102b6576020600854604051908152f35b346102b65760403660031901126102b65761001b6004356107bd611f94565b906107de6107d982600052600060205260016040600020015490565b6127c3565b61289d565b346102b65760203660031901126102b6576004356001600160401b0381116102b65761081e6108186040923690600401611f67565b906125c2565b82519182526020820152f35b346102b65760003660031901126102b65760206040517f41d12fe3b2ffe2aea01a3e08ec191d0142900efe396c6cd50b857af5b6f1bdae8152f35b346102b65760003660031901126102b65761087e6126fe565b60ff60055460a01c1660038110156108f4576108e357600160a01b60ff60a01b1960055416176005557f514aece9e6a644572bbf15a32c0147a1eca49b93a856df3d96bdd604ef6e5905602060ff60055460a01c166108e06040518092612091565ba1005b633ad8101d60e11b60005260046000fd5b634e487b7160e01b600052602160045260246000fd5b346102b65760003660031901126102b6576020600754604051908152f35b346102b65760003660031901126102b6576109416126fe565b600080808047335af15061001b612592565b346102b65760003660031901126102b657602060405160008152f35b346102b65760003660031901126102b6576020600654604051908152f35b346102b65760203660031901126102b6576004356001600160401b0381116102b6576109bd903690600401611f67565b6109c561268c565b60ff60405182848237602081848101600e815203019020541615610a855760ff60405182848237602081848101600e8152030190205460081c1615610a6157907f05df6a0bbfef88efb268f5a101684a3d547921fc8d67ac7fbbfc36ca0b08ffb29160405181838237602081838101600e81520301902061ff00198154169055610a5c604051928392602084526020840191612179565b0390a1005b61068b60405192839263255bb00160e11b8452602060048501526024840191612179565b61068b60405192839263201171e760e11b8452602060048501526024840191612179565b346102b657610ab736611fc0565b90610ac061268c565b610ac861233c565b610b41576103e88111610b2d576103e88211610b1857807f3041e8be9766296ced85b3be81619ea7d4c6eaa27afcca3d1c70738d734c1fb29260409260095580600a5582519182526020820152a1005b506303af6b9960e21b60005260045260246000fd5b631f8ca89960e01b60005260045260246000fd5b6359c36eed60e01b60005260046000fd5b346102b65760403660031901126102b657610b6b611f94565b60043560005260006020526001600160a01b0360406000209116600052602052602060ff604060002054166040519015158152f35b346102b65760203660031901126102b65760006080604051610bc1816120d4565b8281528260208201528260408201528260608201520152610be36004356121bf565b50604051610bf0816120d4565b60ff82548181161515835260081c1691602082019060038410156108f45760a0938252600181015460408401908152610c4f60036002840154936060870194855201549360808601948552604051955115158652516020860190612091565b516040840152516060830152516080820152f35b346102b65760003660031901126102b657610d02610ca07f00000000000000000000000000000000000000000000000000000000000000006129cf565b610cc97f0000000000000000000000000000000000000000000000000000000000000000612a2c565b6020610d1060405192610cdc83856120ef565b600084526000368137604051958695600f60f81b875260e08588015260e087019061206c565b90858203604087015261206c565b466060850152306080850152600060a085015283810360c085015281808451928381520193019160005b828110610d4957505050500390f35b835185528695509381019392810192600101610d3a565b346102b657610d6e36611fc0565b90610d7761268c565b610d7f61233c565b610b415760405190610d90826120d4565b6001825260208201926000845260408301928284526060810194600086526080820190838252600654600160401b811015610e6e57806001610dd592016006556121bf565b939093610e5857610df590511515849060ff801983541691151516179055565b519060038210156108f4577f015bea156d007b6c0142423b7f5d2174633a71e8cc0ab7a403ad1bb2d0dcafed9660409660039361ff0086549160081b169061ff0019161785555160018501555160028401555191015582519182526020820152a1005b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052604160045260246000fd5b346102b65760003660031901126102b65760206040517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b346102b65760003660031901126102b657601254610edc81612110565b90610eea60405192836120ef565b80825260208201908160126000527fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34446000915b838310610f755784866040519182916020830190602084525180915260408301919060005b818110610f50575050500390f35b8251805185526020908101518186015286955060409094019390920191600101610f42565b60026020600192604051610f88816120b9565b855481528486015483820152815201920192019190610f1d565b346102b65760403660031901126102b65761001b610fbe611faa565b610fc66126fe565b602435906001600160a01b0333911661292c565b346102b65760206001600160a01b03610ff236612006565b9193908260405193849283378101601081520301902091166000526020526020604060002054604051908152f35b346102b65760203660031901126102b6576001600160a01b03611041611faa565b6110496126fe565b1680156102a5576bffffffffffffffffffffffff60a01b6004541617600455600080f35b346102b65760403660031901126102b6576004356001600160401b0381116102b65761109d903690600401611fd6565b6024356001600160401b0381116102b6576110bc903690600401611fd6565b9190926110c761268c565b82820361116a5760125460006012558061121a575b5060005b8281106110e957005b806111a057821561118a57813515801561117b575b61116a575b61110e8184846122eb565b359061111b8186886122eb565b35916040519061112a826120b9565b815260208101928352601254600160401b811015610e6e57806001611152920160125561223c565b919091610e58575181559151600192830155016110e0565b63656a2be360e01b60005260046000fd5b50831561118a578435156110fe565b634e487b7160e01b600052603260045260246000fd5b6000198101818111611204576111b78185856122eb565b356111c38386866122eb565b35109081156111e4575b50156111035763656a2be360e01b60005260046000fd5b6111f0915085876122eb565b356111fc8286886122eb565b3510866111cd565b634e487b7160e01b600052601160045260246000fd5b6001600160ff1b038116810361120457601260005260011b7fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3444017fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34445b81811061128357506110dc565b60008082556001820155600201611276565b346102b6576112c36112af6112a936612006565b916123d7565b60405191829160208352602083019061206c565b0390f35b346102b65760203660031901126102b6576004356112e3612751565b6112eb61219a565b15610b415760ff6112fb826121bf565b50541615611391576007549060ff611312836121bf565b505460081c169060038210156108f4577f0ab582f1afc29efbd503feb5b4a945175eee54010e1be75f88d3e0a865f1631f92600160209314611374575b50611359816121bf565b5061010061ff001982541617905580600755604051908152a1005b61137d906121bf565b50805461ff0019166102001790558361134f565b63e490595960e01b60005260045260246000fd5b346102b65760003660031901126102b65760206113c061233c565b6040519015158152f35b346102b65760203660031901126102b6576004356113e6612751565b60ff6113f1826121bf565b50541615611391576020816114267f8cc775ebbee0cce2baccb0a0121cb5794418a52d6edac0ea16c407d241109fd0936121bf565b50805461ff001916610200179055604051908152a1005b346102b65760003660031901126102b6576020600b54604051908152f35b346102b65761146936611fc0565b61147161268c565b61147961233c565b610b415760ff611488836121bf565b5054161561152f5760ff61149b836121bf565b505460081c1660038110156108f45760021461151a578060026114bd846121bf565b5001541161150657818160409260036114f67f49ca6c84a13f8aa6e1f51b2eccce808ecf7a805f145c6b48e6092e7c232562fb966121bf565b50015582519182526020820152a1005b50628f32ad60e41b60005260045260246000fd5b506330bf16eb60e01b60005260045260246000fd5b5063e490595960e01b60005260045260246000fd5b346102b65760603660031901126102b6576004356001600160401b0381116102b657611574903690600401611fd6565b906024356001600160401b0381116102b657611594903690600401611fd6565b6044929192356001600160401b0381116102b6576115b6903690600401611fd6565b6115c1949194612751565b6115c961233c565b610b41578286148015906116ee575b61116a5760005b8681106115e857005b807fad90ad4ae5a725a290f3675aa91f7a0436d6a11bc8e1fa9574c8a1920a463f1485856116e58a6116d786898f828f816116d0936116c89260019f60026116418f928f61163a8f9583908e936122eb565b35946122eb565b356040519261164f8461209e565b60018452602084016001815260408501918252606085019283526116a460206116798a8a8a6122fb565b91908260405193849283378101600e81520301902095511515869060ff801983541691151516179055565b51845461ff00191690151560081b61ff0016178455516001840155519101556122fb565b9990986122eb565b35936122eb565b3590604051948594856121de565b0390a1016115df565b50808614156115d8565b346102b65760203660031901126102b6577f47cbaf5d32151e0783592fa385a9179337a0655a2d24c7587252ab57c70c4442602060043561173761268c565b80600855604051908152a1005b346102b657602061077861175736611fc0565b9061225b565b346102b65761176b36611fc0565b61177361268c565b61177b61233c565b610b415760ff61178a836121bf565b5054161561152f5760ff61179d836121bf565b505460081c1660038110156108f4576117e157818160409260016114f67f9bdb33962ec269ba46cf891894f92891dcfbcda357db379ca990f7a6e9b951a3966121bf565b50632f17d84160e01b60005260045260246000fd5b346102b65760203660031901126102b6576004358015158091036102b65761181c61268c565b60ff801960135416911617601355600080f35b346102b65760003660031901126102b65760206001600160a01b0360055416604051908152f35b346102b65760003660031901126102b6576040600954600a5482519182526020820152f35b346102b65760003660031901126102b6576118946126fe565b61189c61219a565b15610b4157600160a11b60ff60a01b1960055416176005557f514aece9e6a644572bbf15a32c0147a1eca49b93a856df3d96bdd604ef6e5905602060ff60055460a01c166108e06040518092612091565b346102b65760e03660031901126102b657611906611faa565b61190e611f94565b906064356084356001600160401b0381116102b657611931903690600401611f67565b3360009081527f73a0e851d3bf6fc5b7d715a1724e56c8ed39eb00b9b99e8a3f26be26e3bdaa186020526040902054919390929160ff1615611c94576001600160a01b03169081600052600c6020526119916044356040600020546121b2565b82600052600c6020526040600020556119ac81600b546121b2565b600b5560075460026119d36119cd84836119c5866121bf565b5001546121b2565b926121bf565b50015581600052600d6020526119fe60406000209160075492836000526020526040600020546121b2565b9082600052600d602052604060002090600052602052604060002055611a25368385612142565b936020946000604051611a3888826120ef565b5280518681159283611c66575b50505015611a4f57005b60ff604051848682378681868101600e815203019020541615611be5575b6001600160a01b036040518486823786818681016010815203019020911660005284526040600020611aa260a43582546121b2565b90556040518284823784818481016010815203019020600160005284526040600020611ad160c43582546121b2565b9055600052600f83526040600020916001600160401b038211610e6e57611af88354612202565b601f8111611b9f575b50600093601f8311600114611b3e575092819293600092611b33575b50508160011b916000199060031b1c1916179055005b013590508380611b1d565b90601f198316948481528281209281905b878210611b87575050836001959610611b6d575b505050811b019055005b0135600019600384901b60f8161c19169055838080611b63565b80600184968294958701358155019501920190611b4f565b8360005284600020601f840160051c810191868510611bdb575b601f0160051c01905b818110611bcf5750611b01565b60008155600101611bc2565b9091508190611bb9565b604051838582378581858101600e815203019020600160ff19825416179055604051838582378581858101600e81520301902061010061ff00198254161790557fad90ad4ae5a725a290f3675aa91f7a0436d6a11bc8e1fa9574c8a1920a463f14600954600a5490611c5e604051928392888a856121de565b0390a1611a6d565b01207fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470149050868681611a45565b63e2517d3f60e01b600052336004527f41d12fe3b2ffe2aea01a3e08ec191d0142900efe396c6cd50b857af5b6f1bdae60245260446000fd5b346102b65760403660031901126102b6576001600160a01b03611cee611f94565b16600052600d60205260406000206004356000526020526020604060002054604051908152f35b346102b65760403660031901126102b657611d2e611f94565b336001600160a01b03821603611d4a5761001b9060043561289d565b63334bd91960e11b60005260046000fd5b346102b65760403660031901126102b65761001b600435611d7a611f94565b90611d966107d982600052600060205260016040600020015490565b61280a565b346102b65760203660031901126102b6576020610778600435600052600060205260016040600020015490565b346102b65760003660031901126102b65760206113c061219a565b346102b65760203660031901126102b6576004356001600160401b0381116102b657611e13903690600401611f67565b611e1b61268c565b60ff60405182848237602081848101600e815203019020541615610a855760ff60405182848237602081848101600e8152030190205460081c16611eb557907ff7ca199770cde66aa54d5455c0ae5c3da42c753a3e09f7f108646c31c18c34ed9160405181838237602081838101600e81520301902061010061ff0019825416179055610a5c604051928392602084526020840191612179565b61068b604051928392635644da3960e11b8452602060048501526024840191612179565b346102b65760003660031901126102b65760206040517fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc778152f35b346102b65760203660031901126102b6576004359063ffffffff60e01b82168092036102b657602091637965db0b60e01b8114908115611f56575b5015158152f35b6301ffc9a760e01b14905083611f4f565b9181601f840112156102b6578235916001600160401b0383116102b657602083818601950101116102b657565b602435906001600160a01b03821682036102b657565b600435906001600160a01b03821682036102b657565b60409060031901126102b6576004359060243590565b9181601f840112156102b6578235916001600160401b0383116102b6576020808501948460051b0101116102b657565b9060406003198301126102b6576004356001600160a01b03811681036102b65791602435906001600160401b0382116102b65761204591600401611f67565b9091565b60005b83811061205c5750506000910152565b818101518382015260200161204c565b9060209161208581518092818552858086019101612049565b601f01601f1916010190565b9060038210156108f45752565b608081019081106001600160401b03821117610e6e57604052565b604081019081106001600160401b03821117610e6e57604052565b60a081019081106001600160401b03821117610e6e57604052565b90601f801991011681019081106001600160401b03821117610e6e57604052565b6001600160401b038111610e6e5760051b60200190565b6001600160401b038111610e6e57601f01601f191660200190565b92919261214e82612127565b9161215c60405193846120ef565b8294818452818301116102b6578281602093846000960137010152565b908060209392818452848401376000828201840152601f01601f1916010190565b60ff60055460a01c1660038110156108f45760011490565b9190820180921161120457565b60065481101561118a57600660005260206000209060021b0190600090565b906121f89060409396959496606084526060840191612179565b9460208201520152565b90600182811c92168015612232575b602083101461221c57565b634e487b7160e01b600052602260045260246000fd5b91607f1691612211565b60125481101561118a57601260005260206000209060011b0190600090565b906012549182156122e3579091600019916000905b8282106122b5575b50505060001981146122ae5761228d9061223c565b50549081810291818304149015171561120457670de0b6b3a7640000900490565b5050600090565b9091939260016122c48461223c565b50015482106122dc5750600182019093919293612270565b9293612278565b505050600090565b919081101561118a5760051b0190565b919081101561118a5760051b81013590601e19813603018212156102b65701908135916001600160401b0383116102b65760200182360381136102b6579190565b60ff60055460a01c1660038110156108f45760021490565b6000929181549161236483612202565b80835292600181169081156123ba575060011461238057505050565b60009081526020812093945091925b8383106123a0575060209250010190565b60018160209294939454838587010152019101919061238f565b915050602093945060ff929192191683830152151560051b010190565b60ff60135416612586576001600160a01b031680600052600f60205260406000206040519081600082549261240b84612202565b936001811690811561256c5750600114612530575b5060209250600e8152030190206040519061243a8261209e565b8054916060600260ff80861615159586855260081c1615159384602085015260018101546040850152015491015281612528575b506124ff575060405182828237602081848101600e815203019020604051906124968261209e565b80549160ff831615906060600260ff84159687855260081c16151594856020850152600181015460408501520154910152916124f7575b506124e95750506040516124e26020826120ef565b6000815290565b6124f4913691612142565b90565b9050386124cd565b915050600052600f6020526125216124f4604060002060405192838092612354565b03826120ef565b90503861246e565b9150506000528160206000206000905b838210612554575050602091810138612420565b60209192508060019154848701520191018391612540565b60ff19168452506020938015150283019150389050612420565b506124f4913691612142565b3d156125bd573d906125a382612127565b916125b160405193846120ef565b82523d6000602084013e565b606090565b906020606093928260405193849283378101600e8152030190206040516125e88161209e565b81549060ff80831615159283835260081c16151560208201526002600184015493846040840152015494859101526126275750905060095490600a5490565b600954808211156126495750915b600a5480821115612644575090565b905090565b905091612635565b60075460ff61265f826121bf565b505460081c1660038110156108f45760011461267b5750600090565b6126866001916121bf565b50015490565b3360009081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec602052604090205460ff16156126c557565b63e2517d3f60e01b600052336004527fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177560245260446000fd5b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff161561273757565b63e2517d3f60e01b60005233600452600060245260446000fd5b3360009081527f9c5aa8bf4d93dca6430115e88fa8c1700204beda30fff3ec04054c8739a0a2b5602052604090205460ff161561278a57565b63e2517d3f60e01b600052336004527fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc7760245260446000fd5b80600052600060205260406000206001600160a01b03331660005260205260ff60406000205416156127f25750565b63e2517d3f60e01b6000523360045260245260446000fd5b80600052600060205260406000206001600160a01b03831660005260205260ff60406000205416156000146122ae5780600052600060205260406000206001600160a01b0383166000526020526040600020600160ff198254161790556001600160a01b03339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4600190565b80600052600060205260406000206001600160a01b03831660005260205260ff604060002054166000146122ae5780600052600060205260406000206001600160a01b038316600052602052604060002060ff1981541690556001600160a01b03339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b600080a4600190565b6000612981926001600160a01b0382936040519682602089019463a9059cbb60e01b865216602489015260448801526044875261296a6064886120ef565b1694519082865af161297a612592565b9083612c86565b80519081151591826129ab575b50506129975750565b635274afe760e01b60005260045260246000fd5b81925090602091810103126102b657602001518015908115036102b657388061298e565b60ff8114612a195760ff811690601f8211612a085760408051926129f382856120ef565b6020808552840191601f190136833783525290565b632cd44ac360e21b60005260046000fd5b506040516124f481612521816002612354565b60ff8114612a505760ff811690601f8211612a085760408051926129f382856120ef565b506040516124f481612521816003612354565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016301480612b56575b15612abe577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a08152612b5060c0826120ef565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000004614612a95565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411612c08579160209360809260ff60009560405194855216868401526040830152606082015282805260015afa15612bfc576000516001600160a01b03811615612bf05790600090600090565b50600090600190600090565b6040513d6000823e3d90fd5b50505060009160039190565b91909160048110156108f45780612c2a57509050565b600060018203612c455763f645eedf60e01b60005260046000fd5b5060028103612c63578263fce698f760e01b60005260045260246000fd5b9091600360009214612c73575050565b6335e2f38360e21b825260045260249150fd5b90612cac5750805115612c9b57805190602001fd5b630a12f52160e11b60005260046000fd5b81511580612cdb575b612cbd575090565b6001600160a01b0390639996b31560e01b6000521660045260246000fd5b50803b15612cb556fea2646970667358221220e2cc80d86ef5e9d4c17b4ecb93d1fff11eaf021d8b7a220edce356a039302e6664736f6c634300081b00332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec9c5aa8bf4d93dca6430115e88fa8c1700204beda30fff3ec04054c8739a0a2b5ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5000000000000000000000000ed708ea8dabe037a0062cb4a803ae92ffbff4bbd00000000000000000000000005a50724339e46f35f3897f28feaa768f6c7e20b
Deployed Bytecode
0x608080604052600436101561001d575b50361561001b57600080fd5b005b60003560e01c90816301ffc9a714611f145750806318cf283414611ed95780631ff6297a14611de357806322f3e2d414611dc8578063248a9ca314611d9b5780632f2ff15d14611d5b57806336568abe14611d155780633656eec214611ccd57806336cd28cf146118ed578063380d831b1461187b57806338b993c3146118565780633b19e84a1461182f5780633c61d4e4146117f65780633ce00bb41461175d5780633d2708f31461174457806345dc3dd8146116f85780634a5eb6b4146115445780635762e8d31461145b57806359be5e451461143d5780635a1e6ca1146113ca5780635e829a02146113a55780635fc3d52d146112c7578063661e894a1461129557806367c1535a1461106d5780636c19e78314611020578063719b403014610fda578063738a8ce614610fa257806373b8116614610ebf57806375b238fc14610e8457806382ba614f14610d6057806384b0196e14610c635780638f1327c014610ba057806391d1485414610b525780639528e50914610aa957806396b1d1711461098d578063a09686c41461096f578063a217fddf14610953578063a23b892714610928578063a32bf5971461090a578063b66a0e5d14610865578063c9d6da0e1461082a578063ccb70e58146107e3578063d547741f1461079e578063d6362e9714610780578063eb91d37e1461075d578063edb98444146102bb5763f0f442601461022f573861000f565b346102b65760203660031901126102b6576001600160a01b03610250611faa565b6102586126fe565b1680156102a5576020817fa6df481f77da1f4c92eb330341e03585d46106fcf522f8e6b6b2afbea56eefdc926bffffffffffffffffffffffff60a01b6005541617600555604051908152a1005b63476824bb60e01b60005260046000fd5b600080fd5b346102b65760c03660031901126102b6576004356001600160401b0381116102b657366023820112156102b65780600401356102f681612110565b9161030460405193846120ef565b81835260208301906024829360051b820101903682116102b657602401915b81831061073d575050506024356001600160401b0381116102b657366023820112156102b65761035d903690602481600401359101612142565b91604435916064359060ff821682036102b65760026001541461072c5760026001556001600160a01b036004541690811561071b57428511156107065760405184516020820192839160005b8181106106e75750505060426001600160a01b0393836103d8610471956104689503601f1981018352826120ef565b51902089519860208b01998a20906040519160208301937f58608e4a50d264a85b93374dac212e30d21fb0a6dabeee929f72849ffac603e585526040840152606083015233608083015260a082015260a0815261043660c0826120ef565b519020610441612a63565b906040519161190160f01b835260028301526022820152209460a435906084359087612b7f565b90929192612c14565b169081036106d3575080600052601160205260ff604060002054166106c25760005260116020526040600020600160ff198254161790558051156106b15760ff60405160208186516104c4818389612049565b8101600e81520301902054161561068f5760ff60405160208186516104ea818389612049565b8101600e8152030190205460081c16156106695760005b81518110156106635760006001600160a01b0360208360051b850101511690604051602081885161053381838b612049565b810160108152030190206001600160a01b0383168252602052604081205490811561065857604051602081895161056b81838c612049565b810160108152030190206001600160a01b038416825260205280604081205573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8314600014610621578080808085335af16105b8612592565b50156106125750600192917faec851c2cc83142ae5384e6176b76831016318af3db6d8fc92eb74690f49ead4915b604051918291606083526105fd606084018b61206c565b91602084015260408301520390a15b01610501565b6384081a9360e01b8152600490fd5b5060019291816106537faec851c2cc83142ae5384e6176b76831016318af3db6d8fc92eb74690f49ead493338461292c565b6105e6565b50505060019061060c565b60018055005b60405163255bb00160e11b8152602060048201528061068b602482018661206c565b0390fd5b60405163201171e760e11b8152602060048201528061068b602482018661206c565b630e27f0bb60e11b60005260046000fd5b636b9150e960e11b60005260046000fd5b631715df1760e21b60005260045260246000fd5b82516001600160a01b03168452602093840193909201916001016103a9565b846373548f1360e01b60005260045260246000fd5b63a7b918af60e01b60005260046000fd5b633ee5aeb560e01b60005260046000fd5b82356001600160a01b03811681036102b657815260209283019201610323565b346102b65760003660031901126102b6576020610778612651565b604051908152f35b346102b65760003660031901126102b6576020600854604051908152f35b346102b65760403660031901126102b65761001b6004356107bd611f94565b906107de6107d982600052600060205260016040600020015490565b6127c3565b61289d565b346102b65760203660031901126102b6576004356001600160401b0381116102b65761081e6108186040923690600401611f67565b906125c2565b82519182526020820152f35b346102b65760003660031901126102b65760206040517f41d12fe3b2ffe2aea01a3e08ec191d0142900efe396c6cd50b857af5b6f1bdae8152f35b346102b65760003660031901126102b65761087e6126fe565b60ff60055460a01c1660038110156108f4576108e357600160a01b60ff60a01b1960055416176005557f514aece9e6a644572bbf15a32c0147a1eca49b93a856df3d96bdd604ef6e5905602060ff60055460a01c166108e06040518092612091565ba1005b633ad8101d60e11b60005260046000fd5b634e487b7160e01b600052602160045260246000fd5b346102b65760003660031901126102b6576020600754604051908152f35b346102b65760003660031901126102b6576109416126fe565b600080808047335af15061001b612592565b346102b65760003660031901126102b657602060405160008152f35b346102b65760003660031901126102b6576020600654604051908152f35b346102b65760203660031901126102b6576004356001600160401b0381116102b6576109bd903690600401611f67565b6109c561268c565b60ff60405182848237602081848101600e815203019020541615610a855760ff60405182848237602081848101600e8152030190205460081c1615610a6157907f05df6a0bbfef88efb268f5a101684a3d547921fc8d67ac7fbbfc36ca0b08ffb29160405181838237602081838101600e81520301902061ff00198154169055610a5c604051928392602084526020840191612179565b0390a1005b61068b60405192839263255bb00160e11b8452602060048501526024840191612179565b61068b60405192839263201171e760e11b8452602060048501526024840191612179565b346102b657610ab736611fc0565b90610ac061268c565b610ac861233c565b610b41576103e88111610b2d576103e88211610b1857807f3041e8be9766296ced85b3be81619ea7d4c6eaa27afcca3d1c70738d734c1fb29260409260095580600a5582519182526020820152a1005b506303af6b9960e21b60005260045260246000fd5b631f8ca89960e01b60005260045260246000fd5b6359c36eed60e01b60005260046000fd5b346102b65760403660031901126102b657610b6b611f94565b60043560005260006020526001600160a01b0360406000209116600052602052602060ff604060002054166040519015158152f35b346102b65760203660031901126102b65760006080604051610bc1816120d4565b8281528260208201528260408201528260608201520152610be36004356121bf565b50604051610bf0816120d4565b60ff82548181161515835260081c1691602082019060038410156108f45760a0938252600181015460408401908152610c4f60036002840154936060870194855201549360808601948552604051955115158652516020860190612091565b516040840152516060830152516080820152f35b346102b65760003660031901126102b657610d02610ca07f446174615661756c7400000000000000000000000000000000000000000000096129cf565b610cc97f76312e3000000000000000000000000000000000000000000000000000000004612a2c565b6020610d1060405192610cdc83856120ef565b600084526000368137604051958695600f60f81b875260e08588015260e087019061206c565b90858203604087015261206c565b466060850152306080850152600060a085015283810360c085015281808451928381520193019160005b828110610d4957505050500390f35b835185528695509381019392810192600101610d3a565b346102b657610d6e36611fc0565b90610d7761268c565b610d7f61233c565b610b415760405190610d90826120d4565b6001825260208201926000845260408301928284526060810194600086526080820190838252600654600160401b811015610e6e57806001610dd592016006556121bf565b939093610e5857610df590511515849060ff801983541691151516179055565b519060038210156108f4577f015bea156d007b6c0142423b7f5d2174633a71e8cc0ab7a403ad1bb2d0dcafed9660409660039361ff0086549160081b169061ff0019161785555160018501555160028401555191015582519182526020820152a1005b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052604160045260246000fd5b346102b65760003660031901126102b65760206040517fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758152f35b346102b65760003660031901126102b657601254610edc81612110565b90610eea60405192836120ef565b80825260208201908160126000527fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34446000915b838310610f755784866040519182916020830190602084525180915260408301919060005b818110610f50575050500390f35b8251805185526020908101518186015286955060409094019390920191600101610f42565b60026020600192604051610f88816120b9565b855481528486015483820152815201920192019190610f1d565b346102b65760403660031901126102b65761001b610fbe611faa565b610fc66126fe565b602435906001600160a01b0333911661292c565b346102b65760206001600160a01b03610ff236612006565b9193908260405193849283378101601081520301902091166000526020526020604060002054604051908152f35b346102b65760203660031901126102b6576001600160a01b03611041611faa565b6110496126fe565b1680156102a5576bffffffffffffffffffffffff60a01b6004541617600455600080f35b346102b65760403660031901126102b6576004356001600160401b0381116102b65761109d903690600401611fd6565b6024356001600160401b0381116102b6576110bc903690600401611fd6565b9190926110c761268c565b82820361116a5760125460006012558061121a575b5060005b8281106110e957005b806111a057821561118a57813515801561117b575b61116a575b61110e8184846122eb565b359061111b8186886122eb565b35916040519061112a826120b9565b815260208101928352601254600160401b811015610e6e57806001611152920160125561223c565b919091610e58575181559151600192830155016110e0565b63656a2be360e01b60005260046000fd5b50831561118a578435156110fe565b634e487b7160e01b600052603260045260246000fd5b6000198101818111611204576111b78185856122eb565b356111c38386866122eb565b35109081156111e4575b50156111035763656a2be360e01b60005260046000fd5b6111f0915085876122eb565b356111fc8286886122eb565b3510866111cd565b634e487b7160e01b600052601160045260246000fd5b6001600160ff1b038116810361120457601260005260011b7fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec3444017fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34445b81811061128357506110dc565b60008082556001820155600201611276565b346102b6576112c36112af6112a936612006565b916123d7565b60405191829160208352602083019061206c565b0390f35b346102b65760203660031901126102b6576004356112e3612751565b6112eb61219a565b15610b415760ff6112fb826121bf565b50541615611391576007549060ff611312836121bf565b505460081c169060038210156108f4577f0ab582f1afc29efbd503feb5b4a945175eee54010e1be75f88d3e0a865f1631f92600160209314611374575b50611359816121bf565b5061010061ff001982541617905580600755604051908152a1005b61137d906121bf565b50805461ff0019166102001790558361134f565b63e490595960e01b60005260045260246000fd5b346102b65760003660031901126102b65760206113c061233c565b6040519015158152f35b346102b65760203660031901126102b6576004356113e6612751565b60ff6113f1826121bf565b50541615611391576020816114267f8cc775ebbee0cce2baccb0a0121cb5794418a52d6edac0ea16c407d241109fd0936121bf565b50805461ff001916610200179055604051908152a1005b346102b65760003660031901126102b6576020600b54604051908152f35b346102b65761146936611fc0565b61147161268c565b61147961233c565b610b415760ff611488836121bf565b5054161561152f5760ff61149b836121bf565b505460081c1660038110156108f45760021461151a578060026114bd846121bf565b5001541161150657818160409260036114f67f49ca6c84a13f8aa6e1f51b2eccce808ecf7a805f145c6b48e6092e7c232562fb966121bf565b50015582519182526020820152a1005b50628f32ad60e41b60005260045260246000fd5b506330bf16eb60e01b60005260045260246000fd5b5063e490595960e01b60005260045260246000fd5b346102b65760603660031901126102b6576004356001600160401b0381116102b657611574903690600401611fd6565b906024356001600160401b0381116102b657611594903690600401611fd6565b6044929192356001600160401b0381116102b6576115b6903690600401611fd6565b6115c1949194612751565b6115c961233c565b610b41578286148015906116ee575b61116a5760005b8681106115e857005b807fad90ad4ae5a725a290f3675aa91f7a0436d6a11bc8e1fa9574c8a1920a463f1485856116e58a6116d786898f828f816116d0936116c89260019f60026116418f928f61163a8f9583908e936122eb565b35946122eb565b356040519261164f8461209e565b60018452602084016001815260408501918252606085019283526116a460206116798a8a8a6122fb565b91908260405193849283378101600e81520301902095511515869060ff801983541691151516179055565b51845461ff00191690151560081b61ff0016178455516001840155519101556122fb565b9990986122eb565b35936122eb565b3590604051948594856121de565b0390a1016115df565b50808614156115d8565b346102b65760203660031901126102b6577f47cbaf5d32151e0783592fa385a9179337a0655a2d24c7587252ab57c70c4442602060043561173761268c565b80600855604051908152a1005b346102b657602061077861175736611fc0565b9061225b565b346102b65761176b36611fc0565b61177361268c565b61177b61233c565b610b415760ff61178a836121bf565b5054161561152f5760ff61179d836121bf565b505460081c1660038110156108f4576117e157818160409260016114f67f9bdb33962ec269ba46cf891894f92891dcfbcda357db379ca990f7a6e9b951a3966121bf565b50632f17d84160e01b60005260045260246000fd5b346102b65760203660031901126102b6576004358015158091036102b65761181c61268c565b60ff801960135416911617601355600080f35b346102b65760003660031901126102b65760206001600160a01b0360055416604051908152f35b346102b65760003660031901126102b6576040600954600a5482519182526020820152f35b346102b65760003660031901126102b6576118946126fe565b61189c61219a565b15610b4157600160a11b60ff60a01b1960055416176005557f514aece9e6a644572bbf15a32c0147a1eca49b93a856df3d96bdd604ef6e5905602060ff60055460a01c166108e06040518092612091565b346102b65760e03660031901126102b657611906611faa565b61190e611f94565b906064356084356001600160401b0381116102b657611931903690600401611f67565b3360009081527f73a0e851d3bf6fc5b7d715a1724e56c8ed39eb00b9b99e8a3f26be26e3bdaa186020526040902054919390929160ff1615611c94576001600160a01b03169081600052600c6020526119916044356040600020546121b2565b82600052600c6020526040600020556119ac81600b546121b2565b600b5560075460026119d36119cd84836119c5866121bf565b5001546121b2565b926121bf565b50015581600052600d6020526119fe60406000209160075492836000526020526040600020546121b2565b9082600052600d602052604060002090600052602052604060002055611a25368385612142565b936020946000604051611a3888826120ef565b5280518681159283611c66575b50505015611a4f57005b60ff604051848682378681868101600e815203019020541615611be5575b6001600160a01b036040518486823786818681016010815203019020911660005284526040600020611aa260a43582546121b2565b90556040518284823784818481016010815203019020600160005284526040600020611ad160c43582546121b2565b9055600052600f83526040600020916001600160401b038211610e6e57611af88354612202565b601f8111611b9f575b50600093601f8311600114611b3e575092819293600092611b33575b50508160011b916000199060031b1c1916179055005b013590508380611b1d565b90601f198316948481528281209281905b878210611b87575050836001959610611b6d575b505050811b019055005b0135600019600384901b60f8161c19169055838080611b63565b80600184968294958701358155019501920190611b4f565b8360005284600020601f840160051c810191868510611bdb575b601f0160051c01905b818110611bcf5750611b01565b60008155600101611bc2565b9091508190611bb9565b604051838582378581858101600e815203019020600160ff19825416179055604051838582378581858101600e81520301902061010061ff00198254161790557fad90ad4ae5a725a290f3675aa91f7a0436d6a11bc8e1fa9574c8a1920a463f14600954600a5490611c5e604051928392888a856121de565b0390a1611a6d565b01207fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470149050868681611a45565b63e2517d3f60e01b600052336004527f41d12fe3b2ffe2aea01a3e08ec191d0142900efe396c6cd50b857af5b6f1bdae60245260446000fd5b346102b65760403660031901126102b6576001600160a01b03611cee611f94565b16600052600d60205260406000206004356000526020526020604060002054604051908152f35b346102b65760403660031901126102b657611d2e611f94565b336001600160a01b03821603611d4a5761001b9060043561289d565b63334bd91960e11b60005260046000fd5b346102b65760403660031901126102b65761001b600435611d7a611f94565b90611d966107d982600052600060205260016040600020015490565b61280a565b346102b65760203660031901126102b6576020610778600435600052600060205260016040600020015490565b346102b65760003660031901126102b65760206113c061219a565b346102b65760203660031901126102b6576004356001600160401b0381116102b657611e13903690600401611f67565b611e1b61268c565b60ff60405182848237602081848101600e815203019020541615610a855760ff60405182848237602081848101600e8152030190205460081c16611eb557907ff7ca199770cde66aa54d5455c0ae5c3da42c753a3e09f7f108646c31c18c34ed9160405181838237602081838101600e81520301902061010061ff0019825416179055610a5c604051928392602084526020840191612179565b61068b604051928392635644da3960e11b8452602060048501526024840191612179565b346102b65760003660031901126102b65760206040517fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc778152f35b346102b65760203660031901126102b6576004359063ffffffff60e01b82168092036102b657602091637965db0b60e01b8114908115611f56575b5015158152f35b6301ffc9a760e01b14905083611f4f565b9181601f840112156102b6578235916001600160401b0383116102b657602083818601950101116102b657565b602435906001600160a01b03821682036102b657565b600435906001600160a01b03821682036102b657565b60409060031901126102b6576004359060243590565b9181601f840112156102b6578235916001600160401b0383116102b6576020808501948460051b0101116102b657565b9060406003198301126102b6576004356001600160a01b03811681036102b65791602435906001600160401b0382116102b65761204591600401611f67565b9091565b60005b83811061205c5750506000910152565b818101518382015260200161204c565b9060209161208581518092818552858086019101612049565b601f01601f1916010190565b9060038210156108f45752565b608081019081106001600160401b03821117610e6e57604052565b604081019081106001600160401b03821117610e6e57604052565b60a081019081106001600160401b03821117610e6e57604052565b90601f801991011681019081106001600160401b03821117610e6e57604052565b6001600160401b038111610e6e5760051b60200190565b6001600160401b038111610e6e57601f01601f191660200190565b92919261214e82612127565b9161215c60405193846120ef565b8294818452818301116102b6578281602093846000960137010152565b908060209392818452848401376000828201840152601f01601f1916010190565b60ff60055460a01c1660038110156108f45760011490565b9190820180921161120457565b60065481101561118a57600660005260206000209060021b0190600090565b906121f89060409396959496606084526060840191612179565b9460208201520152565b90600182811c92168015612232575b602083101461221c57565b634e487b7160e01b600052602260045260246000fd5b91607f1691612211565b60125481101561118a57601260005260206000209060011b0190600090565b906012549182156122e3579091600019916000905b8282106122b5575b50505060001981146122ae5761228d9061223c565b50549081810291818304149015171561120457670de0b6b3a7640000900490565b5050600090565b9091939260016122c48461223c565b50015482106122dc5750600182019093919293612270565b9293612278565b505050600090565b919081101561118a5760051b0190565b919081101561118a5760051b81013590601e19813603018212156102b65701908135916001600160401b0383116102b65760200182360381136102b6579190565b60ff60055460a01c1660038110156108f45760021490565b6000929181549161236483612202565b80835292600181169081156123ba575060011461238057505050565b60009081526020812093945091925b8383106123a0575060209250010190565b60018160209294939454838587010152019101919061238f565b915050602093945060ff929192191683830152151560051b010190565b60ff60135416612586576001600160a01b031680600052600f60205260406000206040519081600082549261240b84612202565b936001811690811561256c5750600114612530575b5060209250600e8152030190206040519061243a8261209e565b8054916060600260ff80861615159586855260081c1615159384602085015260018101546040850152015491015281612528575b506124ff575060405182828237602081848101600e815203019020604051906124968261209e565b80549160ff831615906060600260ff84159687855260081c16151594856020850152600181015460408501520154910152916124f7575b506124e95750506040516124e26020826120ef565b6000815290565b6124f4913691612142565b90565b9050386124cd565b915050600052600f6020526125216124f4604060002060405192838092612354565b03826120ef565b90503861246e565b9150506000528160206000206000905b838210612554575050602091810138612420565b60209192508060019154848701520191018391612540565b60ff19168452506020938015150283019150389050612420565b506124f4913691612142565b3d156125bd573d906125a382612127565b916125b160405193846120ef565b82523d6000602084013e565b606090565b906020606093928260405193849283378101600e8152030190206040516125e88161209e565b81549060ff80831615159283835260081c16151560208201526002600184015493846040840152015494859101526126275750905060095490600a5490565b600954808211156126495750915b600a5480821115612644575090565b905090565b905091612635565b60075460ff61265f826121bf565b505460081c1660038110156108f45760011461267b5750600090565b6126866001916121bf565b50015490565b3360009081527f7d7ffb7a348e1c6a02869081a26547b49160dd3df72d1d75a570eb9b698292ec602052604090205460ff16156126c557565b63e2517d3f60e01b600052336004527fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c2177560245260446000fd5b3360009081527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604090205460ff161561273757565b63e2517d3f60e01b60005233600452600060245260446000fd5b3360009081527f9c5aa8bf4d93dca6430115e88fa8c1700204beda30fff3ec04054c8739a0a2b5602052604090205460ff161561278a57565b63e2517d3f60e01b600052336004527fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc7760245260446000fd5b80600052600060205260406000206001600160a01b03331660005260205260ff60406000205416156127f25750565b63e2517d3f60e01b6000523360045260245260446000fd5b80600052600060205260406000206001600160a01b03831660005260205260ff60406000205416156000146122ae5780600052600060205260406000206001600160a01b0383166000526020526040600020600160ff198254161790556001600160a01b03339216907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4600190565b80600052600060205260406000206001600160a01b03831660005260205260ff604060002054166000146122ae5780600052600060205260406000206001600160a01b038316600052602052604060002060ff1981541690556001600160a01b03339216907ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b600080a4600190565b6000612981926001600160a01b0382936040519682602089019463a9059cbb60e01b865216602489015260448801526044875261296a6064886120ef565b1694519082865af161297a612592565b9083612c86565b80519081151591826129ab575b50506129975750565b635274afe760e01b60005260045260246000fd5b81925090602091810103126102b657602001518015908115036102b657388061298e565b60ff8114612a195760ff811690601f8211612a085760408051926129f382856120ef565b6020808552840191601f190136833783525290565b632cd44ac360e21b60005260046000fd5b506040516124f481612521816002612354565b60ff8114612a505760ff811690601f8211612a085760408051926129f382856120ef565b506040516124f481612521816003612354565b6001600160a01b037f000000000000000000000000c5d9a2f5ca7fd61f45d1fb57202cbc1d308babd016301480612b56575b15612abe577f9d046b2f0502959e4fd5d2d5e9fbb6c73cc9b3bf6a5589c910a6f04e13b6a81790565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f68ea88fd0ed0ba07c35806ede17087b627fe05ff6a63fb69b5a4121c525be01460408201527fe8245ed8f93ccf147bc8972ab6d5f8278ed994d647700daaa5b7ebde9370aa6f60608201524660808201523060a082015260a08152612b5060c0826120ef565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000014614612a95565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411612c08579160209360809260ff60009560405194855216868401526040830152606082015282805260015afa15612bfc576000516001600160a01b03811615612bf05790600090600090565b50600090600190600090565b6040513d6000823e3d90fd5b50505060009160039190565b91909160048110156108f45780612c2a57509050565b600060018203612c455763f645eedf60e01b60005260046000fd5b5060028103612c63578263fce698f760e01b60005260045260246000fd5b9091600360009214612c73575050565b6335e2f38360e21b825260045260249150fd5b90612cac5750805115612c9b57805190602001fd5b630a12f52160e11b60005260046000fd5b81511580612cdb575b612cbd575090565b6001600160a01b0390639996b31560e01b6000521660045260246000fd5b50803b15612cb556fea2646970667358221220e2cc80d86ef5e9d4c17b4ecb93d1fff11eaf021d8b7a220edce356a039302e6664736f6c634300081b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000ed708ea8dabe037a0062cb4a803ae92ffbff4bbd00000000000000000000000005a50724339e46f35f3897f28feaa768f6c7e20b
-----Decoded View---------------
Arg [0] : treasury_ (address): 0xed708EA8DaBE037A0062cb4A803AE92FFbfF4bbD
Arg [1] : signer_ (address): 0x05a50724339E46F35F3897F28feaA768f6C7E20B
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000ed708ea8dabe037a0062cb4a803ae92ffbff4bbd
Arg [1] : 00000000000000000000000005a50724339e46f35f3897f28feaa768f6c7e20b
Loading...
Loading
Loading...
Loading
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.