More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x5e353822b1261163fff22c709a88f0e2cd94987e94abb27e18fab0be871675e2 | Lock | (pending) | 2 days ago | IN | 0 ETH | (Pending) | |||
0x698fc81f4c3154f1456c8f9dd27384ca16e38daf1ab7362f5fed7ed1d34ea16e | Lock | (pending) | 2 days ago | IN | 0 ETH | (Pending) | |||
0xfd10437c9fd426edd762242a76adf553461a4d7f46f8a12ed871cf73aa198300 | Lock | (pending) | 4 days ago | IN | 0 ETH | (Pending) | |||
0x9e142549614401f68917eb6157d1d6d83dee3e9a865ec14f6b5ff88b2dd9726c | Lock | (pending) | 4 days ago | IN | 0 ETH | (Pending) | |||
0xf1209645f5e9729e99f82e24c7d612da935582621d4c5b6b3788bc129a0eaa04 | Lock | (pending) | 4 days ago | IN | 0 ETH | (Pending) | |||
0xe8f18cd8472837caf248491e70e0eafb8fb17d36bc349e9128daeaf58a4aacab | Lock | (pending) | 5 days ago | IN | 0 ETH | (Pending) | |||
0xb8c4f0124144f1508d75cb1c03f44ea3810bbcb3c80fb4dec637b8a731562640 | Claim | (pending) | 5 days ago | IN | 0 ETH | (Pending) | |||
0x6d50683d9f9f9a187d92efeb0a28783e65579f4f62462519c56c5587cec04f9a | Lock | (pending) | 5 days ago | IN | 0 ETH | (Pending) | |||
0x6d2dc7e59c610ed393afe66df4d0259f816e9839d33bd96d346da506b45eb29e | Claim | (pending) | 5 days ago | IN | 0 ETH | (Pending) | |||
Claim | 20189563 | 27 mins ago | IN | 0 ETH | 0.00108655 | ||||
Claim | 20189437 | 52 mins ago | IN | 0 ETH | 0.00054745 | ||||
Claim | 20189431 | 53 mins ago | IN | 0 ETH | 0.00049948 | ||||
Claim | 20188963 | 2 hrs ago | IN | 0 ETH | 0.00077121 | ||||
Claim | 20188906 | 2 hrs ago | IN | 0 ETH | 0.00105481 | ||||
Claim | 20188613 | 3 hrs ago | IN | 0 ETH | 0.00091196 | ||||
Claim | 20188323 | 4 hrs ago | IN | 0 ETH | 0.00071911 | ||||
Claim | 20187971 | 5 hrs ago | IN | 0 ETH | 0.00067701 | ||||
Lock | 20187798 | 6 hrs ago | IN | 0 ETH | 0.00061216 | ||||
Claim | 20187782 | 6 hrs ago | IN | 0 ETH | 0.00037287 | ||||
Claim | 20187352 | 7 hrs ago | IN | 0 ETH | 0.00133077 | ||||
Claim | 20186989 | 9 hrs ago | IN | 0 ETH | 0.00087267 | ||||
Claim | 20186987 | 9 hrs ago | IN | 0 ETH | 0.00092674 | ||||
Claim | 20186937 | 9 hrs ago | IN | 0 ETH | 0.00147705 | ||||
Claim | 20186577 | 10 hrs ago | IN | 0 ETH | 0.00085019 | ||||
Claim | 20186144 | 11 hrs ago | IN | 0 ETH | 0.00075169 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
DeFiMerkleVesting
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol'; import '@openzeppelin/contracts/security/Pausable.sol'; import './interfaces/IDeFiMerkleVesting.sol'; import './interfaces/IERC20Mint.sol'; contract DeFiMerkleVesting is Pausable, AccessControl, ReentrancyGuard, IDeFiMerkleVesting { using SafeERC20 for IERC20Mint; bytes32 public constant PAUSER_ROLE = keccak256('PAUSER_ROLE'); bytes32 public constant OPERATOR_ROLE = keccak256('OPERATOR_ROLE'); bytes32 public constant EXTERNAL_SOURCE_ROLE = keccak256('EXTERNAL_SOURCE_ROLE'); uint256 public constant ALLOWED_VESTING_UPDATE_THRESHOLD = 365 days; uint256 public constant YEAR = 365 days; uint256 public constant PRECISION = 10 ** 18; // Vesting token IERC20Mint private _token; // Vesting pools Pool[] private _pools; // Beneficiaries with the allocations mapping(uint256 => mapping(address => Beneficiary)) private _beneficiaries; constructor(address token_) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); _setupRole(OPERATOR_ROLE, _msgSender()); if (token_ == address(0)) revert TokenNullAddressErr(); _token = IERC20Mint(token_); } modifier whenValidSource(address source_) { if (!hasRole(EXTERNAL_SOURCE_ROLE, source_)) revert ExternalSourceAuthErr(); _; } function pause() external onlyRole(PAUSER_ROLE) { _pause(); } function unpause() external onlyRole(PAUSER_ROLE) { _unpause(); } function setupPool(uint256 startTime_, uint256 endTime_, bytes32 merkleRoot_, bool lockable_, uint256 baseRate_, uint256 boostRate_) external onlyRole(OPERATOR_ROLE) returns (uint256 pid) { if (block.timestamp > startTime_) revert PoolInvalidStartErr(); if (startTime_ >= endTime_) revert PoolInvalidEndErr(); pid = (uint256)(_pools.length); _pools.push( Pool({ defined: true, pid: pid, startTime: startTime_, endTime: endTime_, initialStartTime: startTime_, initialEndTime: endTime_, merkleRoot: merkleRoot_, lockable: lockable_, baseRate: baseRate_, boostRate: boostRate_ }) ); emit PoolAdded(pid, startTime_, endTime_, merkleRoot_, lockable_, baseRate_, boostRate_); } function updatePoolTiming(uint256 pid_, uint256 startTime_, uint256 endTime_) external onlyRole(OPERATOR_ROLE) { Pool memory pool = _pools[pid_]; if (!pool.defined) revert PoolUndefinedErr(pid_); if (pool.startTime < block.timestamp) revert PoolStartedErr(pid_); if (startTime_ < block.timestamp) revert PoolInvalidStartErr(); if (startTime_ >= endTime_) revert PoolInvalidEndErr(); if (pool.initialStartTime + ALLOWED_VESTING_UPDATE_THRESHOLD < startTime_) revert PoolInvalidStartToLargeErr(); if (pool.initialStartTime - ALLOWED_VESTING_UPDATE_THRESHOLD > startTime_) revert PoolInvalidStartToSmallErr(); if (pool.initialEndTime + ALLOWED_VESTING_UPDATE_THRESHOLD < endTime_) revert PoolInvalidEndToLargeErr(); if (pool.initialEndTime - ALLOWED_VESTING_UPDATE_THRESHOLD > endTime_) revert PoolInvalidEndToSmallErr(); _pools[pid_].startTime = startTime_; _pools[pid_].endTime = endTime_; emit PoolTimingUpdated(pid_, startTime_, endTime_); } function updatePoolRoot(uint256 pid_, bytes32 merkleRoot_) external onlyRole(OPERATOR_ROLE) { if (!_pools[pid_].defined) revert PoolUndefinedErr(pid_); _pools[pid_].merkleRoot = merkleRoot_; emit PoolRootUpdated(pid_, merkleRoot_); } function updatePoolRate(uint256 pid_, bool lockable_, uint256 baseRate_, uint256 boostRate_) external onlyRole(OPERATOR_ROLE) { if (!_pools[pid_].defined) revert PoolUndefinedErr(pid_); _pools[pid_].lockable = lockable_; _pools[pid_].baseRate = baseRate_; _pools[pid_].boostRate = boostRate_; emit PoolRateUpdated(pid_, lockable_, baseRate_, boostRate_); } function enableBeneficiary(uint256[] calldata pids_, address beneficiary_) external onlyRole(DEFAULT_ADMIN_ROLE) { for (uint256 i = 0; i < pids_.length; i++) { uint256 pid_ = pids_[i]; if (!_pools[pid_].defined) revert PoolUndefinedErr(pid_); _beneficiaries[pid_][beneficiary_].disabled = false; emit BeneficiaryEnabled(pid_, beneficiary_); } } function disableBeneficiary(uint256[] calldata pids_, address beneficiary_) external onlyRole(DEFAULT_ADMIN_ROLE) { for (uint256 i = 0; i < pids_.length; i++) { uint256 pid_ = pids_[i]; if (!_pools[pid_].defined) revert PoolUndefinedErr(pid_); _beneficiaries[pid_][beneficiary_].disabled = true; emit BeneficiaryDisabled(pid_, beneficiary_); } } function recoverBeneficiary(uint256 pid_, address beneficiary_, bool disabled_, uint256 withdrawn_, bool locked_, uint256 lockedAt_, uint256 rate_) external onlyRole(DEFAULT_ADMIN_ROLE) { if (!_pools[pid_].defined) revert PoolUndefinedErr(pid_); _beneficiaries[pid_][beneficiary_].disabled = disabled_; _beneficiaries[pid_][beneficiary_].withdrawn = withdrawn_; _beneficiaries[pid_][beneficiary_].rate = rate_; _beneficiaries[pid_][beneficiary_].locked = locked_; _beneficiaries[pid_][beneficiary_].lockedAt = lockedAt_; emit BeneficiaryRecovered(pid_, beneficiary_); } function claim(uint256 pid_, bytes calldata message_) external nonReentrant() whenNotPaused() returns (uint256 amount) { address sender = _msgSender(); Pool memory pool = _pools[pid_]; if (!pool.defined) revert PoolUndefinedErr(pid_); Beneficiary memory beneficiary = _beneficiaries[pid_][sender]; if (beneficiary.disabled) revert BeneficiaryDisabledErr(sender); if (pool.endTime > block.timestamp && beneficiary.locked) revert BeneficiaryLockedErr(sender); // verify the merkle proof (bool valid, ) = decodeMessage(pid_, sender, message_); if (!valid) revert BeneficiaryProofErr(sender); amount = getReleasableAmount(pid_, sender, message_); if (amount == 0) revert BeneficiaryNoFundsErr(sender); if (beneficiary.locked) { uint256 duration = pool.endTime - beneficiary.lockedAt; uint256 vested = getReleasableAmountAt(pid_, sender, message_, beneficiary.lockedAt); uint256 vestedReward = vested * beneficiary.rate * duration / PRECISION / YEAR; uint256 vestingReward = (amount - vested) * beneficiary.rate * duration / PRECISION / YEAR / 2; amount += vestedReward + vestingReward; } _beneficiaries[pid_][sender].withdrawn = _beneficiaries[pid_][sender].withdrawn + amount; if (_token.balanceOf(address(this)) >= amount) { _token.safeTransfer(sender, amount); } else { _token.mint(sender, amount); } emit Claimed(pid_, sender, sender, amount); } function claimFrom(uint256 pid_, address from_, address to_, bytes calldata message_) external nonReentrant() whenNotPaused() whenValidSource(_msgSender()) returns (uint256 amount) { Pool memory pool = _pools[pid_]; if (!pool.defined) revert PoolUndefinedErr(pid_); Beneficiary memory beneficiary = _beneficiaries[pid_][from_]; if (beneficiary.disabled) revert BeneficiaryDisabledErr(from_); if (pool.endTime > block.timestamp && beneficiary.locked) revert BeneficiaryLockedErr(from_); // verify the merkle proof (bool valid, ) = decodeMessage(pid_, from_, message_); if (!valid) revert BeneficiaryProofErr(from_); amount = getReleasableAmount(pid_, from_, message_); if (amount == 0) revert BeneficiaryNoFundsErr(from_); if (beneficiary.locked) { uint256 duration = pool.endTime - beneficiary.lockedAt; uint256 vested = getReleasableAmountAt(pid_, from_, message_, beneficiary.lockedAt); uint256 vestedReward = vested * beneficiary.rate * duration / PRECISION / YEAR; uint256 vestingReward = (amount - vested) * beneficiary.rate * duration / PRECISION / YEAR / 2; amount += vestedReward + vestingReward; } _beneficiaries[pid_][from_].withdrawn = _beneficiaries[pid_][from_].withdrawn + amount; if (_token.balanceOf(address(this)) >= amount) { _token.safeTransfer(to_, amount); } else { _token.mint(to_, amount); } emit Claimed(pid_, from_, to_, amount); } function lock(uint256 pid_, bytes calldata message_) external nonReentrant() whenNotPaused() { address sender = _msgSender(); Pool memory pool = _pools[pid_]; if (!pool.defined) revert PoolUndefinedErr(pid_); if (!pool.lockable) revert PoolUnlockableErr(pid_); if (pool.startTime > block.timestamp) revert PoolStartedErr(pid_); if (pool.endTime < block.timestamp) revert PoolEndedErr(pid_); Beneficiary memory beneficiary = _beneficiaries[pid_][sender]; if (beneficiary.disabled) revert BeneficiaryDisabledErr(sender); if (beneficiary.locked) revert BeneficiaryLockedErr(sender); // verify the merkle proof (bool valid, ) = decodeMessage(pid_, sender, message_); if (!valid) revert BeneficiaryProofErr(sender); uint256 rate = pool.baseRate + pool.boostRate; _beneficiaries[pid_][sender].rate = rate; _beneficiaries[pid_][sender].locked = true; _beneficiaries[pid_][sender].lockedAt = block.timestamp; emit Locked(pid_, sender, rate); } function unlock(uint256 pid_, address[] calldata beneficiaries_) external onlyRole(DEFAULT_ADMIN_ROLE) { if (!_pools[pid_].defined) revert PoolUndefinedErr(pid_); uint256 length = beneficiaries_.length; for (uint256 i = 0; i < length; i++) { address beneficiary = beneficiaries_[i]; _beneficiaries[pid_][beneficiary].rate = 0; _beneficiaries[pid_][beneficiary].locked = false; _beneficiaries[pid_][beneficiary].lockedAt = 0; emit Unlocked(pid_, beneficiary); } } function recoverERC20(address token_, uint256 amount_) external onlyRole(DEFAULT_ADMIN_ROLE) { IERC20Mint(token_).safeTransfer(_msgSender(), amount_); emit ERC20Recovered(token_, amount_); } function getBeneficiary(uint256 pid_, address beneficiary_, bytes calldata message_) external view returns ( bool disabled, uint256 lockedAmount, uint256 withdrawn, uint256 releasableAmount, uint256 currentTime, bool locked, uint256 lockedAt, uint256 rate ) { currentTime = block.timestamp; (bool valid, uint256 amount) = decodeMessage(pid_, beneficiary_, message_); if (valid) { Beneficiary memory beneficiary = _beneficiaries[pid_][beneficiary_]; disabled = beneficiary.disabled; lockedAmount = amount; withdrawn = beneficiary.withdrawn; releasableAmount = getReleasableAmount(pid_, beneficiary_, message_); rate = beneficiary.rate; locked = beneficiary.locked; lockedAt = beneficiary.lockedAt; } } function getPoolsCount() external view returns (uint256 _poolsCount) { return _pools.length; } function getPool(uint256 pid_) external view returns ( uint256 startTime, uint256 endTime, bytes32 merkleRoot, bool lockable, uint256 baseRate, uint256 boostRate ) { if (pid_ < _pools.length) { startTime = _pools[pid_].startTime; endTime = _pools[pid_].endTime; merkleRoot = _pools[pid_].merkleRoot; lockable = _pools[pid_].lockable; baseRate = _pools[pid_].baseRate; boostRate = _pools[pid_].boostRate; } } function getReleasableAmount(uint256 pid_, address beneficiary_, bytes calldata message_) public view returns (uint256) { return getReleasableAmountAt(pid_, beneficiary_, message_, block.timestamp); } function getReleasableAmountAt(uint256 pid_, address beneficiary_, bytes calldata message_, uint256 timestamp_) private view returns (uint256) { uint256 withdrawn = _beneficiaries[pid_][beneficiary_].withdrawn; uint256 vestedAmount = getVestedAmount(pid_, beneficiary_, message_, timestamp_); if (withdrawn >= vestedAmount) { return 0; } return vestedAmount - withdrawn; } function getVestedAmount(uint256 pid_, address beneficiary_, bytes calldata message_, uint256 time_) public view returns (uint256) { if (pid_ >= _pools.length) { return 0; } if (time_ < _pools[pid_].startTime) { return 0; } (bool valid, uint256 lockedAmount) = decodeMessage(pid_, beneficiary_, message_); if (!valid || lockedAmount == 0) { return 0; } uint256 vestingDuration = _pools[pid_].endTime - _pools[pid_].startTime; uint256 timeDuration = time_ - _pools[pid_].startTime; uint256 amount = lockedAmount * timeDuration / vestingDuration; if (amount > lockedAmount) { amount = lockedAmount; } return amount; } function decodeMessage(uint256 pid_, address beneficiary_, bytes calldata message_) private view returns (bool, uint256) { (uint256 amount, bytes32[] memory proof) = abi.decode(message_, (uint256, bytes32[])); bytes32 leaf = keccak256(bytes.concat(keccak256(abi.encode(beneficiary_, amount)))); bool valid = MerkleProof.verify(proof, _pools[pid_].merkleRoot, leaf); return (valid, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../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 => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @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; 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 require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // 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 v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @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. */ 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]. */ 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 v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` 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 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../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 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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @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, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @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.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @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 up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (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; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) 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. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 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. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); 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 (rounding == Rounding.Up && 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 down. * * 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @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 v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @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), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(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) { 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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); 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 keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; interface IDeFiMerkleVestingActions { /** * @dev Initialize new vesting pool. * @param startTime_ vesting start time. * @param endTime_ vesting end time. * @param merkleRoot_ merkle root. * @param lockable_ if pool lockable. * @param baseRate_ pool base rate. * @param boostRate_ pool boost rate. */ function setupPool( uint256 startTime_, uint256 endTime_, bytes32 merkleRoot_, bool lockable_, uint256 baseRate_, uint256 boostRate_ ) external returns (uint256 pid); /** * @dev Sets new timing parameters of the vesting pool. * @param pid_ pool id. * @param startTime_ vesting start time. * @param endTime_ vesting end time. */ function updatePoolTiming(uint256 pid_, uint256 startTime_, uint256 endTime_) external; /** * @dev Sets new merkle root of the vesting pool. * @param pid_ pool id. * @param merkleRoot_ merkle root. */ function updatePoolRoot(uint256 pid_, bytes32 merkleRoot_) external; /** * @dev Sets new rate parameters of the vesting pool. * @param pid_ pool id. * @param lockable_ if pool lockable. * @param baseRate_ pool base rate. * @param boostRate_ pool boost rate. */ function updatePoolRate(uint256 pid_, bool lockable_, uint256 baseRate_, uint256 boostRate_) external; /** * @dev Enables beneficiary per pools. * @param pids_ pool ids. * @param beneficiary_ beneficiary address. */ function enableBeneficiary(uint256[] calldata pids_, address beneficiary_) external; /** * @dev Disables beneficiary per pools(in case wallet was exploited). * @param pids_ pool ids. * @param beneficiary_ beneficiary address. */ function disableBeneficiary(uint256[] calldata pids_, address beneficiary_) external; /** * @dev Recovers beneficiary to a predefined state(in case wallet was exploited). * @param pid_ pool id. * @param beneficiary_ beneficiary address. * @param disabled_ if beneficiary disabled. * @param withdrawn_ how many tokens beneficiary have withdrawn. * @param locked_ if beneficiary locked pool. * @param lockedAt_ if when beneficiary was locked. * @param rate_ beneficiary lock rate. */ function recoverBeneficiary(uint256 pid_, address beneficiary_, bool disabled_, uint256 withdrawn_, bool locked_, uint256 lockedAt_, uint256 rate_) external; /** * @dev Allows beneficiary to claim vested tokens. * @param pid_ pool id. * @param message_ beneficiary message. */ function claim(uint256 pid_, bytes calldata message_) external returns (uint256 amount); /** * @dev Allows third party to claim beneficiaries vested tokens(in case of integration with other contracts). * @param pid_ pool id. * @param from_ beneficiary address. * @param to_ address where the tokens will be transferred. * @param message_ beneficiary message. */ function claimFrom(uint256 pid_, address from_, address to_, bytes calldata message_) external returns (uint256 amount); /** * @dev Allows beneficiary to lock vesting tokens(for the vesting duration) to earn interest rate. * @param pid_ pool id. * @param message_ beneficiary message. */ function lock(uint256 pid_, bytes calldata message_) external; /** * @dev Allows to unlock vesting tokens. * @param pid_ pool id. * @param beneficiaries_ beneficiaries addresses. */ function unlock(uint256 pid_, address[] calldata beneficiaries_) external; /** * @dev Allows to recover erc20 tokens. * @param token_ token address. * @param amount_ amount to be recovered. */ function recoverERC20(address token_, uint256 amount_) external; /** * @dev Returns amount of releasable tokens per beneficiary per pool. * @param pid_ pool id. * @param beneficiary_ beneficiary address. * @param message_ beneficiary message. */ function getReleasableAmount(uint256 pid_, address beneficiary_, bytes calldata message_) external view returns (uint256); /** * @dev Returns amount of vested tokens per beneficiary per timestamp. * @param pid_ pool id. * @param beneficiary_ beneficiary address. * @param message_ beneficiary message. * @param time_ time of vesting. */ function getVestedAmount(uint256 pid_, address beneficiary_, bytes calldata message_, uint256 time_) external view returns (uint256); /** * @dev Returns beneficiary details per pool. * @param pid_ pool id. * @param beneficiary_ beneficiary address. * @param message_ beneficiary message. */ function getBeneficiary(uint256 pid_, address beneficiary_, bytes calldata message_) external view returns ( bool disabled, uint256 lockedAmount, uint256 withdrawn, uint256 releasableAmount, uint256 currentTime, bool locked, uint256 lockedAt, uint256 rate ); /** * @dev Returns count of pools. */ function getPoolsCount() external view returns (uint256 poolsCount); /** * @dev Returns pool details. * @param pid_ pool id. */ function getPool(uint256 pid_) external view returns ( uint256 startTime, uint256 endTime, bytes32 merkleRoot, bool lockable, uint256 baseRate, uint256 boostRate ); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; interface IDeFiMerkleVestingErrors { error ArrayParamsInvalidLengthErr(); error TokenNullAddressErr(); error TokenInvalidErr(); error BeneficiaryDisabledErr(address beneficiary_); error BeneficiaryNoFundsErr(address beneficiary_); error BeneficiaryLockedErr(address beneficiary_); error BeneficiaryProofErr(address beneficiary_); error PoolUndefinedErr(uint256 pid_); error PoolStartedErr(uint256 pid_); error PoolInvalidStartErr(); error PoolInvalidStartToLargeErr(); error PoolInvalidStartToSmallErr(); error PoolInvalidEndErr(); error PoolInvalidEndToLargeErr(); error PoolInvalidEndToSmallErr(); error PoolEndedErr(uint256 pid_); error PoolUnlockableErr(uint256 pid_); error ExternalSourceAuthErr(); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; interface IDeFiMerkleVestingEvents { event BeneficiaryRecovered(uint256 indexed pid, address indexed beneficiary); event BeneficiaryEnabled(uint256 indexed pid, address indexed beneficiary); event BeneficiaryDisabled(uint256 indexed pid, address indexed beneficiary); event Claimed(uint256 indexed pid, address indexed beneficiary, address indexed to, uint256 value); event Locked(uint256 indexed pid, address indexed beneficiary, uint256 rate); event Unlocked(uint256 indexed pid, address indexed beneficiary); event PoolAdded(uint256 indexed pid, uint256 startTime, uint256 endTime, bytes32 merkleRoot, bool lockable, uint256 baseRate, uint256 boostRate); event PoolTimingUpdated(uint256 indexed pid, uint256 startTime, uint256 endTime); event PoolRootUpdated(uint256 indexed pid, bytes32 merkleRoot); event PoolRateUpdated(uint256 indexed pid, bool lockable, uint256 baseRate, uint256 boostRate); event ERC20Recovered(address token, uint256 amount); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; interface IDeFiMerkleVestingState { struct Beneficiary { bool disabled; uint256 withdrawn; bool locked; uint256 lockedAt; uint256 rate; } struct Pool { bool defined; uint256 pid; uint256 startTime; uint256 endTime; uint256 initialStartTime; uint256 initialEndTime; bytes32 merkleRoot; bool lockable; uint256 baseRate; uint256 boostRate; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import './DeFiMerkleVesting/IDeFiMerkleVestingActions.sol'; import './DeFiMerkleVesting/IDeFiMerkleVestingErrors.sol'; import './DeFiMerkleVesting/IDeFiMerkleVestingEvents.sol'; import './DeFiMerkleVesting/IDeFiMerkleVestingState.sol'; interface IDeFiMerkleVesting is IDeFiMerkleVestingActions, IDeFiMerkleVestingErrors, IDeFiMerkleVestingEvents, IDeFiMerkleVestingState { }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; interface IERC20Mint is IERC20 { function mint(address to_, uint256 amount_) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "viaIR": true, "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":"token_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayParamsInvalidLengthErr","type":"error"},{"inputs":[{"internalType":"address","name":"beneficiary_","type":"address"}],"name":"BeneficiaryDisabledErr","type":"error"},{"inputs":[{"internalType":"address","name":"beneficiary_","type":"address"}],"name":"BeneficiaryLockedErr","type":"error"},{"inputs":[{"internalType":"address","name":"beneficiary_","type":"address"}],"name":"BeneficiaryNoFundsErr","type":"error"},{"inputs":[{"internalType":"address","name":"beneficiary_","type":"address"}],"name":"BeneficiaryProofErr","type":"error"},{"inputs":[],"name":"ExternalSourceAuthErr","type":"error"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"}],"name":"PoolEndedErr","type":"error"},{"inputs":[],"name":"PoolInvalidEndErr","type":"error"},{"inputs":[],"name":"PoolInvalidEndToLargeErr","type":"error"},{"inputs":[],"name":"PoolInvalidEndToSmallErr","type":"error"},{"inputs":[],"name":"PoolInvalidStartErr","type":"error"},{"inputs":[],"name":"PoolInvalidStartToLargeErr","type":"error"},{"inputs":[],"name":"PoolInvalidStartToSmallErr","type":"error"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"}],"name":"PoolStartedErr","type":"error"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"}],"name":"PoolUndefinedErr","type":"error"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"}],"name":"PoolUnlockableErr","type":"error"},{"inputs":[],"name":"TokenInvalidErr","type":"error"},{"inputs":[],"name":"TokenNullAddressErr","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"}],"name":"BeneficiaryDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"}],"name":"BeneficiaryEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"}],"name":"BeneficiaryRecovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"lockable","type":"bool"},{"indexed":false,"internalType":"uint256","name":"baseRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"boostRate","type":"uint256"}],"name":"PoolAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"bool","name":"lockable","type":"bool"},{"indexed":false,"internalType":"uint256","name":"baseRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"boostRate","type":"uint256"}],"name":"PoolRateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"PoolRootUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"PoolTimingUpdated","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":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"}],"name":"Unlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ALLOWED_VESTING_UPDATE_THRESHOLD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXTERNAL_SOURCE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"bytes","name":"message_","type":"bytes"}],"name":"claim","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"address","name":"from_","type":"address"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"bytes","name":"message_","type":"bytes"}],"name":"claimFrom","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"pids_","type":"uint256[]"},{"internalType":"address","name":"beneficiary_","type":"address"}],"name":"disableBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"pids_","type":"uint256[]"},{"internalType":"address","name":"beneficiary_","type":"address"}],"name":"enableBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"address","name":"beneficiary_","type":"address"},{"internalType":"bytes","name":"message_","type":"bytes"}],"name":"getBeneficiary","outputs":[{"internalType":"bool","name":"disabled","type":"bool"},{"internalType":"uint256","name":"lockedAmount","type":"uint256"},{"internalType":"uint256","name":"withdrawn","type":"uint256"},{"internalType":"uint256","name":"releasableAmount","type":"uint256"},{"internalType":"uint256","name":"currentTime","type":"uint256"},{"internalType":"bool","name":"locked","type":"bool"},{"internalType":"uint256","name":"lockedAt","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"}],"name":"getPool","outputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"bool","name":"lockable","type":"bool"},{"internalType":"uint256","name":"baseRate","type":"uint256"},{"internalType":"uint256","name":"boostRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolsCount","outputs":[{"internalType":"uint256","name":"_poolsCount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"address","name":"beneficiary_","type":"address"},{"internalType":"bytes","name":"message_","type":"bytes"}],"name":"getReleasableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"address","name":"beneficiary_","type":"address"},{"internalType":"bytes","name":"message_","type":"bytes"},{"internalType":"uint256","name":"time_","type":"uint256"}],"name":"getVestedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"bytes","name":"message_","type":"bytes"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"address","name":"beneficiary_","type":"address"},{"internalType":"bool","name":"disabled_","type":"bool"},{"internalType":"uint256","name":"withdrawn_","type":"uint256"},{"internalType":"bool","name":"locked_","type":"bool"},{"internalType":"uint256","name":"lockedAt_","type":"uint256"},{"internalType":"uint256","name":"rate_","type":"uint256"}],"name":"recoverBeneficiary","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":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startTime_","type":"uint256"},{"internalType":"uint256","name":"endTime_","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"},{"internalType":"bool","name":"lockable_","type":"bool"},{"internalType":"uint256","name":"baseRate_","type":"uint256"},{"internalType":"uint256","name":"boostRate_","type":"uint256"}],"name":"setupPool","outputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"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":"uint256","name":"pid_","type":"uint256"},{"internalType":"address[]","name":"beneficiaries_","type":"address[]"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"bool","name":"lockable_","type":"bool"},{"internalType":"uint256","name":"baseRate_","type":"uint256"},{"internalType":"uint256","name":"boostRate_","type":"uint256"}],"name":"updatePoolRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot_","type":"bytes32"}],"name":"updatePoolRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"pid_","type":"uint256"},{"internalType":"uint256","name":"startTime_","type":"uint256"},{"internalType":"uint256","name":"endTime_","type":"uint256"}],"name":"updatePoolTiming","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608034620001ea57601f62002c5c38819003918201601f1916830192916001600160401b03841183851017620001ef5780839260409586528339602092839181010312620001ea57516001600160a01b0381169190829003620001ea5760ff19600090808254168255600180600255828052808452858320338452845260ff868420541615620001b5575b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a808452818552868420338552855260ff8785205416156200017e575b507f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92993848452818152868420338552815260ff87852054161562000145575b505050505080156200013457600380546001600160a01b03191691909117905551612a369081620002068239f35b81516303e71bcf60e31b8152600490fd5b848452818152868420903385525285832091825416179055339160008051602062002c3c833981519152339280a4388080808062000106565b808452818552868420338552855286842082848254161790553390339060008051602062002c3c8339815191528680a438620000c7565b8280528084528583203384528452858320818382541617905533338460008051602062002c3c8339815191528180a46200008a565b600080fd5b634e487b7160e01b600052604160045260246000fdfe608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a714611a2757508063068bcd8d14611955578063086018a41461190a57806317516e5114611865578063248a9ca314611836578063292b8c2a14611416578063298b0df7146113f35780632f2ff15d146113405780633259a4871461126a57806336568abe146111d857806338926b6d14610ef75780633f4ba83a14610e6357806357764e0f14610c8d5780635c975abb14610c6a578063687ff38b14610c2f5780636fc51aa014610b7557806378eb201914610aee57806383914540146107935780638456cb5914610a945780638980f11f14610a1957806391d14854146109cc578063a217fddf146109b0578063aaf5eb681461098d578063ae20a444146107b6578063b4ac686014610798578063b739c9f014610793578063bddfd8a514610656578063c4f5498314610576578063d547741f14610535578063d8f7c8361461030d578063e5e3c25b14610205578063e63ab1e9146101ca5763f5b541a61461018a57600080fd5b346101c55760003660031901126101c55760206040517f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9298152f35b600080fd5b346101c55760003660031901126101c55760206040517f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a8152f35b346101c55761010061021636611b2f565b600093600080600092600094600096600098610234838383876128bd565b9490610270575b50505050506040519615158752602087015260408601526060850152426080850152151560a084015260c083015260e0820152f35b965096509650965096505050806000526005602052604060002060018060a01b0383166000526020526040600020916102fa604051926102af84612172565b60ff85541615159687855260018601549687602087015260ff60028801541698604087019915158a526080600460038a01549960608a019a8b520154970196875299979442936127b1565b915194511515925193888080808061023b565b346101c55761031b36611b75565b9190610325612545565b61032d612420565b61033f61033983612464565b5061249f565b9081511561051c5760e08201511561050357604082015142106104ea57426060830151106104d15782600052602093600585526040600020336000528552604060002060405161038e81612172565b60ff8254161515908181526001830154888201526080600460ff600286015416946040840195151586526003810154606085015201549101526104b957516104a1576103db9133856128bd565b501561048957610418816101206101007f55016b6cc60c3d15b7b1ebd0ab766c07b3082c98a5b4d1d7ff012a97652a4b1d940151910151906122de565b928260005260058152604060002033600052815283600460406000200155826000526005815260406000203360005281526002604060002001600160ff1982541617905582600052600581526040600020336000528152426003604060002001556040519384523393a36001600255005b604051634744227560e11b8152336004820152602490fd5b604051636a324a2160e01b8152336004820152602490fd5b60405163dc7e7a2d60e01b8152336004820152602490fd5b60405163016b5d4d60e21b815260048101849052602490fd5b60405163bd9c8acd60e01b815260048101849052602490fd5b60405163866a48fb60e01b815260048101849052602490fd5b604051635a65aef560e01b815260048101849052602490fd5b346101c55760403660031901126101c557610574600435610554611a7a565b9080600052600160205261056f600160406000200154612045565b61223f565b005b346101c55760403660031901126101c5576004356024356001600160401b0381116101c5576105a9903690600401611abd565b6105b1611bc3565b60ff6105bc84612464565b5054161561051c5760005b8181106105d057005b6105db818385612535565b356001600160a01b03811691908290036101c557600085815260056020908152604080832085845290915281206004810182905560028101805460ff19169055600301819055610651929086907fe7536184071702b58fe23a1d7d0df5fb9eed9a3176bbae54cf3e17d45f77ac329080a3612526565b6105c7565b346101c55760e03660031901126101c557600435610672611a7a565b9060443580151581036101c55760843580151581036101c557610693611bc3565b60ff61069e84612464565b5054161561051c5761074d90836000526106e36020936005855260406000209660018060a01b03169687600052855260406000209060ff801983541691151516179055565b836000526005835260406000208560005283526064356001604060002001558360005260058352604060002085600052835260c4356004604060002001558360005260058352604060002085600052835260026040600020019060ff801983541691151516179055565b8160005260058152604060002090836000525260a4356003604060002001557ff41978f93b2e73e071e82de058cda73b614350546b54ac5a7987cfcb626d47df600080a3005b611ba4565b346101c55760003660031901126101c5576020600454604051908152f35b346101c55760603660031901126101c5576004356024803590604435906107db611db7565b6107e761033985612464565b9081511561097757604082015142116109615742841061094f578284101561093d57608082018051906301e133809182810180911161091657861161092b57516301e1337f1993908481019081116109165786106109045760a0019081519081018091116108ef5784116108dd57519182019182116108c9575081106108b757816040917f78bf510897f295aa3433f82077297b2e8cd573280921cd1ad95c02c249e844b493600261089887612464565b5001558060036108a787612464565b50015582519182526020820152a2005b604051630608ad9160e31b8152600490fd5b634e487b7160e01b60009081526011600452fd5b604051633149f35760e21b8152600490fd5b82634e487b7160e01b60005260116004526000fd5b604051631411ba2360e01b8152600490fd5b83634e487b7160e01b60005260116004526000fd5b604051633e01366960e01b8152600490fd5b60405163f07538e760e01b8152600490fd5b6040516308eda81360e11b8152600490fd5b60405163bd9c8acd60e01b815260048101869052fd5b604051635a65aef560e01b815260048101869052fd5b346101c55760003660031901126101c5576020604051670de0b6b3a76400008152f35b346101c55760003660031901126101c557602060405160008152f35b346101c55760403660031901126101c5576109e5611a7a565b600435600052600160205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b346101c55760403660031901126101c5576004356001600160a01b0381168082036101c5577f505b28e6941631badc363841ecbf8e1214b9379c643936458e87be718e15799991610a776024358093610a70611bc3565b3390612599565b604080516001600160a01b039290921682526020820192909252a1005b346101c55760003660031901126101c557610aad611efe565b610ab5612420565b600160ff1960005416176000557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346101c55760403660031901126101c557600435602435610b0d611db7565b60ff610b1883612464565b50541615610b5c576020817f1c5364cfbfb399eb637e016eaa89d211ca9c62c84bb600fb1d4696c4497fc86d926006610b5086612464565b500155604051908152a2005b604051635a65aef560e01b815260048101839052602490fd5b346101c557610b8336611aed565b9190610b8d611bc3565b60005b818110610b9957005b610ba4818385612535565b3560ff610bb082612464565b50541615610c175760008181526005602090815260408083206001600160a01b03891680855292528220805460ff19169055610c12939290917f19906da7e7650f2d1c898474c806e39156c964dad2349d22ec3476331fb578c59080a3612526565b610b90565b60249060405190635a65aef560e01b82526004820152fd5b346101c55760003660031901126101c55760206040517fda489a047deffcd16558555da4614a51cef323c3497eaee639b4874ead8e5d978152f35b346101c55760003660031901126101c557602060ff600054166040519015158152f35b346101c55760c03660031901126101c557606435151580606435036101c557610cb4611db7565b600435421161094f57602435600435101561093d5760045460405191610cd9836121a0565b6001835281602084015260043560408401526024356060840152600435608084015260243560a084015260443560c084015260e083015260843561010083015260a43561012083015268010000000000000000811015610e4d5760018101600455610d4381612464565b610e3757600961012084610d68602096511515859060ff801983541691151516179055565b85810151600185015560408101516002850155606081015160038501556080810151600485015560a0810151600585015560c08101516006850155610dc260e08201511515600786019060ff801983541691151516179055565b6101008101516008850155015191015560408051600435815260243560208201526044359181019190915260643515156060820152608435608082015260a43560a082015281907f979a67f5ceb29e6cd3924243dc9cd5dbcf9ddd4e70f0b99fa5ed0be48754a84d9060c090a2604051908152f35b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052604160045260246000fd5b346101c55760003660031901126101c557610e7c611efe565b60005460ff811615610ebb5760ff19166000557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b346101c557610f0536611b75565b9091610f0f612545565b610f17612420565b610f2361033982612464565b91825115610b5c578160005260209360058552604060002033600052855260406000209060405192610f5484612172565b60ff83541615159586855260018401548886015260ff600285015416966040860197151588526080600460038701549660608901978852015496019586526104b95760600180514210806111ce575b6104a157610fb3828433896128bd565b501561048957610fc6428385338a6127b1565b9687156111b65751611133575b505050505080600052600583526040600020336000528352610ffd826001604060002001546122de565b8160005260058452604060002033600052845260016040600020015560018060a01b03806003541690604051906370a0823160e01b82523060048301528582602481865afa80156110f5578592600091611101575b5082116110a3576110699250339060035416612599565b60405182815233917fce3bcb6e219596cf26007ffdfaae8953bc3f76e3f36c0a79b23e28020da3222e853393a46001600255604051908152f35b5050803b156101c5576040516340c10f1960e01b815233600482015260248101849052906000908290604490829084905af180156110f5576110e6575b50611069565b6110ef9061218d565b836110e0565b6040513d6000823e3d90fd5b809350878092503d831161112c575b61111a81836121f2565b810103126101c5578480925190611052565b503d611110565b6111ab959694926111a5949261114f6111599351855190612519565b935191338a6127b1565b9161119a6301e1338092611184670de0b6b3a76400009361119286866111898661118486518d6122b5565b6122b5565b0404978a612519565b9051906122b5565b040460011c906122de565b906122de565b908380808080610fd3565b6040516301726f0d60e01b8152336004820152602490fd5b5086511515610fa3565b346101c55760403660031901126101c5576111f1611a7a565b336001600160a01b0382160361120d576105749060043561223f565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b346101c55760803660031901126101c557600435602435801515908181036101c5576044356064359161129b611db7565b60ff6112a686612464565b5054161561132757917f16d3c05008acea761fa875cd7c37b08244635908ef6b87e165d88ef5d4bc17b293916112f660609460076112e389612464565b50019060ff801983541691151516179055565b80600861130288612464565b50015581600961131188612464565b50015560405192835260208301526040820152a2005b604051635a65aef560e01b815260048101869052602490fd5b346101c55760403660031901126101c55760043561135c611a7a565b816000526001602052611376600160406000200154612045565b81600052600160205260406000209060018060a01b0316908160005260205260ff60406000205416156113a557005b8160005260016020526040600020816000526020526040600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4005b346101c557602061140e61140636611b2f565b9142936127b1565b604051908152f35b346101c55760803660031901126101c55761142f611a7a565b6044356001600160a01b03811690036101c5576064356001600160401b0381116101c557611461903690600401611a90565b909161146b612545565b611473612420565b3360009081527f20e215cf0236d30296f923699d9b0982ffa46e2fd8082bbaef96669498bfb30b602090815260409091205490939060ff1615611824576114be610339600435612464565b9283511561180b5760043560005260058552604060002060018060a01b0384166000528552604060002091604051926114f684612172565b600460ff82541615159182865260018101548987015260ff6002820154161515604087015260038101546060870152015460808501526117ea5760608501514210806117dd575b6117bc5761154f8282866004356128bd565b501561179b57611564428383876004356127b1565b94851561177a5760408401516116fd575b5050505060043560005260058352604060002060018060a01b03821660005283526115a8826001604060002001546122de565b60043560005260058452604060002060018060a01b038316600052845260016040600020015560018060a01b03600354166040516370a0823160e01b81523060048201528481602481855afa80156110f55784916000916116cc575b50106116725750600354611626908390604435906001600160a01b0316612599565b6040518281526001600160a01b036044358116921690600435907fce3bcb6e219596cf26007ffdfaae8953bc3f76e3f36c0a79b23e28020da3222e908690a46001600255604051908152f35b803b156101c5576040516340c10f1960e01b8152604480356001600160a01b031660048301526024820185905290916000918391829084905af180156110f5576116bd575b50611626565b6116c69061218d565b836116b7565b809250868092503d83116116f6575b6116e581836121f2565b810103126101c55783905186611604565b503d6116db565b9161172e6117709596949261171e60606111a5960151606086015190612519565b92606085015191896004356127b1565b9161119a6301e1338092611184670de0b6b3a7640000936080611767878761175e876111848d87890151906122b5565b0404988b612519565b910151906122b5565b9083808080611575565b6040516301726f0d60e01b81526001600160a01b0386166004820152602490fd5b604051634744227560e11b81526001600160a01b0385166004820152602490fd5b604051636a324a2160e01b81526001600160a01b0385166004820152602490fd5b506040830151151561153d565b60405163dc7e7a2d60e01b81526001600160a01b0385166004820152602490fd5b6024604051635a65aef560e01b81526004356004820152fd5b6040516331187d0d60e11b8152600490fd5b346101c55760203660031901126101c55760043560005260016020526020600160406000200154604051908152f35b346101c55761187336611aed565b919061187d611bc3565b60005b81811061188957005b611894818385612535565b3560ff6118a082612464565b50541615610c175760008181526005602090815260408083206001600160a01b03891680855292528220805460ff19166001179055611905939290917f88eb54279642589f86f71edf4ab11918253130143cff64d6e0bd921f453b81cb9080a3612526565b611880565b346101c55760803660031901126101c557611923611a7a565b6044356001600160401b0381116101c55760209161194861140e923690600401611a90565b9060643592600435612800565b346101c55760203660031901126101c55760043560008060008060009060009260045487106119bb575b6119b794959650604051968796879260a094919796959260c08501988552602085015260408401521515606083015260808201520152565b0390f35b50505050505060026119cc82612464565b5001546119b760036119dd84612464565b5001549260066119ec82612464565b5001549060ff60076119fd83612464565b500154166009611a1a6008611a1185612464565b50015493612464565b500154928695945061197f565b346101c55760203660031901126101c5576004359063ffffffff60e01b82168092036101c557602091637965db0b60e01b8114908115611a69575b5015158152f35b6301ffc9a760e01b14905083611a62565b602435906001600160a01b03821682036101c557565b9181601f840112156101c5578235916001600160401b0383116101c557602083818601950101116101c557565b9181601f840112156101c5578235916001600160401b0383116101c5576020808501948460051b0101116101c557565b60406003198201126101c557600435906001600160401b0382116101c557611b1791600401611abd565b90916024356001600160a01b03811681036101c55790565b60606003198201126101c557600435916024356001600160a01b03811681036101c55791604435906001600160401b0382116101c557611b7191600401611a90565b9091565b9060406003198301126101c55760043591602435906001600160401b0382116101c557611b7191600401611a90565b346101c55760003660031901126101c55760206040516301e133808152f35b3360009081527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49602090815260408083205490929060019060ff1615611c095750505050565b611c1233612312565b82855192611c1f846121d7565b60428452858401946060368737845115611da357603086538451821015611da35790607860218601536041915b818311611d3557505050611cf357611ca1938593611cd993611cca604894611cef9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161214f565b8401917001034b99036b4b9b9b4b733903937b6329607d1b60378401525180938684019061214f565b010360288101855201836121f2565b5162461bcd60e51b815291829160048301612213565b0390fd5b60648486519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611d8f576f181899199a1a9b1b9c1cb0b131b232b360811b901a611d6585886122eb565b5360041c928015611d7b57600019019190611c4c565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b3360009081527f31c1e66639f421f1853aeefe8ad6b62a3b96f3287efe23106923cd924aa025c260209081526040808320549092906001907f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9299060ff1615611e20575050505050565b611e2933612312565b90855192611e36846121d7565b60428452858401946060368737845115611da357603086538451821015611da35790607860218601536041915b818311611eb857505050611cf357611ca1938593611cd993611cca604894611cef9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161214f565b909192600f81166010811015611d8f576f181899199a1a9b1b9c1cb0b131b232b360811b901a611ee885886122eb565b5360041c928015611d7b57600019019190611e63565b3360009081527fb9cbbae02fe941283ec0eefd7b121e3bc7f89fae077b27bdd75a7fd4cf1543a860209081526040808320549092906001907f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a9060ff1615611f67575050505050565b611f7033612312565b90855192611f7d846121d7565b60428452858401946060368737845115611da357603086538451821015611da35790607860218601536041915b818311611fff57505050611cf357611ca1938593611cd993611cca604894611cef9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161214f565b909192600f81166010811015611d8f576f181899199a1a9b1b9c1cb0b131b232b360811b901a61202f85886122eb565b5360041c928015611d7b57600019019190611faa565b6000818152600190602091808352604093848320338452845260ff858420541615612071575050505050565b61207a33612312565b90855192612087846121d7565b60428452858401946060368737845115611da357603086538451821015611da35790607860218601536041915b81831161210957505050611cf357611ca1938593611cd993611cca604894611cef9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161214f565b909192600f81166010811015611d8f576f181899199a1a9b1b9c1cb0b131b232b360811b901a61213985886122eb565b5360041c928015611d7b576000190191906120b4565b60005b8381106121625750506000910152565b8181015183820152602001612152565b60a081019081106001600160401b03821117610e4d57604052565b6001600160401b038111610e4d57604052565b61014081019081106001600160401b03821117610e4d57604052565b604081019081106001600160401b03821117610e4d57604052565b608081019081106001600160401b03821117610e4d57604052565b90601f801991011681019081106001600160401b03821117610e4d57604052565b60409160208252612233815180928160208601526020868601910161214f565b601f01601f1916010190565b906000918083526001602052604083209160018060a01b03169182845260205260ff60408420541661227057505050565b8083526001602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b818102929181159184041417156122c857565b634e487b7160e01b600052601160045260246000fd5b919082018092116122c857565b9081518110156122fc570160200190565b634e487b7160e01b600052603260045260246000fd5b60405190606082018281106001600160401b03821117610e4d57604052602a82526020820160403682378251156122fc576030905381516001908110156122fc57607860218401536029905b8082116123b257505061236e5790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f8116601081101561240b576f181899199a1a9b1b9c1cb0b131b232b360811b901a6123e184866122eb565b5360041c9180156123f657600019019061235e565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b60ff6000541661242c57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b6004548110156122fc57600a906004600052027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0190600090565b906040516124ac816121a0565b6101206009829460ff8154161515845260018101546020850152600281015460408501526003810154606085015260048101546080850152600581015460a0850152600681015460c085015260ff600782015416151560e085015260088101546101008501520154910152565b919082039182116122c857565b60001981146122c85760010190565b91908110156122fc5760051b0190565b60028054146125545760028055565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405163a9059cbb60e01b60208083019182526001600160a01b03949094166024830152604480830195909552938152601f199493916125da6064836121f2565b60018060a01b031694604051916125f0836121bc565b8483527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858401526000809481925190828a5af13d15612713573d966001600160401b0388116126ff57859697612655612662969760405195601f84011601856121f2565b83523d868885013e612720565b8051918215918483156126d4575b50505090501561267d5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b9193818094500103126126fb578201519081151582036126f8575080388084612670565b80fd5b5080fd5b634e487b7160e01b85526041600452602485fd5b6126629394959691506060915b919290156127825750815115612734575090565b3b1561273d5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156127955750805190602001fd5b60405162461bcd60e51b8152908190611cef9060048301612213565b93916127e49391856000526005602052604060002060018060a01b03821660005260205260016040600020015495612800565b90818110156127f9576127f691612519565b90565b5050600090565b9290916004548410156128b357600261281885612464565b50015485106128b35761282b92846128bd565b92901580156128ab575b6128a35761286f612875916002612860612869600361285388612464565b5001548361286089612464565b50015490612519565b95612464565b836122b5565b811561288d570490808211612888575090565b905090565b634e487b7160e01b600052601260045260246000fd5b505050600090565b508215612835565b5050505050600090565b929390919384019160409283868203126101c5578535602092838801356001600160401b03988982116101c557019280601f850112156101c5578335988911610e4d5760059389851b9088519a6129168884018d6121f2565b8b5286808c01928201019283116101c55786809101915b8383106129f057505087516001600160a01b03909316868401908152602081018590526006936129919350909150612971816040840103601f1981018352826121f2565b5190208751868101918252868152612988816121bc565b51902097612464565b50015495936000945b88518610156129e25785841b890185015190876000838310156129d257505060005284526129cc866000205b95612526565b9461299a565b90916129cc9382528752206129c6565b945095945095505050149190565b823581529181019187910161292d56fea2646970667358221220f27c8ed2027faa953e4d8a775af05aa294bf17625c6bf2ef8832dc15432f0d0064736f6c634300081300332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d0000000000000000000000006b0faca7ba905a86f221ceb5ca404f605e5b3131
Deployed Bytecode
0x608080604052600436101561001357600080fd5b60003560e01c90816301ffc9a714611a2757508063068bcd8d14611955578063086018a41461190a57806317516e5114611865578063248a9ca314611836578063292b8c2a14611416578063298b0df7146113f35780632f2ff15d146113405780633259a4871461126a57806336568abe146111d857806338926b6d14610ef75780633f4ba83a14610e6357806357764e0f14610c8d5780635c975abb14610c6a578063687ff38b14610c2f5780636fc51aa014610b7557806378eb201914610aee57806383914540146107935780638456cb5914610a945780638980f11f14610a1957806391d14854146109cc578063a217fddf146109b0578063aaf5eb681461098d578063ae20a444146107b6578063b4ac686014610798578063b739c9f014610793578063bddfd8a514610656578063c4f5498314610576578063d547741f14610535578063d8f7c8361461030d578063e5e3c25b14610205578063e63ab1e9146101ca5763f5b541a61461018a57600080fd5b346101c55760003660031901126101c55760206040517f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9298152f35b600080fd5b346101c55760003660031901126101c55760206040517f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a8152f35b346101c55761010061021636611b2f565b600093600080600092600094600096600098610234838383876128bd565b9490610270575b50505050506040519615158752602087015260408601526060850152426080850152151560a084015260c083015260e0820152f35b965096509650965096505050806000526005602052604060002060018060a01b0383166000526020526040600020916102fa604051926102af84612172565b60ff85541615159687855260018601549687602087015260ff60028801541698604087019915158a526080600460038a01549960608a019a8b520154970196875299979442936127b1565b915194511515925193888080808061023b565b346101c55761031b36611b75565b9190610325612545565b61032d612420565b61033f61033983612464565b5061249f565b9081511561051c5760e08201511561050357604082015142106104ea57426060830151106104d15782600052602093600585526040600020336000528552604060002060405161038e81612172565b60ff8254161515908181526001830154888201526080600460ff600286015416946040840195151586526003810154606085015201549101526104b957516104a1576103db9133856128bd565b501561048957610418816101206101007f55016b6cc60c3d15b7b1ebd0ab766c07b3082c98a5b4d1d7ff012a97652a4b1d940151910151906122de565b928260005260058152604060002033600052815283600460406000200155826000526005815260406000203360005281526002604060002001600160ff1982541617905582600052600581526040600020336000528152426003604060002001556040519384523393a36001600255005b604051634744227560e11b8152336004820152602490fd5b604051636a324a2160e01b8152336004820152602490fd5b60405163dc7e7a2d60e01b8152336004820152602490fd5b60405163016b5d4d60e21b815260048101849052602490fd5b60405163bd9c8acd60e01b815260048101849052602490fd5b60405163866a48fb60e01b815260048101849052602490fd5b604051635a65aef560e01b815260048101849052602490fd5b346101c55760403660031901126101c557610574600435610554611a7a565b9080600052600160205261056f600160406000200154612045565b61223f565b005b346101c55760403660031901126101c5576004356024356001600160401b0381116101c5576105a9903690600401611abd565b6105b1611bc3565b60ff6105bc84612464565b5054161561051c5760005b8181106105d057005b6105db818385612535565b356001600160a01b03811691908290036101c557600085815260056020908152604080832085845290915281206004810182905560028101805460ff19169055600301819055610651929086907fe7536184071702b58fe23a1d7d0df5fb9eed9a3176bbae54cf3e17d45f77ac329080a3612526565b6105c7565b346101c55760e03660031901126101c557600435610672611a7a565b9060443580151581036101c55760843580151581036101c557610693611bc3565b60ff61069e84612464565b5054161561051c5761074d90836000526106e36020936005855260406000209660018060a01b03169687600052855260406000209060ff801983541691151516179055565b836000526005835260406000208560005283526064356001604060002001558360005260058352604060002085600052835260c4356004604060002001558360005260058352604060002085600052835260026040600020019060ff801983541691151516179055565b8160005260058152604060002090836000525260a4356003604060002001557ff41978f93b2e73e071e82de058cda73b614350546b54ac5a7987cfcb626d47df600080a3005b611ba4565b346101c55760003660031901126101c5576020600454604051908152f35b346101c55760603660031901126101c5576004356024803590604435906107db611db7565b6107e761033985612464565b9081511561097757604082015142116109615742841061094f578284101561093d57608082018051906301e133809182810180911161091657861161092b57516301e1337f1993908481019081116109165786106109045760a0019081519081018091116108ef5784116108dd57519182019182116108c9575081106108b757816040917f78bf510897f295aa3433f82077297b2e8cd573280921cd1ad95c02c249e844b493600261089887612464565b5001558060036108a787612464565b50015582519182526020820152a2005b604051630608ad9160e31b8152600490fd5b634e487b7160e01b60009081526011600452fd5b604051633149f35760e21b8152600490fd5b82634e487b7160e01b60005260116004526000fd5b604051631411ba2360e01b8152600490fd5b83634e487b7160e01b60005260116004526000fd5b604051633e01366960e01b8152600490fd5b60405163f07538e760e01b8152600490fd5b6040516308eda81360e11b8152600490fd5b60405163bd9c8acd60e01b815260048101869052fd5b604051635a65aef560e01b815260048101869052fd5b346101c55760003660031901126101c5576020604051670de0b6b3a76400008152f35b346101c55760003660031901126101c557602060405160008152f35b346101c55760403660031901126101c5576109e5611a7a565b600435600052600160205260406000209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b346101c55760403660031901126101c5576004356001600160a01b0381168082036101c5577f505b28e6941631badc363841ecbf8e1214b9379c643936458e87be718e15799991610a776024358093610a70611bc3565b3390612599565b604080516001600160a01b039290921682526020820192909252a1005b346101c55760003660031901126101c557610aad611efe565b610ab5612420565b600160ff1960005416176000557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1005b346101c55760403660031901126101c557600435602435610b0d611db7565b60ff610b1883612464565b50541615610b5c576020817f1c5364cfbfb399eb637e016eaa89d211ca9c62c84bb600fb1d4696c4497fc86d926006610b5086612464565b500155604051908152a2005b604051635a65aef560e01b815260048101839052602490fd5b346101c557610b8336611aed565b9190610b8d611bc3565b60005b818110610b9957005b610ba4818385612535565b3560ff610bb082612464565b50541615610c175760008181526005602090815260408083206001600160a01b03891680855292528220805460ff19169055610c12939290917f19906da7e7650f2d1c898474c806e39156c964dad2349d22ec3476331fb578c59080a3612526565b610b90565b60249060405190635a65aef560e01b82526004820152fd5b346101c55760003660031901126101c55760206040517fda489a047deffcd16558555da4614a51cef323c3497eaee639b4874ead8e5d978152f35b346101c55760003660031901126101c557602060ff600054166040519015158152f35b346101c55760c03660031901126101c557606435151580606435036101c557610cb4611db7565b600435421161094f57602435600435101561093d5760045460405191610cd9836121a0565b6001835281602084015260043560408401526024356060840152600435608084015260243560a084015260443560c084015260e083015260843561010083015260a43561012083015268010000000000000000811015610e4d5760018101600455610d4381612464565b610e3757600961012084610d68602096511515859060ff801983541691151516179055565b85810151600185015560408101516002850155606081015160038501556080810151600485015560a0810151600585015560c08101516006850155610dc260e08201511515600786019060ff801983541691151516179055565b6101008101516008850155015191015560408051600435815260243560208201526044359181019190915260643515156060820152608435608082015260a43560a082015281907f979a67f5ceb29e6cd3924243dc9cd5dbcf9ddd4e70f0b99fa5ed0be48754a84d9060c090a2604051908152f35b634e487b7160e01b600052600060045260246000fd5b634e487b7160e01b600052604160045260246000fd5b346101c55760003660031901126101c557610e7c611efe565b60005460ff811615610ebb5760ff19166000557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1005b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b346101c557610f0536611b75565b9091610f0f612545565b610f17612420565b610f2361033982612464565b91825115610b5c578160005260209360058552604060002033600052855260406000209060405192610f5484612172565b60ff83541615159586855260018401548886015260ff600285015416966040860197151588526080600460038701549660608901978852015496019586526104b95760600180514210806111ce575b6104a157610fb3828433896128bd565b501561048957610fc6428385338a6127b1565b9687156111b65751611133575b505050505080600052600583526040600020336000528352610ffd826001604060002001546122de565b8160005260058452604060002033600052845260016040600020015560018060a01b03806003541690604051906370a0823160e01b82523060048301528582602481865afa80156110f5578592600091611101575b5082116110a3576110699250339060035416612599565b60405182815233917fce3bcb6e219596cf26007ffdfaae8953bc3f76e3f36c0a79b23e28020da3222e853393a46001600255604051908152f35b5050803b156101c5576040516340c10f1960e01b815233600482015260248101849052906000908290604490829084905af180156110f5576110e6575b50611069565b6110ef9061218d565b836110e0565b6040513d6000823e3d90fd5b809350878092503d831161112c575b61111a81836121f2565b810103126101c5578480925190611052565b503d611110565b6111ab959694926111a5949261114f6111599351855190612519565b935191338a6127b1565b9161119a6301e1338092611184670de0b6b3a76400009361119286866111898661118486518d6122b5565b6122b5565b0404978a612519565b9051906122b5565b040460011c906122de565b906122de565b908380808080610fd3565b6040516301726f0d60e01b8152336004820152602490fd5b5086511515610fa3565b346101c55760403660031901126101c5576111f1611a7a565b336001600160a01b0382160361120d576105749060043561223f565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b346101c55760803660031901126101c557600435602435801515908181036101c5576044356064359161129b611db7565b60ff6112a686612464565b5054161561132757917f16d3c05008acea761fa875cd7c37b08244635908ef6b87e165d88ef5d4bc17b293916112f660609460076112e389612464565b50019060ff801983541691151516179055565b80600861130288612464565b50015581600961131188612464565b50015560405192835260208301526040820152a2005b604051635a65aef560e01b815260048101869052602490fd5b346101c55760403660031901126101c55760043561135c611a7a565b816000526001602052611376600160406000200154612045565b81600052600160205260406000209060018060a01b0316908160005260205260ff60406000205416156113a557005b8160005260016020526040600020816000526020526040600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a4005b346101c557602061140e61140636611b2f565b9142936127b1565b604051908152f35b346101c55760803660031901126101c55761142f611a7a565b6044356001600160a01b03811690036101c5576064356001600160401b0381116101c557611461903690600401611a90565b909161146b612545565b611473612420565b3360009081527f20e215cf0236d30296f923699d9b0982ffa46e2fd8082bbaef96669498bfb30b602090815260409091205490939060ff1615611824576114be610339600435612464565b9283511561180b5760043560005260058552604060002060018060a01b0384166000528552604060002091604051926114f684612172565b600460ff82541615159182865260018101548987015260ff6002820154161515604087015260038101546060870152015460808501526117ea5760608501514210806117dd575b6117bc5761154f8282866004356128bd565b501561179b57611564428383876004356127b1565b94851561177a5760408401516116fd575b5050505060043560005260058352604060002060018060a01b03821660005283526115a8826001604060002001546122de565b60043560005260058452604060002060018060a01b038316600052845260016040600020015560018060a01b03600354166040516370a0823160e01b81523060048201528481602481855afa80156110f55784916000916116cc575b50106116725750600354611626908390604435906001600160a01b0316612599565b6040518281526001600160a01b036044358116921690600435907fce3bcb6e219596cf26007ffdfaae8953bc3f76e3f36c0a79b23e28020da3222e908690a46001600255604051908152f35b803b156101c5576040516340c10f1960e01b8152604480356001600160a01b031660048301526024820185905290916000918391829084905af180156110f5576116bd575b50611626565b6116c69061218d565b836116b7565b809250868092503d83116116f6575b6116e581836121f2565b810103126101c55783905186611604565b503d6116db565b9161172e6117709596949261171e60606111a5960151606086015190612519565b92606085015191896004356127b1565b9161119a6301e1338092611184670de0b6b3a7640000936080611767878761175e876111848d87890151906122b5565b0404988b612519565b910151906122b5565b9083808080611575565b6040516301726f0d60e01b81526001600160a01b0386166004820152602490fd5b604051634744227560e11b81526001600160a01b0385166004820152602490fd5b604051636a324a2160e01b81526001600160a01b0385166004820152602490fd5b506040830151151561153d565b60405163dc7e7a2d60e01b81526001600160a01b0385166004820152602490fd5b6024604051635a65aef560e01b81526004356004820152fd5b6040516331187d0d60e11b8152600490fd5b346101c55760203660031901126101c55760043560005260016020526020600160406000200154604051908152f35b346101c55761187336611aed565b919061187d611bc3565b60005b81811061188957005b611894818385612535565b3560ff6118a082612464565b50541615610c175760008181526005602090815260408083206001600160a01b03891680855292528220805460ff19166001179055611905939290917f88eb54279642589f86f71edf4ab11918253130143cff64d6e0bd921f453b81cb9080a3612526565b611880565b346101c55760803660031901126101c557611923611a7a565b6044356001600160401b0381116101c55760209161194861140e923690600401611a90565b9060643592600435612800565b346101c55760203660031901126101c55760043560008060008060009060009260045487106119bb575b6119b794959650604051968796879260a094919796959260c08501988552602085015260408401521515606083015260808201520152565b0390f35b50505050505060026119cc82612464565b5001546119b760036119dd84612464565b5001549260066119ec82612464565b5001549060ff60076119fd83612464565b500154166009611a1a6008611a1185612464565b50015493612464565b500154928695945061197f565b346101c55760203660031901126101c5576004359063ffffffff60e01b82168092036101c557602091637965db0b60e01b8114908115611a69575b5015158152f35b6301ffc9a760e01b14905083611a62565b602435906001600160a01b03821682036101c557565b9181601f840112156101c5578235916001600160401b0383116101c557602083818601950101116101c557565b9181601f840112156101c5578235916001600160401b0383116101c5576020808501948460051b0101116101c557565b60406003198201126101c557600435906001600160401b0382116101c557611b1791600401611abd565b90916024356001600160a01b03811681036101c55790565b60606003198201126101c557600435916024356001600160a01b03811681036101c55791604435906001600160401b0382116101c557611b7191600401611a90565b9091565b9060406003198301126101c55760043591602435906001600160401b0382116101c557611b7191600401611a90565b346101c55760003660031901126101c55760206040516301e133808152f35b3360009081527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49602090815260408083205490929060019060ff1615611c095750505050565b611c1233612312565b82855192611c1f846121d7565b60428452858401946060368737845115611da357603086538451821015611da35790607860218601536041915b818311611d3557505050611cf357611ca1938593611cd993611cca604894611cef9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161214f565b8401917001034b99036b4b9b9b4b733903937b6329607d1b60378401525180938684019061214f565b010360288101855201836121f2565b5162461bcd60e51b815291829160048301612213565b0390fd5b60648486519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015611d8f576f181899199a1a9b1b9c1cb0b131b232b360811b901a611d6585886122eb565b5360041c928015611d7b57600019019190611c4c565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b3360009081527f31c1e66639f421f1853aeefe8ad6b62a3b96f3287efe23106923cd924aa025c260209081526040808320549092906001907f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9299060ff1615611e20575050505050565b611e2933612312565b90855192611e36846121d7565b60428452858401946060368737845115611da357603086538451821015611da35790607860218601536041915b818311611eb857505050611cf357611ca1938593611cd993611cca604894611cef9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161214f565b909192600f81166010811015611d8f576f181899199a1a9b1b9c1cb0b131b232b360811b901a611ee885886122eb565b5360041c928015611d7b57600019019190611e63565b3360009081527fb9cbbae02fe941283ec0eefd7b121e3bc7f89fae077b27bdd75a7fd4cf1543a860209081526040808320549092906001907f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a9060ff1615611f67575050505050565b611f7033612312565b90855192611f7d846121d7565b60428452858401946060368737845115611da357603086538451821015611da35790607860218601536041915b818311611fff57505050611cf357611ca1938593611cd993611cca604894611cef9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161214f565b909192600f81166010811015611d8f576f181899199a1a9b1b9c1cb0b131b232b360811b901a61202f85886122eb565b5360041c928015611d7b57600019019190611faa565b6000818152600190602091808352604093848320338452845260ff858420541615612071575050505050565b61207a33612312565b90855192612087846121d7565b60428452858401946060368737845115611da357603086538451821015611da35790607860218601536041915b81831161210957505050611cf357611ca1938593611cd993611cca604894611cef9951988576020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8b97880152825192839160378901910161214f565b909192600f81166010811015611d8f576f181899199a1a9b1b9c1cb0b131b232b360811b901a61213985886122eb565b5360041c928015611d7b576000190191906120b4565b60005b8381106121625750506000910152565b8181015183820152602001612152565b60a081019081106001600160401b03821117610e4d57604052565b6001600160401b038111610e4d57604052565b61014081019081106001600160401b03821117610e4d57604052565b604081019081106001600160401b03821117610e4d57604052565b608081019081106001600160401b03821117610e4d57604052565b90601f801991011681019081106001600160401b03821117610e4d57604052565b60409160208252612233815180928160208601526020868601910161214f565b601f01601f1916010190565b906000918083526001602052604083209160018060a01b03169182845260205260ff60408420541661227057505050565b8083526001602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b818102929181159184041417156122c857565b634e487b7160e01b600052601160045260246000fd5b919082018092116122c857565b9081518110156122fc570160200190565b634e487b7160e01b600052603260045260246000fd5b60405190606082018281106001600160401b03821117610e4d57604052602a82526020820160403682378251156122fc576030905381516001908110156122fc57607860218401536029905b8082116123b257505061236e5790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f8116601081101561240b576f181899199a1a9b1b9c1cb0b131b232b360811b901a6123e184866122eb565b5360041c9180156123f657600019019061235e565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b60ff6000541661242c57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b6004548110156122fc57600a906004600052027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0190600090565b906040516124ac816121a0565b6101206009829460ff8154161515845260018101546020850152600281015460408501526003810154606085015260048101546080850152600581015460a0850152600681015460c085015260ff600782015416151560e085015260088101546101008501520154910152565b919082039182116122c857565b60001981146122c85760010190565b91908110156122fc5760051b0190565b60028054146125545760028055565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405163a9059cbb60e01b60208083019182526001600160a01b03949094166024830152604480830195909552938152601f199493916125da6064836121f2565b60018060a01b031694604051916125f0836121bc565b8483527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564858401526000809481925190828a5af13d15612713573d966001600160401b0388116126ff57859697612655612662969760405195601f84011601856121f2565b83523d868885013e612720565b8051918215918483156126d4575b50505090501561267d5750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152fd5b9193818094500103126126fb578201519081151582036126f8575080388084612670565b80fd5b5080fd5b634e487b7160e01b85526041600452602485fd5b6126629394959691506060915b919290156127825750815115612734575090565b3b1561273d5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156127955750805190602001fd5b60405162461bcd60e51b8152908190611cef9060048301612213565b93916127e49391856000526005602052604060002060018060a01b03821660005260205260016040600020015495612800565b90818110156127f9576127f691612519565b90565b5050600090565b9290916004548410156128b357600261281885612464565b50015485106128b35761282b92846128bd565b92901580156128ab575b6128a35761286f612875916002612860612869600361285388612464565b5001548361286089612464565b50015490612519565b95612464565b836122b5565b811561288d570490808211612888575090565b905090565b634e487b7160e01b600052601260045260246000fd5b505050600090565b508215612835565b5050505050600090565b929390919384019160409283868203126101c5578535602092838801356001600160401b03988982116101c557019280601f850112156101c5578335988911610e4d5760059389851b9088519a6129168884018d6121f2565b8b5286808c01928201019283116101c55786809101915b8383106129f057505087516001600160a01b03909316868401908152602081018590526006936129919350909150612971816040840103601f1981018352826121f2565b5190208751868101918252868152612988816121bc565b51902097612464565b50015495936000945b88518610156129e25785841b890185015190876000838310156129d257505060005284526129cc866000205b95612526565b9461299a565b90916129cc9382528752206129c6565b945095945095505050149190565b823581529181019187910161292d56fea2646970667358221220f27c8ed2027faa953e4d8a775af05aa294bf17625c6bf2ef8832dc15432f0d0064736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006b0faca7ba905a86f221ceb5ca404f605e5b3131
-----Decoded View---------------
Arg [0] : token_ (address): 0x6B0FaCA7bA905a86F221CEb5CA404f605e5b3131
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000006b0faca7ba905a86f221ceb5ca404f605e5b3131
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.