Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 19610012 | 181 days ago | IN | 0 ETH | 0.07412576 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
VestingCustomRefundProject
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: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {UnitConverter} from "./libraries/UnitConverter.sol"; import {AccessControl} from "./AdminPrivileges.sol"; import {VestingCustomRefund} from "./VestingCustomRefund.sol"; import {IFactoryImplementation} from "./interfaces/IFactoryImplementation.sol"; import {IVestingCustomRefund} from "./interfaces/IVestingCustomRefund.sol"; import {IVestingCustomRefundProject} from "./interfaces/IVestingCustomRefundProject.sol"; /** * @title VestingCustomRefundProject * @author Tim Loh * @notice Provides an implementation of custom vesting with refund for project interface */ contract VestingCustomRefundProject is VestingCustomRefund, IVestingCustomRefundProject { using SafeERC20 for IERC20; using UnitConverter for uint256; bytes32 public constant CONTRACT_USAGE_ROLE = keccak256("CONTRACT_USAGE_ROLE"); bytes4 public constant INTERFACE_ID = type(IVestingCustomRefund).interfaceId; address public projectWallet; /** * @param tokenAddress_ The address of vesting token * @param tokenDecimals_ The number of decimals for vesting token * @param allowAccumulate_ `true` if multiple grant amounts is allowed to accumulate for the same user, * `false` if a user can only have one grant * @param backofficeAdminAddress The address that will be assigned the backoffice role admin role and backoffice * contract admin role * @param tenantAdminAddress The address that will be assigned the tenant role admin role, tenant governance role * and tenant contract admin role */ function initialize( address tokenAddress_, uint256 tokenDecimals_, bool allowAccumulate_, address backofficeAdminAddress, address tenantAdminAddress ) public virtual override initializer { __VestingCustomRefundProject_init( tokenAddress_, tokenDecimals_, allowAccumulate_, backofficeAdminAddress, tenantAdminAddress ); } // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function __VestingCustomRefundProject_init( // solhint-disable-previous-line func-name-mixedcase address tokenAddress_, uint256 tokenDecimals_, bool allowAccumulate_, address backofficeAdminAddress, address tenantAdminAddress ) internal onlyInitializing { __VestingCustomRefund_init_unchained( tokenAddress_, tokenDecimals_, allowAccumulate_, backofficeAdminAddress, tenantAdminAddress ); __VestingCustomRefundProject_init_unchained(); } // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function __VestingCustomRefundProject_init_unchained() internal onlyInitializing { // solhint-disable-previous-line func-name-mixedcase _setRoleAdmin(CONTRACT_USAGE_ROLE, BACKOFFICE_ROLE_ADMIN_ROLE); } /** * @inheritdoc IVestingCustomRefund */ function addVestingGrant( // solhint-disable-previous-line ordering address account, uint256 grantAmount, bool isRevocable ) external virtual override(VestingCustomRefund, IVestingCustomRefund) onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { require(account != address(0), "VCRP: zero account"); require(projectWallet == address(0) || (account == projectWallet && allowAccumulate), "VCRP: project wallet"); projectWallet = account; _addVestingGrant(account, grantAmount, isRevocable); } /** * @inheritdoc IVestingCustomRefund */ function addVestingGrantsBatch( address[] memory, uint256[] memory, bool[] memory ) external virtual override(VestingCustomRefund, IVestingCustomRefund) onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { require(false, "VCRP: n/a"); } /** * @inheritdoc IVestingCustomRefundProject */ function cancelRefundWindow() external virtual override onlyRole(CONTRACT_USAGE_ROLE) returns (bool isCancelled) { _cancelRefundWindow(); isCancelled = true; } /** * @inheritdoc IVestingCustomRefundProject */ function extendRefundWindow( uint256 newDurationSeconds ) external virtual override onlyRole(CONTRACT_USAGE_ROLE) returns (bool isExtended) { require(newDurationSeconds > 0, "VCRP: duration"); require(isVestingScheduleDefined(), "VCRP: undefined schedule"); (uint256 oldStartTimestamp, , ) = getRefundWindow(); uint256 newEndTimestamp = oldStartTimestamp + newDurationSeconds; require(!hasVestingScheduleStarted(newEndTimestamp), "VCRP: schedule started"); _extendRefundWindow(newDurationSeconds); isExtended = true; } /** * @inheritdoc IVestingCustomRefundProject */ function refund( address account, uint256 amount ) external virtual override whenNotPaused onlyRole(CONTRACT_USAGE_ROLE) returns (bool isRefunded) { require(account != address(0), "VCRP: zero account"); require(amount > 0, "VCRP: zero refund amount"); uint256 maxRefundableAmount = _refundableAmountFor(projectWallet); uint256 transferDecimalsAmount = amount.scaleWeiToDecimals(tokenDecimals); uint256 transferWeiAmount = transferDecimalsAmount.scaleDecimalsToWei(tokenDecimals); require(transferWeiAmount > 0, "VCRP: zero amount"); require(transferWeiAmount <= maxRefundableAmount, "VCRP: exceed"); _refund(projectWallet, transferWeiAmount); emit TokensRefunded(account, transferWeiAmount); IERC20(tokenAddress).safeTransfer(account, transferDecimalsAmount); isRefunded = true; } /** * @inheritdoc IVestingCustomRefund */ function revokeVestingGrant( address account ) external virtual override(VestingCustomRefund, IVestingCustomRefund) onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { require(account != address(0), "VCRP: zero account"); require(account == projectWallet, "VCRP: project wallet"); projectWallet = address(0); _revokeVestingGrant(account); } /** * @inheritdoc IVestingCustomRefund */ function revokeVestingGrantsBatch( address[] memory ) external virtual override(VestingCustomRefund, IVestingCustomRefund) onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { require(false, "VCRP: n/a"); } /** * @inheritdoc IVestingCustomRefundProject */ function setRefundWindow( uint256 startTimestamp, uint256 durationSeconds ) external virtual override onlyRole(CONTRACT_USAGE_ROLE) returns (bool isSet) { require(startTimestamp > block.timestamp, "VCRP: start timestamp"); require(durationSeconds > 0, "VCRP: duration"); require(isVestingScheduleDefined(), "VCRP: undefined schedule"); uint256 endTimestamp = startTimestamp + durationSeconds - 1; require(!hasVestingScheduleStarted(endTimestamp), "VCRP: schedule started"); _setRefundWindow(startTimestamp, durationSeconds); isSet = true; } /** * @inheritdoc IFactoryImplementation */ function factoryImplementationType() external view virtual override(VestingCustomRefund, IFactoryImplementation) returns (uint256 implementationType) { implementationType = 0x7866924b44039f57cc7e434c06f38cc0a54edaa38ef5e1e10233e9acd30773cc; } /** * @inheritdoc IVestingCustomRefundProject */ function refundableAmountFor(address account) external view virtual override returns (uint256 refundableAmount) { refundableAmount = _refundableAmountFor(account); } /** * @inheritdoc IVestingCustomRefund */ function releasableAmountFor( address account ) public view virtual override(VestingCustomRefund, IVestingCustomRefund) returns (uint256 releasableAmount) { require(account != address(0), "VCRP: zero account"); require(hasVestingScheduleStarted(block.timestamp), "VCRP: not started"); require(!revoked(account), "VCRP: revoked"); uint256 vestedAmount = vestedAmountFor(account); uint256 releasedAmount = releasedAmountFor(account); releasableAmount = vestedAmount - releasedAmount; } /** * @inheritdoc IERC165 */ function supportsInterface( bytes4 interfaceId ) public view virtual override(AccessControl, IVestingCustomRefundProject) returns (bool) { return interfaceId == type(IVestingCustomRefundProject).interfaceId || super.supportsInterface(interfaceId); } /** * @notice Get token amount that is refundable for `account` * @param account The address to check * @return refundableAmount The token amount in wei that is refundedable for `account` */ function _refundableAmountFor(address account) internal view virtual override returns (uint256 refundableAmount) { require(account != address(0), "VCRP: zero account"); require(isVestingScheduleDefined(), "VCRP: undefined schedule"); require(!revoked(account), "VCRP: revoked"); (uint256 grantAmount, , , bool isActive) = vestingGrantFor(account); require(isActive, "VCRP: inactive"); if (hasVestingScheduleStarted(block.timestamp)) { return 0; } refundableAmount = grantAmount - releasedAmountFor(account) - refundedAmountFor(account); } }
// 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.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// 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) (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 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: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol"; import {IAdminPrivileges} from "./interfaces/IAdminPrivileges.sol"; /** * @title AdminPrivileges * @author Tim Loh * @notice Provides admin privileges role definitions that are inherited by other contracts */ contract AdminPrivileges is AccessControl, IAdminPrivileges { bytes32 public constant BACKOFFICE_ROLE_ADMIN_ROLE = keccak256("BACKOFFICE_ROLE_ADMIN_ROLE"); bytes32 public constant BACKOFFICE_GOVERNANCE_ROLE = keccak256("BACKOFFICE_GOVERNANCE_ROLE"); bytes32 public constant BACKOFFICE_CONTRACT_ADMIN_ROLE = keccak256("BACKOFFICE_CONTRACT_ADMIN_ROLE"); bytes32 public constant TENANT_ROLE_ADMIN_ROLE = keccak256("TENANT_ROLE_ADMIN_ROLE"); bytes32 public constant TENANT_GOVERNANCE_ROLE = keccak256("TENANT_GOVERNANCE_ROLE"); bytes32 public constant TENANT_CONTRACT_ADMIN_ROLE = keccak256("TENANT_CONTRACT_ADMIN_ROLE"); }
// SPDX-License-Identifier: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; import {IAdminWallet} from "./interfaces/IAdminWallet.sol"; /** * @title AdminWallet * @author Tim Loh * @notice Provides an implementation of the admin wallet interface that is inherited by other contracts */ contract AdminWallet is IAdminWallet { address private _adminWallet; /** * @inheritdoc IAdminWallet */ function adminWallet() public view virtual override returns (address) { return _adminWallet; } /** * @dev Change admin wallet that will receive the funds to a new wallet address * @param newWallet The new admin wallet address */ function _setAdminWallet(address newWallet) internal virtual { require(newWallet != address(0), "AdminWallet: new wallet"); address oldWallet = _adminWallet; _adminWallet = newWallet; emit AdminWalletChanged(oldWallet, newWallet, msg.sender); } }
// SPDX-License-Identifier: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; /** * @title AdminPrivileges Interface * @author Tim Loh * @notice Interface for admin privileges role definitions that are inherited by other contracts */ interface IAdminPrivileges { // solhint-disable func-name-mixedcase // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function BACKOFFICE_ROLE_ADMIN_ROLE() external view returns (bytes32); // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function BACKOFFICE_GOVERNANCE_ROLE() external view returns (bytes32); // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function BACKOFFICE_CONTRACT_ADMIN_ROLE() external view returns (bytes32); // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function TENANT_ROLE_ADMIN_ROLE() external view returns (bytes32); // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function TENANT_GOVERNANCE_ROLE() external view returns (bytes32); // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function TENANT_CONTRACT_ADMIN_ROLE() external view returns (bytes32); // solhint-enable func-name-mixedcase }
// SPDX-License-Identifier: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; /** * @title AdminWallet Interface * @author Tim Loh * @notice Interface for admin wallet that will receive the funds */ interface IAdminWallet { /** * @notice Emitted when admin wallet has been changed from `oldWallet` to `newWallet` * @param oldWallet The wallet before the wallet was changed * @param newWallet The wallet after the wallet was changed * @param sender The address that changes the admin wallet */ event AdminWalletChanged(address indexed oldWallet, address indexed newWallet, address indexed sender); /** * @notice Returns the admin wallet address that will receive the funds * @return Admin wallet address */ function adminWallet() external view returns (address); }
// SPDX-License-Identifier: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; /** * @title IFactoryImplementation * @author Tim Loh * @notice Provides factory implementation type that is inherited by reference implementation contracts for matching * with corresponding factory contracts */ interface IFactoryImplementation { function factoryImplementationType() external view returns (uint256); }
// SPDX-License-Identifier: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {IAdminPrivileges} from "./IAdminPrivileges.sol"; import {IAdminWallet} from "./IAdminWallet.sol"; import {IFactoryImplementation} from "./IFactoryImplementation.sol"; /** * @title IVestingCustomRefund * @author Tim Loh * @notice Interface for custom vesting with refund */ interface IVestingCustomRefund is IAccessControl, IAdminPrivileges, IAdminWallet, IFactoryImplementation { /** * @notice Emitted when refund window has been cancelled * @param sender The address that cancelled the refund * @param refundStartTimestamp Timestamp when cancelled refund window will start * @param refundDurationSeconds Duration of cancelled refund window in seconds * @param refundEndTimestamp Timestamp when cancelled refund window will end */ event RefundWindowCancelled( address indexed sender, uint256 refundStartTimestamp, uint256 refundDurationSeconds, uint256 refundEndTimestamp ); /** * @notice Emitted when refund window has been extended * @param sender The address that extended the refund window * @param newDurationSeconds Refund window duration in seconds after extension * @param newEndTimestamp Timestamp when refund window will end after extension * @param oldDurationSeconds Refund window duration in seconds before extension * @param oldEndTimestamp Timestamp when refund window will end before extension */ event RefundWindowExtended( address indexed sender, uint256 newDurationSeconds, uint256 newEndTimestamp, uint256 oldDurationSeconds, uint256 oldEndTimestamp ); /** * @notice Emitted when refund window has been set * @param sender The address that set the refund window * @param startTimestamp Timestamp when refund window will start * @param durationSeconds Refund window duration in seconds * @param endTimestamp Timestamp when refund window will end */ event RefundWindowSet( address indexed sender, uint256 startTimestamp, uint256 durationSeconds, uint256 endTimestamp ); /** * @notice Emitted when vesting schedule has been set * @param sender The address that set the vesting schedule * @param startTimestamps Array specifying the start timestamps of each period * @param percentReleases Array specifying the percentage of grant amount to be released for each period * @param durationsDays Array specifying the duration in days of each period */ event ScheduleSet( address indexed sender, uint256[] startTimestamps, uint256[] percentReleases, uint256[] durationsDays ); /** * @notice Emitted when vested tokens have been released to `account` * @param account The address that received the released tokens * @param amount The amount of tokens in wei transferred to `account` */ event TokensReleased(address indexed account, uint256 amount); /** * @notice Emitted when unused tokens have been transferred to the admin wallet * @param sender The address that initiated the transfer of unused tokens * @param unusedAmount The amount of tokens in wei transferred to the admin wallet * @param balanceInWei The amount of tokens in wei held by the custom vesting contract before transfer * @param totalReleasedAmount The total amount of tokens in wei that has been released so far * @param totalRevokedAmount The total amount of tokens in wei that has been revoked so far * @param totalRefundAmount The total amount of tokens in wei that has been refunded so far * @param totalGrantAmount The total vesting grant token amount in wei that has been added so far */ event UnusedTokensTransferred( address indexed sender, uint256 unusedAmount, uint256 balanceInWei, uint256 totalReleasedAmount, uint256 totalRevokedAmount, uint256 totalRefundAmount, uint256 totalGrantAmount ); /** * @notice Emitted when vesting grant has been added * @param account The address that has the vesting grant added * @param grantAmount The grant token amount in wei * @param isRevocable `true` if vesting grant is revocable * `false` if vesting grant is not revocable */ event VestingGrantAdded(address indexed account, uint256 grantAmount, bool isRevocable); /** * @notice Emitted when vesting grant has been revoked * @param account The address that has the vesting grant revoked * @param remainderAmount The amount of tokens in wei that has been revoked for `account` * @param grantAmount The grant token amount in wei * @param refundedAmount The amount of tokens in wei that has been refunded to `account` * @param releasedAmount The amount of tokens in wei that has been released to `account` */ event VestingGrantRevoked( address indexed account, uint256 remainderAmount, uint256 grantAmount, uint256 refundedAmount, uint256 releasedAmount ); /** * @notice Add vesting grant for `account` * @dev Must be called by tenant contract admin role * @dev grant can only be added before schedule start * @dev grant cannot be added if previous grant has been revoked * @dev isRevocable will be ignored if grant already added but amount allowed to accumulate * @param account The address that will have the vesting grant added * @param grantAmount The token amount in wei to be granted * @param isRevocable `true` if vesting grant is revocable * `false` if vesting grant is not revocable */ function addVestingGrant(address account, uint256 grantAmount, bool isRevocable) external; /** * @notice Batch add vesting grants for specified `accounts` * @dev Must be called by tenant contract admin role * @param accounts Array specifying the addresses that will have the vesting grants added * @param grantAmounts Array specifying the amount of tokens in wei to be granted for each account * @param isRevocables Array soecuftubg whether each grant is revocable */ function addVestingGrantsBatch( address[] memory accounts, uint256[] memory grantAmounts, bool[] memory isRevocables ) external; /** * @notice Pause user functions * @dev Must be called by tenant contract admin role */ function pauseContract() external; /** * @notice Release vested tokens to sender * @dev Can only release if vesting schedule is defined * @dev Can only release when vesting schedule has started * @dev Cannot release if grant has been revoked */ function release() external; /** * @notice Revoke vesting grant for `account` * @dev Must be called by tenant contract admin role * @dev Only revocable grants can be revoked * @param account The address that will have the vesting grant revoked */ function revokeVestingGrant(address account) external; /** * @notice Batch revoke vesting grants for specified `accounts` * @dev Must be called by tenant contract admin role * @dev Only revocable grants can be revoked * @param accounts Array specifying the addresses that will have the vesting grants revoked */ function revokeVestingGrantsBatch(address[] memory accounts) external; /** * @notice Change admin wallet that will receive funds to a new wallet address * @dev Must be called by tenant governance role * @param newWallet The new admin wallet */ function setAdminWallet(address newWallet) external; /** * @notice Set vesting schedule * @dev Must be called by tenant contract admin role * @param startTimestamps Array specifying the start timestamps of each period * @param percentReleases Array specifying the percentage of grant amount to be released for each period * @param durationsDays Array specifying the duration in days of each period */ function setVestingSchedule( uint256[] calldata startTimestamps, uint256[] calldata percentReleases, uint256[] calldata durationsDays ) external; /** * @notice Transfer unused tokens to the admin wallet * @dev Must be called by tenant contract admin role */ function transferUnusedTokens() external; /** * @notice Unpause user functions * @dev Must be called by tenant contract admin role */ function unpauseContract() external; /** * @notice Get whether multiple grant amounts is allowed to accumulate for the same user * @return Returns `true` if multiple grant amounts is allowed to accumulate for the same user, * `false` if a user can only have one grant */ function allowAccumulate() external view returns (bool); /** * @notice Get maximum number of grants allowed per batch * @return Returns maximum number of grants allowed per batch */ // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function BATCH_MAX_NUM() external view returns (uint256); // solhint-disable-line func-name-mixedcase /** * @notice Get maximum number of schedule entries allowed * @return Returns maximum number of schedule entries allowed */ // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function SCHEDULE_MAX_ENTRIES() external view returns (uint256); // solhint-disable-line func-name-mixedcase /** * @notice Get effective grant amount for `account` * @param account The address to check * @return grantAmountWei The effective grant amount in wei for `account` */ function effectiveGrantAmountFor(address account) external view returns (uint256 grantAmountWei); /** * @notice Get refund window * @return startTimestamp The start timestamp of refund window * @return durationSeconds The duration of refund window in seconds * @return endTimestamp The end timestamp of refund window */ function getRefundWindow() external view returns (uint256 startTimestamp, uint256 durationSeconds, uint256 endTimestamp); /** * @notice Get vesting schedule * @param startTimestamps Array specifying the start timestamps of each period * @param percentReleases Array specifying the percentage of grant amount to be released for each period * @param durationsDays Array specifying the duration in days of each period * @param endTimestamps Array specifying the end timestamps of each period */ function getVestingSchedule() external view returns ( uint256[] memory startTimestamps, uint256[] memory percentReleases, uint256[] memory durationsDays, uint256[] memory endTimestamps ); /** * @notice Check whether `account` has been refunded * @param account The address to check * @return hasRefunded `true` if `account` has been refunded */ function hasRefundedFor(address account) external view returns (bool hasRefunded); /** * @notice Check whether `account` has claimed before * @param account The address to check * @return hasReleased `true` if `account` has claimed before */ function hasReleasedFor(address account) external view returns (bool hasReleased); /** * @notice Check whether refund window already started at `atTimestamp` * @param atTimestamp The timestamp to check * @return hasStarted `true` if refund window already started at `atTimestamp` */ function hasRefundWindowStarted(uint256 atTimestamp) external view returns (bool hasStarted); /** * @notice Check whether vesting schedule already started at `atTimestamp` * @param atTimestamp The timestamp to check * @return hasStarted `true` if vesting schedule already started at `atTimestamp` */ function hasVestingScheduleStarted(uint256 atTimestamp) external view returns (bool hasStarted); /** * @notice Check whether refund window has been defined * @return isDefined `true` if refund window has been defined */ function isRefundWindowDefined() external view returns (bool isDefined); /** * @notice Check whether refund window is open now * @return isOpen `true` if refund window is open now */ function isRefundWindowOpenNow() external view returns (bool isOpen); /** * @notice Check whether vesting schedule has been defined * @return isDefined `true` if vesting schedule has been defined */ function isVestingScheduleDefined() external view returns (bool isDefined); /** * @notice Get current number of schedule entries * @return Returns current number of schedule entries */ function numVestingScheduleEntries() external view returns (uint256); /** * @notice Get refunded token amount for `account` * @param account The address to check * @return refundedAmount The token amount in wei that has been refunded to `account` */ function refundedAmountFor(address account) external view returns (uint256 refundedAmount); /** * @notice Get releasable token amount for `account` * @param account The address to check * @return releasableAmount The token amount in wei that is releasable for `account` */ function releasableAmountFor(address account) external view returns (uint256 releasableAmount); /** * @notice Get released token amount for `account` * @param account The address to check * @return releasedAmount The token amount in wei that has been released to `account` */ function releasedAmountFor(address account) external view returns (uint256 releasedAmount); /** * @notice Check whether vesting grant for `account` has been revoked * @param account The address to check * @return isRevoked `true` if vesting grant for `account` has been revoked */ function revoked(address account) external view returns (bool isRevoked); /** * @notice Get address of vesting token * @return Returns the address of vesting token */ function tokenAddress() external view returns (address); /** * @notice Get the number of decimals for vesting token * @return Returns the number of decimals for vesting token */ function tokenDecimals() external view returns (uint256); /** * @notice Get the total token amount of vesting grants * @return Returns the total token amount in wei of vesting grants */ function totalGrantAmount() external view returns (uint256); /** * @notice Get the total token amount that has been refunded * @return Returns the total token amount in wei that has been refunded */ function totalRefundAmount() external view returns (uint256); /** * @notice Get the total token amount that has been released * @return Returns the total token amount in wei that has been released */ function totalReleasedAmount() external view returns (uint256); /** * @notice Get the total token amount that has been revoked * @return Returns the total token amount in wei that has been revoked */ function totalRevokedAmount() external view returns (uint256); /** * @notice Get unvested token amount for `account` * @param account The address to check * @return unvestedAmount The token amount in wei that has not vested yet for `account` */ function unvestedAmountFor(address account) external view returns (uint256 unvestedAmount); /** * @notice Get vested token amount for `account` * @param account The address to check * @return vestedAmount The token amount in wei that has vested for `account` */ function vestedAmountFor(address account) external view returns (uint256 vestedAmount); /** * @notice Get vesting grant for`account` * @param account The address to check * @return grantAmount The vesting grant token amount in wei for `account` * @return isRevocable `true` if vesting grant for `account` can be revoked * @return isRevoked `true` if vesting grant for `account` has been revoked * @return isActive `true` if vesting grant for `account` is active */ function vestingGrantFor( address account ) external view returns (uint256 grantAmount, bool isRevocable, bool isRevoked, bool isActive); }
// SPDX-License-Identifier: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; import {IVestingCustomRefund} from "./IVestingCustomRefund.sol"; /** * @title IVestingCustomRefundProject * @author Tim Loh * @notice Interface for custom vesting with refund for project */ interface IVestingCustomRefundProject is IVestingCustomRefund { /** * @notice Emitted when tokens have been refunded to `account` * @param account The address that received the refund * @param refundAmount The amount to be refunded to `account` */ event TokensRefunded(address indexed account, uint256 refundAmount); /** * @notice Cancel refund window * @dev Must be called by contract usage role * @dev Can only cancel when refund window has not started yet */ function cancelRefundWindow() external returns (bool isCancelled); /** * @notice Extend refund window * @dev Must be called by contract usage role * @dev Can only extend when refund window is open * @param newDurationSeconds New refund window duration in seconds */ function extendRefundWindow(uint256 newDurationSeconds) external returns (bool isExtended); /** * @notice Refund specified amount of tokens to `account` * @dev Can only refund if vesting schedule is defined * @dev Can only refund when refund window is open * @dev Cannot refund if grant has been revoked * @param account The address to receive the refunded amount of tokens * @param amount The token amount in wei to be refunded to `account` */ function refund(address account, uint256 amount) external returns (bool isRefunded); /** * @notice Set refund window * @dev Must be called by contract usage role * @dev Can only have one refund * @param startTimestamp Timestamp when refund window will start * @param durationSeconds Refund window duration in seconds */ function setRefundWindow(uint256 startTimestamp, uint256 durationSeconds) external returns (bool isSet); /** * @notice Get contract usage role definition * @return Returns contract usage role definition */ // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function CONTRACT_USAGE_ROLE() external view returns (bytes32); // solhint-disable-line func-name-mixedcase /** * @notice Get interface ID for IVestingCustomRefundProject interface * @return Returns interface ID for IVestingCustomRefundProject interface */ // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function INTERFACE_ID() external view returns (bytes4); // solhint-disable-line func-name-mixedcase /** * @notice Get token amount that is refundable for `account` * @param account The address to check * @return refundableAmount The token amount in wei that is refundedable for `account` */ function refundableAmountFor(address account) external view returns (uint256 refundableAmount); /** * @notice Checks whether this contract implements the interface defined by `interfaceId` * @dev ERC165 * @return `true` if this contract implements the interface defined by `interfaceId` */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; /** * @title UnitConverter * @author Tim Loh * @notice Converts given amount between Wei and number of decimal places */ library UnitConverter { uint256 public constant TOKEN_MAX_DECIMALS = 18; /** * @notice Scale down given amount in Wei to given number of decimal places * @param weiAmount Amount in Wei * @param decimals Number of decimal places * @return decimalsAmount Amount in Wei scaled down to given number of decimal places */ // https://github.com/crytic/slither/wiki/Detector-Documentation#dead-code // slither-disable-next-line dead-code function scaleWeiToDecimals(uint256 weiAmount, uint256 decimals) internal pure returns (uint256 decimalsAmount) { require(decimals <= TOKEN_MAX_DECIMALS, "UnitConverter: decimals"); if (decimals < TOKEN_MAX_DECIMALS && weiAmount > 0) { uint256 decimalsDiff = TOKEN_MAX_DECIMALS - decimals; decimalsAmount = weiAmount / 10 ** decimalsDiff; } else { decimalsAmount = weiAmount; } } /** * @notice Scale up given amount in given number of decimal places to Wei * @param decimalsAmount Amount in number of decimal places * @param decimals Number of decimal places * @return weiAmount Amount in given number of decimal places scaled up to Wei */ // https://github.com/crytic/slither/wiki/Detector-Documentation#dead-code // slither-disable-next-line dead-code function scaleDecimalsToWei(uint256 decimalsAmount, uint256 decimals) internal pure returns (uint256 weiAmount) { require(decimals <= TOKEN_MAX_DECIMALS, "UnitConverter: decimals"); if (decimals < TOKEN_MAX_DECIMALS && decimalsAmount > 0) { uint256 decimalsDiff = TOKEN_MAX_DECIMALS - decimals; weiAmount = decimalsAmount * 10 ** decimalsDiff; } else { weiAmount = decimalsAmount; } } }
// SPDX-License-Identifier: Apache-2.0 // Copyright 2023 Enjinstarter pragma solidity 0.8.19; import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol"; import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {UnitConverter} from "./libraries/UnitConverter.sol"; import {AdminPrivileges} from "./AdminPrivileges.sol"; import {AdminWallet} from "./AdminWallet.sol"; import {IFactoryImplementation} from "./interfaces/IFactoryImplementation.sol"; import {IVestingCustomRefund} from "./interfaces/IVestingCustomRefund.sol"; /** * @title VestingCustomRefund * @author Tim Loh * @notice Provides an implementation of custom vesting with refund interface */ contract VestingCustomRefund is Initializable, Pausable, AdminPrivileges, AdminWallet, IVestingCustomRefund { using SafeERC20 for IERC20; using UnitConverter for uint256; struct CustomVestingScheduleEntry { uint256 percentRelease; // Percentage of grant amount to be released for period uint256 startTimestamp; // Start timestamp of period uint256 durationDays; // Duration in days for period uint256 endTimestamp; // End timestamp of period } struct RefundWindow { uint256 startTimestamp; // Start timestamp of refund window uint256 durationSeconds; // Duration of refund window in seconds uint256 endTimestamp; // End timestamp of refund window } struct VestingGrant { uint256 grantAmount; // Total number of tokens granted in wei // `true` if vesting grant can be revoked (e.g. gift), // `false` if cannot be revoked (e.g. purchased) bool isRevocable; bool isRevoked; // `true` if vesting grant has been revoked bool isActive; // `true` if vesting grant is active } uint256 public constant BATCH_MAX_NUM = 100; uint256 public constant SCHEDULE_MAX_ENTRIES = 100; uint256 public constant PERCENT_100_WEI = 100 ether; uint256 public constant SECONDS_IN_DAY = 86400; uint256 public constant TOKEN_MAX_DECIMALS = 18; bool public allowAccumulate; uint256 public numVestingScheduleEntries; address public tokenAddress; uint256 public tokenDecimals; uint256 public totalGrantAmount; uint256 public totalRefundAmount; uint256 public totalReleasedAmount; uint256 public totalRevokedAmount; RefundWindow private _refundWindow; mapping(address => uint256) private _refunded; mapping(address => uint256) private _released; mapping(address => VestingGrant) private _vestingGrants; mapping(uint256 => CustomVestingScheduleEntry) private _vestingSchedule; constructor() { _disableInitializers(); } /** * @param tokenAddress_ The address of vesting token * @param tokenDecimals_ The number of decimals for vesting token * @param allowAccumulate_ `true` if multiple grant amounts is allowed to accumulate for the same user, * `false` if a user can only have one grant * @param backofficeAdminAddress The address that will be assigned the backoffice role admin role and backoffice * contract admin role * @param tenantAdminAddress The address that will be assigned the tenant role admin role, tenant governance role * and tenant contract admin role */ function initialize( address tokenAddress_, uint256 tokenDecimals_, bool allowAccumulate_, address backofficeAdminAddress, address tenantAdminAddress ) public virtual initializer { __VestingCustomRefund_init( tokenAddress_, tokenDecimals_, allowAccumulate_, backofficeAdminAddress, tenantAdminAddress ); } // https://github.com/crytic/slither/wiki/Detector-Documentation#dead-code // slither-disable-start dead-code // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function __VestingCustomRefund_init( // solhint-disable-previous-line func-name-mixedcase address tokenAddress_, uint256 tokenDecimals_, bool allowAccumulate_, address backofficeAdminAddress, address tenantAdminAddress ) internal onlyInitializing { __VestingCustomRefund_init_unchained( tokenAddress_, tokenDecimals_, allowAccumulate_, backofficeAdminAddress, tenantAdminAddress ); } // slither-disable-end dead-code // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions // slither-disable-next-line naming-convention function __VestingCustomRefund_init_unchained( // solhint-disable-previous-line func-name-mixedcase address tokenAddress_, uint256 tokenDecimals_, bool allowAccumulate_, address backofficeAdminAddress, address tenantAdminAddress ) internal onlyInitializing { require(tokenAddress_ != address(0), "VCR: token address"); require(tokenDecimals_ <= TOKEN_MAX_DECIMALS, "VCR: token decimals"); require(backofficeAdminAddress != address(0), "VCR: backoffice admin"); require(tenantAdminAddress != address(0), "VCR: tenant admin"); _setRoleAdmin(BACKOFFICE_ROLE_ADMIN_ROLE, BACKOFFICE_ROLE_ADMIN_ROLE); _setRoleAdmin(BACKOFFICE_CONTRACT_ADMIN_ROLE, BACKOFFICE_ROLE_ADMIN_ROLE); _setRoleAdmin(TENANT_ROLE_ADMIN_ROLE, TENANT_ROLE_ADMIN_ROLE); _setRoleAdmin(TENANT_GOVERNANCE_ROLE, TENANT_ROLE_ADMIN_ROLE); _setRoleAdmin(TENANT_CONTRACT_ADMIN_ROLE, TENANT_ROLE_ADMIN_ROLE); _grantRole(BACKOFFICE_ROLE_ADMIN_ROLE, backofficeAdminAddress); _grantRole(BACKOFFICE_CONTRACT_ADMIN_ROLE, backofficeAdminAddress); _grantRole(TENANT_ROLE_ADMIN_ROLE, tenantAdminAddress); _grantRole(TENANT_GOVERNANCE_ROLE, tenantAdminAddress); _grantRole(TENANT_CONTRACT_ADMIN_ROLE, tenantAdminAddress); _setAdminWallet(tenantAdminAddress); tokenAddress = tokenAddress_; tokenDecimals = tokenDecimals_; allowAccumulate = allowAccumulate_; } /** * @inheritdoc IVestingCustomRefund */ function addVestingGrant( // solhint-disable-previous-line ordering address account, uint256 grantAmount, bool isRevocable ) external virtual override onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { _addVestingGrant(account, grantAmount, isRevocable); } /** * @inheritdoc IVestingCustomRefund */ function addVestingGrantsBatch( address[] memory accounts, uint256[] memory grantAmounts, bool[] memory isRevocables ) external virtual override onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { require(accounts.length > 0, "VCR: empty"); require(accounts.length <= BATCH_MAX_NUM, "VCR: exceed max"); require(grantAmounts.length == accounts.length, "VCR: grant amounts length"); require(isRevocables.length == accounts.length, "VCR: is revocables length"); for (uint256 i = 0; i < accounts.length; i++) { _addVestingGrant(accounts[i], grantAmounts[i], isRevocables[i]); } } /** * @inheritdoc IVestingCustomRefund */ function pauseContract() external virtual override onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { _pause(); } /** * @inheritdoc IVestingCustomRefund */ function release() external virtual override whenNotPaused { uint256 releasableAmount = releasableAmountFor(msg.sender); _release(msg.sender, releasableAmount); } /** * @inheritdoc IVestingCustomRefund */ function revokeVestingGrant(address account) external virtual override onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { _revokeVestingGrant(account); } /** * @inheritdoc IVestingCustomRefund */ function revokeVestingGrantsBatch( address[] memory accounts ) external virtual override onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { require(accounts.length > 0, "VCR: empty"); require(accounts.length <= BATCH_MAX_NUM, "VCR: exceed max"); for (uint256 i = 0; i < accounts.length; i++) { _revokeVestingGrant(accounts[i]); } } /** * @inheritdoc IVestingCustomRefund */ function setAdminWallet(address newWallet) external virtual override onlyRole(TENANT_GOVERNANCE_ROLE) { _setAdminWallet(newWallet); } /** * @inheritdoc IVestingCustomRefund */ function setVestingSchedule( uint256[] calldata startTimestamps, uint256[] calldata percentReleases, uint256[] calldata durationsDays ) external virtual override onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { require(startTimestamps.length > 0, "VCR: empty"); require(startTimestamps.length <= SCHEDULE_MAX_ENTRIES, "VCR: exceed max"); require(percentReleases.length == startTimestamps.length, "VCR: percent length different"); require(durationsDays.length == startTimestamps.length, "VCR: duration length different"); require(!hasVestingScheduleStarted(block.timestamp), "VCR: already started"); uint256 minTimestamp = block.timestamp; uint256 totalPercentRelease = 0; for (uint256 i = 0; i < startTimestamps.length; i++) { require(percentReleases[i] > 0, "VCR: zero percent"); require(startTimestamps[i] >= minTimestamp, "VCR: invalid start timestamp"); totalPercentRelease = totalPercentRelease + percentReleases[i]; require(totalPercentRelease <= PERCENT_100_WEI, "VCR: exceed 100%"); if (durationsDays[i] > 0) { minTimestamp = startTimestamps[i] + durationsDays[i] * SECONDS_IN_DAY; } else { minTimestamp = startTimestamps[i]; } _vestingSchedule[i] = CustomVestingScheduleEntry({ percentRelease: percentReleases[i], startTimestamp: startTimestamps[i], durationDays: durationsDays[i], endTimestamp: minTimestamp }); } require(totalPercentRelease == PERCENT_100_WEI, "VCR: not 100%"); numVestingScheduleEntries = startTimestamps.length; emit ScheduleSet(msg.sender, startTimestamps, percentReleases, durationsDays); } /** * @inheritdoc IVestingCustomRefund */ function transferUnusedTokens() external virtual override onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { uint256 balanceInDecimals = IERC20(tokenAddress).balanceOf(address(this)); uint256 balanceInWei = balanceInDecimals.scaleDecimalsToWei(tokenDecimals); uint256 unusedAmount = balanceInWei + totalReleasedAmount + totalRevokedAmount + totalRefundAmount - totalGrantAmount; require(unusedAmount > 0, "VCR: nothing to transfer"); uint256 transferAmount = unusedAmount.scaleWeiToDecimals(tokenDecimals); emit UnusedTokensTransferred( msg.sender, unusedAmount, balanceInWei, totalReleasedAmount, totalRevokedAmount, totalRefundAmount, totalGrantAmount ); IERC20(tokenAddress).safeTransfer(adminWallet(), transferAmount); } /** * @inheritdoc IVestingCustomRefund */ function unpauseContract() external virtual override onlyRole(TENANT_CONTRACT_ADMIN_ROLE) { _unpause(); } /** * @inheritdoc IFactoryImplementation */ function factoryImplementationType() external view virtual override returns (uint256 implementationType) { implementationType = 0x447e1a635045d08b78677dfba2a78564b566f402520e983a9ae65e8115b13d5b; } /** * @inheritdoc IVestingCustomRefund */ function getVestingSchedule() external view virtual override returns ( uint256[] memory startTimestamps, uint256[] memory percentReleases, uint256[] memory durationsDays, uint256[] memory endTimestamps ) { startTimestamps = new uint256[](numVestingScheduleEntries); percentReleases = new uint256[](numVestingScheduleEntries); durationsDays = new uint256[](numVestingScheduleEntries); endTimestamps = new uint256[](numVestingScheduleEntries); if (numVestingScheduleEntries > 0) { for (uint256 i = 0; i < numVestingScheduleEntries; i++) { startTimestamps[i] = _vestingSchedule[i].startTimestamp; percentReleases[i] = _vestingSchedule[i].percentRelease; durationsDays[i] = _vestingSchedule[i].durationDays; endTimestamps[i] = _vestingSchedule[i].endTimestamp; } } } /** * @inheritdoc IVestingCustomRefund */ function unvestedAmountFor(address account) external view virtual override returns (uint256 unvestedAmount) { require(account != address(0), "VCR: zero account"); if (revoked(account)) { unvestedAmount = 0; return unvestedAmount; } uint256 grantAmountWei = effectiveGrantAmountFor(account); uint256 vestedAmountWei = vestedAmountFor(account); unvestedAmount = grantAmountWei - vestedAmountWei; } /** * @inheritdoc IVestingCustomRefund */ function effectiveGrantAmountFor(address account) public view virtual override returns (uint256 grantAmountWei) { require(account != address(0), "VCR: zero account"); VestingGrant memory vestingGrant = _vestingGrants[account]; require(vestingGrant.isActive, "VCR: inactive"); uint256 refundedAmount = refundedAmountFor(account); grantAmountWei = vestingGrant.grantAmount - refundedAmount; } /** * @inheritdoc IVestingCustomRefund */ function getRefundWindow() public view virtual override returns (uint256 startTimestamp, uint256 durationSeconds, uint256 endTimestamp) { startTimestamp = _refundWindow.startTimestamp; durationSeconds = _refundWindow.durationSeconds; endTimestamp = _refundWindow.endTimestamp; } /** * @inheritdoc IVestingCustomRefund */ function hasRefundedFor(address account) public view virtual override returns (bool hasRefunded) { require(account != address(0), "VCR: zero account"); require(_vestingGrants[account].isActive, "VCR: inactive"); hasRefunded = refundedAmountFor(account) > 0; } /** * @inheritdoc IVestingCustomRefund */ function hasReleasedFor(address account) public view virtual override returns (bool hasReleased) { require(account != address(0), "VCR: zero account"); require(_vestingGrants[account].isActive, "VCR: inactive"); hasReleased = releasedAmountFor(account) > 0; } /** * @inheritdoc IVestingCustomRefund */ function hasRefundWindowStarted(uint256 atTimestamp) public view virtual override returns (bool hasStarted) { require(atTimestamp > 0, "VCR: timestamp"); hasStarted = _refundWindow.startTimestamp > 0 && atTimestamp >= _refundWindow.startTimestamp; } /** * @inheritdoc IVestingCustomRefund */ function hasVestingScheduleStarted(uint256 atTimestamp) public view virtual override returns (bool hasStarted) { require(atTimestamp > 0, "VCR: timestamp"); hasStarted = numVestingScheduleEntries > 0 && atTimestamp >= _vestingSchedule[0].startTimestamp; } /** * @inheritdoc IVestingCustomRefund */ function isRefundWindowDefined() public view virtual override returns (bool isDefined) { isDefined = _refundWindow.startTimestamp > 0; } /** * @inheritdoc IVestingCustomRefund */ function isRefundWindowOpenNow() public view virtual override returns (bool isOpen) { isOpen = _refundWindow.startTimestamp > 0 && _refundWindow.endTimestamp > 0 && block.timestamp >= _refundWindow.startTimestamp && block.timestamp < _refundWindow.endTimestamp; } /** * @inheritdoc IVestingCustomRefund */ function isVestingScheduleDefined() public view virtual override returns (bool isDefined) { isDefined = numVestingScheduleEntries > 0; } /** * @inheritdoc IVestingCustomRefund */ function refundedAmountFor(address account) public view virtual override returns (uint256 refundedAmount) { require(account != address(0), "VCR: zero account"); refundedAmount = _refunded[account]; } /** * @inheritdoc IVestingCustomRefund */ function releasableAmountFor(address account) public view virtual override returns (uint256 releasableAmount) { require(account != address(0), "VCR: zero account"); require(hasVestingScheduleStarted(block.timestamp), "VCR: not started"); require(!revoked(account), "VCR: revoked"); releasableAmount = vestedAmountFor(account) - releasedAmountFor(account); } /** * @inheritdoc IVestingCustomRefund */ function releasedAmountFor(address account) public view virtual override returns (uint256 releasedAmount) { require(account != address(0), "VCR: zero account"); releasedAmount = _released[account]; } /** * @inheritdoc IVestingCustomRefund */ function revoked(address account) public view virtual override returns (bool isRevoked) { require(account != address(0), "VCR: zero account"); VestingGrant memory vestingGrant = _vestingGrants[account]; require(vestingGrant.isActive, "VCR: inactive"); isRevoked = vestingGrant.isRevoked; } /** * @inheritdoc IVestingCustomRefund */ function vestedAmountFor(address account) public view virtual override returns (uint256 vestedAmount) { require(account != address(0), "VCR: zero account"); if (numVestingScheduleEntries == 0 || _vestingSchedule[0].startTimestamp == 0) { return 0; } if (block.timestamp < _vestingSchedule[0].startTimestamp) { return 0; } if (revoked(account)) { return releasedAmountFor(account); } uint256 grantAmountWei = effectiveGrantAmountFor(account); if (block.timestamp >= _vestingSchedule[numVestingScheduleEntries - 1].endTimestamp) { return grantAmountWei; } uint256 totalPercentRelease = _getTotalPercentRelease(block.timestamp); // https://github.com/crytic/slither/wiki/Detector-Documentation#divide-before-multiply // slither-disable-next-line divide-before-multiply uint256 totalReleaseAmount = (grantAmountWei * totalPercentRelease) / PERCENT_100_WEI; vestedAmount = totalReleaseAmount.scaleWeiToDecimals(tokenDecimals).scaleDecimalsToWei(tokenDecimals); } /** * @inheritdoc IVestingCustomRefund */ function vestingGrantFor( address account ) public view virtual override returns (uint256 grantAmount, bool isRevocable, bool isRevoked, bool isActive) { require(account != address(0), "VCR: zero account"); VestingGrant memory vestingGrant = _vestingGrants[account]; grantAmount = vestingGrant.grantAmount; isRevocable = vestingGrant.isRevocable; isRevoked = vestingGrant.isRevoked; isActive = vestingGrant.isActive; } /** * @notice Add vesting grant for `account` * @dev grant can only be added before schedule start * @dev grant cannot be added if previous grant has been revoked * @dev isRevocable will be ignored if grant already added but amount allowed to accumulate * @param account The address that will have the vesting grant added * @param grantAmount The grant token amount in wei * @param isRevocable `true` if vesting grant is revocable * `false` if vesting grant is not revocable */ function _addVestingGrant(address account, uint256 grantAmount, bool isRevocable) internal virtual { require(account != address(0), "VCR: zero account"); require(grantAmount > 0, "VCR: zero grant amount"); require(!hasVestingScheduleStarted(block.timestamp), "VCR: already started"); VestingGrant memory vestingGrant = _vestingGrants[account]; require(allowAccumulate || !vestingGrant.isActive, "VCR: already added"); require(!vestingGrant.isActive || !revoked(account), "VCR: already revoked"); uint256 truncatedGrantAmount = grantAmount.scaleWeiToDecimals(tokenDecimals).scaleDecimalsToWei(tokenDecimals); require(truncatedGrantAmount > 0, "VCR: zero decimals grant amount"); // https://github.com/crytic/slither/wiki/Detector-Documentation#costly-operations-inside-a-loop // slither-disable-next-line costly-loop totalGrantAmount += truncatedGrantAmount; // https://github.com/crytic/slither/wiki/Detector-Documentation/#calls-inside-a-loop // slither-disable-next-line calls-loop uint256 balanceInDecimals = IERC20(tokenAddress).balanceOf(address(this)); require(balanceInDecimals > 0, "VCR: zero balance"); uint256 balanceInWei = balanceInDecimals.scaleDecimalsToWei(tokenDecimals); uint256 remainderAmount = balanceInWei + totalReleasedAmount + totalRevokedAmount + totalRefundAmount; require(remainderAmount >= totalGrantAmount, "VCR: total grant > remainder"); if (vestingGrant.isActive) { _vestingGrants[account].grantAmount = vestingGrant.grantAmount + truncatedGrantAmount; // _vestingGrants[account].isRevocable = isRevocable; } else { _vestingGrants[account] = VestingGrant({ grantAmount: truncatedGrantAmount, isRevocable: isRevocable, isRevoked: false, isActive: true }); } emit VestingGrantAdded(account, truncatedGrantAmount, isRevocable); } /** * @notice Cancel refund window * @dev Can only cancel when refund window has not started yet */ function _cancelRefundWindow() internal virtual { require(isRefundWindowDefined(), "VCR: no refund"); require(!hasRefundWindowStarted(block.timestamp), "VCR: refund started"); uint256 oldStartTimestamp = _refundWindow.startTimestamp; uint256 oldDurationSeconds = _refundWindow.durationSeconds; uint256 oldEndTimestamp = _refundWindow.endTimestamp; _refundWindow.startTimestamp = 0; _refundWindow.durationSeconds = 0; _refundWindow.endTimestamp = 0; emit RefundWindowCancelled(msg.sender, oldStartTimestamp, oldDurationSeconds, oldEndTimestamp); } /** * @notice Extend refund window * @dev Can only extend when refund window is open * @param newDurationSeconds New refund window duration in seconds */ function _extendRefundWindow(uint256 newDurationSeconds) internal virtual { require(newDurationSeconds > 0, "VCR: new duration"); require(isRefundWindowOpenNow(), "VCR: not open"); uint256 oldEndTimestamp = _refundWindow.endTimestamp; uint256 newEndTimestamp = _refundWindow.startTimestamp + newDurationSeconds; require(newEndTimestamp > oldEndTimestamp, "VCR: too short"); uint256 oldDurationSeconds = _refundWindow.durationSeconds; _refundWindow.durationSeconds = newDurationSeconds; _refundWindow.endTimestamp = newEndTimestamp; emit RefundWindowExtended(msg.sender, newDurationSeconds, newEndTimestamp, oldDurationSeconds, oldEndTimestamp); } /** * @notice Refund specified amount of tokens to `account` * @dev Can only refund when refund window is open * @dev Cannot refund if have previously refunded * @dev Cannot refund if have previously claimed * @param account The address to receive the refunded amount of tokens * @param amount The token amount in wei to be refunded to `account` */ function _refund(address account, uint256 amount) internal virtual { require(account != address(0), "VCR: zero account"); require(amount > 0, "VCR: zero amount"); require(isRefundWindowOpenNow(), "VCR: not open"); _refunded[account] += amount; totalRefundAmount += amount; } /** * @notice Release specified amount of tokens to `account` * @param account The address to receive the specified amount of tokens * @param amount The token amount in wei to be transferred to `account` */ function _release(address account, uint256 amount) internal virtual { require(account != address(0), "VCR: zero account"); require(amount > 0, "VCR: zero amount"); uint256 transferDecimalsAmount = amount.scaleWeiToDecimals(tokenDecimals); uint256 transferWeiAmount = transferDecimalsAmount.scaleDecimalsToWei(tokenDecimals); _released[account] += transferWeiAmount; totalReleasedAmount += transferWeiAmount; emit TokensReleased(account, transferWeiAmount); IERC20(tokenAddress).safeTransfer(account, transferDecimalsAmount); } /** * @notice Revoke vesting grant for `account` * @dev Only revocable grants can be revoked * @param account The address that will have the vesting grant revoked */ function _revokeVestingGrant(address account) internal virtual { require(account != address(0), "VCR: zero account"); VestingGrant memory vestingGrant = _vestingGrants[account]; require(vestingGrant.isActive, "VCR: inactive"); require(vestingGrant.isRevocable, "VCR: not revocable"); require(!revoked(account), "VCR: already revoked"); uint256 refundedAmount = refundedAmountFor(account); uint256 releasedAmount = releasedAmountFor(account); uint256 remainderAmount = vestingGrant.grantAmount - refundedAmount - releasedAmount; // https://github.com/crytic/slither/wiki/Detector-Documentation#costly-operations-inside-a-loop // slither-disable-next-line costly-loop totalRevokedAmount += remainderAmount; _vestingGrants[account].isRevoked = true; emit VestingGrantRevoked(account, remainderAmount, vestingGrant.grantAmount, refundedAmount, releasedAmount); } /** * @notice Set refund window * @dev Can only have one refund * @param startTimestamp Timestamp when refund window will start * @param durationSeconds Refund window duration in seconds */ function _setRefundWindow(uint256 startTimestamp, uint256 durationSeconds) internal virtual { require(startTimestamp > 0, "VCR: start timestamp"); require(durationSeconds > 0, "VCR: duration"); require(!hasRefundWindowStarted(block.timestamp), "VCR: refund started"); uint256 endTimestamp = startTimestamp + durationSeconds; _refundWindow.startTimestamp = startTimestamp; _refundWindow.durationSeconds = durationSeconds; _refundWindow.endTimestamp = endTimestamp; emit RefundWindowSet(msg.sender, startTimestamp, durationSeconds, endTimestamp); } /** * @notice Get total percentage to be released at specified timestamp * @param atTimestamp Specified timestamp * @return totalPercentRelease The total percentage to be released at specified timestamp */ function _getTotalPercentRelease(uint256 atTimestamp) internal view virtual returns (uint256 totalPercentRelease) { totalPercentRelease = 0; for (uint256 i = 0; i < numVestingScheduleEntries; i++) { if (atTimestamp < _vestingSchedule[i].startTimestamp) { break; } if (atTimestamp >= _vestingSchedule[i].endTimestamp) { totalPercentRelease += _vestingSchedule[i].percentRelease; } else { uint256 durationSeconds = _vestingSchedule[i].durationDays * SECONDS_IN_DAY; uint256 percentRelease = (atTimestamp - _vestingSchedule[i].startTimestamp) * _vestingSchedule[i].percentRelease; // https://github.com/crytic/slither/wiki/Detector-Documentation#divide-before-multiply // slither-disable-next-line divide-before-multiply totalPercentRelease = (totalPercentRelease * durationSeconds + percentRelease) / durationSeconds; break; } } } /** * @notice Get token amount that is refundable for `account` * @param account The address to check * @return refundableAmount The token amount in wei that is refundedable for `account` */ function _refundableAmountFor(address account) internal view virtual returns (uint256 refundableAmount) { require(account != address(0), "VCR: zero account"); require(isVestingScheduleDefined(), "VCR: undefined schedule"); require(!revoked(account), "VCR: revoked"); VestingGrant memory vestingGrant = _vestingGrants[account]; // require(vestingGrant.isActive, "VCR: inactive"); // already checked in revoked() refundableAmount = hasRefundedFor(account) || releasedAmountFor(account) > 0 ? 0 : vestingGrant.grantAmount; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldWallet","type":"address"},{"indexed":true,"internalType":"address","name":"newWallet","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminWalletChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"refundStartTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refundDurationSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refundEndTimestamp","type":"uint256"}],"name":"RefundWindowCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"newDurationSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newEndTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldDurationSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldEndTimestamp","type":"uint256"}],"name":"RefundWindowExtended","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"durationSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"name":"RefundWindowSet","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":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"startTimestamps","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"percentReleases","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"durationsDays","type":"uint256[]"}],"name":"ScheduleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"refundAmount","type":"uint256"}],"name":"TokensRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"unusedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"balanceInWei","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalReleasedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalRevokedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalRefundAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGrantAmount","type":"uint256"}],"name":"UnusedTokensTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"grantAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isRevocable","type":"bool"}],"name":"VestingGrantAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"remainderAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"grantAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refundedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"releasedAmount","type":"uint256"}],"name":"VestingGrantRevoked","type":"event"},{"inputs":[],"name":"BACKOFFICE_CONTRACT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BACKOFFICE_GOVERNANCE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BACKOFFICE_ROLE_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BATCH_MAX_NUM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONTRACT_USAGE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INTERFACE_ID","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERCENT_100_WEI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SCHEDULE_MAX_ENTRIES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECONDS_IN_DAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TENANT_CONTRACT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TENANT_GOVERNANCE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TENANT_ROLE_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_MAX_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"grantAmount","type":"uint256"},{"internalType":"bool","name":"isRevocable","type":"bool"}],"name":"addVestingGrant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bool[]","name":"","type":"bool[]"}],"name":"addVestingGrantsBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowAccumulate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelRefundWindow","outputs":[{"internalType":"bool","name":"isCancelled","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"effectiveGrantAmountFor","outputs":[{"internalType":"uint256","name":"grantAmountWei","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newDurationSeconds","type":"uint256"}],"name":"extendRefundWindow","outputs":[{"internalType":"bool","name":"isExtended","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factoryImplementationType","outputs":[{"internalType":"uint256","name":"implementationType","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRefundWindow","outputs":[{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"durationSeconds","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","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":[],"name":"getVestingSchedule","outputs":[{"internalType":"uint256[]","name":"startTimestamps","type":"uint256[]"},{"internalType":"uint256[]","name":"percentReleases","type":"uint256[]"},{"internalType":"uint256[]","name":"durationsDays","type":"uint256[]"},{"internalType":"uint256[]","name":"endTimestamps","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":"uint256","name":"atTimestamp","type":"uint256"}],"name":"hasRefundWindowStarted","outputs":[{"internalType":"bool","name":"hasStarted","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"hasRefundedFor","outputs":[{"internalType":"bool","name":"hasRefunded","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"hasReleasedFor","outputs":[{"internalType":"bool","name":"hasReleased","type":"bool"}],"stateMutability":"view","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":"atTimestamp","type":"uint256"}],"name":"hasVestingScheduleStarted","outputs":[{"internalType":"bool","name":"hasStarted","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress_","type":"address"},{"internalType":"uint256","name":"tokenDecimals_","type":"uint256"},{"internalType":"bool","name":"allowAccumulate_","type":"bool"},{"internalType":"address","name":"backofficeAdminAddress","type":"address"},{"internalType":"address","name":"tenantAdminAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isRefundWindowDefined","outputs":[{"internalType":"bool","name":"isDefined","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRefundWindowOpenNow","outputs":[{"internalType":"bool","name":"isOpen","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isVestingScheduleDefined","outputs":[{"internalType":"bool","name":"isDefined","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numVestingScheduleEntries","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"projectWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"refund","outputs":[{"internalType":"bool","name":"isRefunded","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"refundableAmountFor","outputs":[{"internalType":"uint256","name":"refundableAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"refundedAmountFor","outputs":[{"internalType":"uint256","name":"refundedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"releasableAmountFor","outputs":[{"internalType":"uint256","name":"releasableAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"releasedAmountFor","outputs":[{"internalType":"uint256","name":"releasedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"revokeVestingGrant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"","type":"address[]"}],"name":"revokeVestingGrantsBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"revoked","outputs":[{"internalType":"bool","name":"isRevoked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newWallet","type":"address"}],"name":"setAdminWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"durationSeconds","type":"uint256"}],"name":"setRefundWindow","outputs":[{"internalType":"bool","name":"isSet","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"startTimestamps","type":"uint256[]"},{"internalType":"uint256[]","name":"percentReleases","type":"uint256[]"},{"internalType":"uint256[]","name":"durationsDays","type":"uint256[]"}],"name":"setVestingSchedule","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenDecimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalGrantAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRefundAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleasedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRevokedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferUnusedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"unvestedAmountFor","outputs":[{"internalType":"uint256","name":"unvestedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"vestedAmountFor","outputs":[{"internalType":"uint256","name":"vestedAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"vestingGrantFor","outputs":[{"internalType":"uint256","name":"grantAmount","type":"uint256"},{"internalType":"bool","name":"isRevocable","type":"bool"},{"internalType":"bool","name":"isRevoked","type":"bool"},{"internalType":"bool","name":"isActive","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506000805462ff000019169055620000286200002e565b620000ef565b600054610100900460ff16156200009b5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000ed576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61469280620000ff6000396000f3fe608060405234801561001057600080fd5b50600436106103db5760003560e01c80635c975abb1161020a578063aff01b6111610125578063d547741f116100b8578063ebfb141811610087578063ebfb141814610849578063f1c2111c1461085c578063f803b2cd14610870578063fa01dc0614610883578063fb872e191461089657600080fd5b8063d547741f146107fb578063de3e75201461080e578063ea93e51d14610821578063eba94ba01461083457600080fd5b8063beb08ab9116100f4578063beb08ab9146107b7578063bedecd4a146107ca578063c68a1014146107df578063cbe274d1146107f257600080fd5b8063aff01b6114610784578063b33712c514610794578063b4a0502f1461079c578063b8f6a04a146107af57600080fd5b806398a389b41161019d578063a5c4d1a41161016c578063a5c4d1a414610755578063a5c90c3a14610768578063a9b82bd414610771578063ac6ddd5d1461062957600080fd5b806398a389b41461070b5780639d76ea5814610732578063a217fddf14610745578063a4d50f571461074d57600080fd5b806383273cd1116101d957806383273cd1146106d457806386d1a69f146106dd5780638ac33be9146106e557806391d14854146106f857600080fd5b80635c975abb146106a257806361a52a36146106b357806368f113eb146106bd5780636fa6316c146106cb57600080fd5b806336b19cd7116102fa578063462ebf441161028d57806355c17ed11161025c57806355c17ed11461065957806355ddce451461066c57806359303ed8146106765780635a0d73aa1461067e57600080fd5b8063462ebf44146106145780634bf4e25e146106295780634ca800d0146106315780634ef7086b1461064457600080fd5b80633b9e916f116102c95780633b9e916f146105d1578063410085df146105e65780634229613d146105f9578063439766ce1461060c57600080fd5b806336b19cd7146105815780633a05f0d8146105a65780633b3f6296146105be5780633b97e856146105c857600080fd5b80631a5c95dd116103725780632f2ff15d116103415780632f2ff15d1461053557806331a2250c14610548578063350829331461055b57806336568abe1461056e57600080fd5b80631a5c95dd146104a7578063248a9ca3146104af57806326a1f5cc146104d35780632cf2dab2146104fa57600080fd5b806309b862b9116103ae57806309b862b91461044f5780630abeb2e6146104765780630ec7cfd51461048b57806311c05a221461049457600080fd5b806301ffc9a7146103e05780630239c7be1461040857806303b315e31461041b578063045ea76e1461042e575b600080fd5b6103f36103ee366004613c18565b6108bc565b60405190151581526020015b60405180910390f35b6103f3610416366004613c42565b6108e7565b6103f3610429366004613c80565b610a2b565b61044161043c366004613c80565b610aa6565b6040519081526020016103ff565b61045d632f80bacf60e21b81565b6040516001600160e01b031990911681526020016103ff565b610489610484366004613ce7565b610b89565b005b61044160095481565b6104896104a2366004613e5e565b611025565b6103f3611075565b6104416104bd366004613e93565b6000908152600160208190526040909120015490565b6104417f85485e0579110e3a8651ecc622c4a4de1af035fb88034e30905cf67a60881bfd81565b61050d610508366004613c80565b6110aa565b60408051948552921515602085015290151591830191909152151560608201526080016103ff565b610489610543366004613eac565b61113c565b610441610556366004613c80565b611167565b610489610569366004613c80565b611172565b61048961057c366004613eac565b611193565b6002546001600160a01b03165b6040516001600160a01b0390911681526020016103ff565b6105ae61120d565b6040516103ff9493929190613f13565b600a5415156103f3565b61044160055481565b6104416000805160206145dd83398151915281565b6103f36105f4366004613f60565b61142f565b610441610607366004613c80565b611613565b610489611657565b61044160008051602061463d83398151915281565b610441606481565b6103f361063f366004613e93565b61167a565b61044160008051602061461d83398151915281565b610441610667366004613c80565b61175d565b60035415156103f3565b6104896117b3565b600a54600b54600c54604080519384526020840192909252908201526060016103ff565b60005462010000900460ff166103f3565b6104416201518081565b6104896104a2366004613ffc565b61044160075481565b61044160085481565b610489611992565b6104416106f3366004613c80565b6119b1565b6103f3610706366004613eac565b611afc565b6104417f1cc585a35ee40bc8e30be46c66514537f1953ad0977428ef905e8e0df71a6ee781565b60045461058e906001600160a01b031681565b610441600081565b6103f3611b27565b6103f3610763366004613e93565b611b51565b61044160035481565b6103f361077f366004613c80565b611ba8565b61044168056bc75e2d6310000081565b610489611c1c565b6104416107aa366004613c80565b611c3c565b610441601281565b60115461058e906001600160a01b031681565b6104416000805160206145bd83398151915281565b6103f36107ed366004613e93565b611cf8565b61044160065481565b610489610809366004613eac565b611d78565b61048961081c3660046140d8565b611d9e565b61048961082f366004614118565b611e7e565b6104416000805160206145fd83398151915281565b610441610857366004613c80565b611f99565b6002546103f390600160a01b900460ff1681565b61048961087e366004613c80565b611fdd565b6103f3610891366004613c80565b612088565b7f7866924b44039f57cc7e434c06f38cc0a54edaa38ef5e1e10233e9acd30773cc610441565b60006001600160e01b0319821663a93f529b60e01b14806108e157506108e182612133565b92915050565b60006000805160206145dd83398151915261090181612168565b42841161094d5760405162461bcd60e51b81526020600482015260156024820152740564352503a2073746172742074696d657374616d7605c1b60448201526064015b60405180910390fd5b6000831161098e5760405162461bcd60e51b815260206004820152600e60248201526d2b21a9281d10323ab930ba34b7b760911b6044820152606401610944565b6003546109ad5760405162461bcd60e51b815260040161094490614178565b600060016109bb85876141c5565b6109c591906141d8565b90506109d081611cf8565b15610a165760405162461bcd60e51b81526020600482015260166024820152751590d4940e881cd8da19591d5b19481cdd185c9d195960521b6044820152606401610944565b610a208585612172565b506001949350505050565b60006001600160a01b038216610a535760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0382166000908152600f602052604090206001015462010000900460ff16610a945760405162461bcd60e51b815260040161094490614216565b6000610a9f83611613565b1192915050565b60006001600160a01b038216610ace5760405162461bcd60e51b81526004016109449061423d565b610ad742611cf8565b610b175760405162461bcd60e51b81526020600482015260116024820152701590d4940e881b9bdd081cdd185c9d1959607a1b6044820152606401610944565b610b2082612088565b15610b5d5760405162461bcd60e51b815260206004820152600d60248201526c1590d4940e881c995d9bdad959609a1b6044820152606401610944565b6000610b68836119b1565b90506000610b7584611613565b9050610b8181836141d8565b949350505050565b6000805160206145bd833981519152610ba181612168565b85610bdb5760405162461bcd60e51b815260206004820152600a6024820152695643523a20656d70747960b01b6044820152606401610944565b6064861115610c1e5760405162461bcd60e51b815260206004820152600f60248201526e0ac86a47440caf0c6cacac840dac2f608b1b6044820152606401610944565b838614610c6d5760405162461bcd60e51b815260206004820152601d60248201527f5643523a2070657263656e74206c656e67746820646966666572656e740000006044820152606401610944565b818614610cbc5760405162461bcd60e51b815260206004820152601e60248201527f5643523a206475726174696f6e206c656e67746820646966666572656e7400006044820152606401610944565b610cc542611cf8565b15610d095760405162461bcd60e51b81526020600482015260146024820152731590d48e88185b1c9958591e481cdd185c9d195960621b6044820152606401610944565b426000805b88811015610f88576000888883818110610d2a57610d2a614269565b9050602002013511610d725760405162461bcd60e51b81526020600482015260116024820152701590d48e881e995c9bc81c195c98d95b9d607a1b6044820152606401610944565b828a8a83818110610d8557610d85614269565b905060200201351015610dda5760405162461bcd60e51b815260206004820152601c60248201527f5643523a20696e76616c69642073746172742074696d657374616d70000000006044820152606401610944565b878782818110610dec57610dec614269565b9050602002013582610dfe91906141c5565b915068056bc75e2d63100000821115610e4c5760405162461bcd60e51b815260206004820152601060248201526f5643523a20657863656564203130302560801b6044820152606401610944565b6000868683818110610e6057610e60614269565b905060200201351115610ebe5762015180868683818110610e8357610e83614269565b90506020020135610e94919061427f565b8a8a83818110610ea657610ea6614269565b90506020020135610eb791906141c5565b9250610eda565b898982818110610ed057610ed0614269565b9050602002013592505b6040518060800160405280898984818110610ef757610ef7614269565b9050602002013581526020018b8b84818110610f1557610f15614269565b905060200201358152602001878784818110610f3357610f33614269565b6020908102929092013583525090810185905260008381526010825260409081902083518155918301516001830155820151600282015560609091015160039091015580610f8081614296565b915050610d0e565b5068056bc75e2d631000008114610fd15760405162461bcd60e51b815260206004820152600d60248201526c5643523a206e6f74203130302560981b6044820152606401610944565b600388905560405133907f0f1833d9024614968b40c7290fd02c4ec61b6b4167fdbe0bc3022aa6440e2d0b90611012908c908c908c908c908c908c906142e1565b60405180910390a2505050505050505050565b6000805160206145bd83398151915261103d81612168565b60405162461bcd60e51b8152602060048201526009602482015268564352503a206e2f6160b81b6044820152606401610944565b5050565b600a546000901580159061108a5750600c5415155b80156110985750600a544210155b80156110a55750600c5442105b905090565b60008080806001600160a01b0385166110d55760405162461bcd60e51b8152600401610944906141eb565b505050506001600160a01b03166000908152600f60209081526040918290208251608081018452815480825260019092015460ff80821615159483018590526101008204811615159583018690526201000090910416151560609091018190529093919291565b6000828152600160208190526040909120015461115881612168565b61116283836122ac565b505050565b60006108e182612317565b60008051602061463d83398151915261118a81612168565b61107182612432565b6001600160a01b03811633146112035760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610944565b61107182826124db565b60608060608060035467ffffffffffffffff81111561122e5761122e613d81565b604051908082528060200260200182016040528015611257578160200160208202803683370190505b50935060035467ffffffffffffffff81111561127557611275613d81565b60405190808252806020026020018201604052801561129e578160200160208202803683370190505b50925060035467ffffffffffffffff8111156112bc576112bc613d81565b6040519080825280602002602001820160405280156112e5578160200160208202803683370190505b50915060035467ffffffffffffffff81111561130357611303613d81565b60405190808252806020026020018201604052801561132c578160200160208202803683370190505b50600354909150156114295760005b60035481101561142757600081815260106020526040902060010154855186908390811061136b5761136b614269565b60200260200101818152505060106000828152602001908152602001600020600001548482815181106113a0576113a0614269565b60200260200101818152505060106000828152602001908152602001600020600201548382815181106113d5576113d5614269565b602002602001018181525050601060008281526020019081526020016000206003015482828151811061140a5761140a614269565b60209081029190910101528061141f81614296565b91505061133b565b505b90919293565b6000611439612542565b6000805160206145dd83398151915261145181612168565b6001600160a01b0384166114775760405162461bcd60e51b81526004016109449061423d565b600083116114c75760405162461bcd60e51b815260206004820152601860248201527f564352503a207a65726f20726566756e6420616d6f756e7400000000000000006044820152606401610944565b6011546000906114df906001600160a01b0316612317565b905060006114f86005548661259090919063ffffffff16565b905060006115116005548361262590919063ffffffff16565b9050600081116115575760405162461bcd60e51b81526020600482015260116024820152701590d4940e881e995c9bc8185b5bdd5b9d607a1b6044820152606401610944565b828111156115965760405162461bcd60e51b815260206004820152600c60248201526b1590d4940e88195e18d9595960a21b6044820152606401610944565b6011546115ac906001600160a01b0316826126ab565b866001600160a01b03167f4a38df4d86b2d93d9427931480e831f8dbede6c4d0fdc4490340fddc0c33627a826040516115e791815260200190565b60405180910390a2600454611606906001600160a01b031688846127a2565b5060019695505050505050565b60006001600160a01b03821661163b5760405162461bcd60e51b8152600401610944906141eb565b506001600160a01b03166000908152600e602052604090205490565b6000805160206145bd83398151915261166f81612168565b6116776127f4565b50565b60006000805160206145dd83398151915261169481612168565b600083116116d55760405162461bcd60e51b815260206004820152600e60248201526d2b21a9281d10323ab930ba34b7b760911b6044820152606401610944565b6003546116f45760405162461bcd60e51b815260040161094490614178565b600a54600061170385836141c5565b905061170e81611cf8565b156117545760405162461bcd60e51b81526020600482015260166024820152751590d4940e881cd8da19591d5b19481cdd185c9d195960521b6044820152606401610944565b610a2085612852565b60006001600160a01b0382166117855760405162461bcd60e51b8152600401610944906141eb565b61178e82612088565b1561179b57506000919050565b60006117a683611c3c565b90506000610b75846119b1565b6000805160206145bd8339815191526117cb81612168565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015611819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183d919061432a565b905060006118566005548361262590919063ffffffff16565b905060006006546007546009546008548561187191906141c5565b61187b91906141c5565b61188591906141c5565b61188f91906141d8565b9050600081116118e15760405162461bcd60e51b815260206004820152601860248201527f5643523a206e6f7468696e6720746f207472616e7366657200000000000000006044820152606401610944565b60006118f86005548361259090919063ffffffff16565b60085460095460075460065460408051888152602081018a9052908101949094526060840192909252608083015260a082015290915033907fa2233c5cbb0dc7c45a1a77e61670cd11eb315895207721ab0845d8977360f8999060c00160405180910390a26119856119726002546001600160a01b031690565b6004546001600160a01b031690836127a2565b5050505050565b50505050565b61199a612542565b60006119a533610aa6565b9050611677338261298d565b60006001600160a01b0382166119d95760405162461bcd60e51b8152600401610944906141eb565b6003541580611a1057506000805260106020527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb0254155b15611a1d57506000919050565b6000805260106020527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb0254421015611a5757506000919050565b611a6082612088565b15611a6e576108e182611613565b6000611a7983611c3c565b9050601060006001600354611a8e91906141d8565b8152602001908152602001600020600301544210611aac5792915050565b6000611ab742612ac6565b9050600068056bc75e2d63100000611acf838561427f565b611ad99190614343565b600554909150611af390611aed8382612590565b90612625565b95945050505050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006000805160206145dd833981519152611b4181612168565b611b49612bb6565b600191505090565b6000808211611b935760405162461bcd60e51b815260206004820152600e60248201526d05643523a2074696d657374616d760941b6044820152606401610944565b600a54158015906108e1575050600a54111590565b60006001600160a01b038216611bd05760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0382166000908152600f602052604090206001015462010000900460ff16611c115760405162461bcd60e51b815260040161094490614216565b6000610a9f83611f99565b6000805160206145bd833981519152611c3481612168565b611677612c9f565b60006001600160a01b038216611c645760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0382166000908152600f602090815260409182902082516080810184528154815260019091015460ff808216151593830193909352610100810483161515938201939093526201000090920416151560608201819052611cdd5760405162461bcd60e51b815260040161094490614216565b6000611ce884611f99565b8251909150610b819082906141d8565b6000808211611d3a5760405162461bcd60e51b815260206004820152600e60248201526d05643523a2074696d657374616d760941b6044820152606401610944565b60006003541180156108e15750506000805260106020527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb0254111590565b60008281526001602081905260409091200154611d9481612168565b61116283836124db565b6000805160206145bd833981519152611db681612168565b6001600160a01b038416611ddc5760405162461bcd60e51b81526004016109449061423d565b6011546001600160a01b03161580611e1557506011546001600160a01b038581169116148015611e155750600254600160a01b900460ff165b611e585760405162461bcd60e51b81526020600482015260146024820152731590d4940e881c1c9bda9958dd081dd85b1b195d60621b6044820152606401610944565b601180546001600160a01b0319166001600160a01b03861617905561198c848484612cda565b600054610100900460ff1615808015611e9e5750600054600160ff909116105b80611eb85750303b158015611eb8575060005460ff166001145b611f1b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610944565b6000805460ff191660011790558015611f3e576000805461ff0019166101001790555b611f4b86868686866131b1565b8015611f91576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b60006001600160a01b038216611fc15760405162461bcd60e51b8152600401610944906141eb565b506001600160a01b03166000908152600d602052604090205490565b6000805160206145bd833981519152611ff581612168565b6001600160a01b03821661201b5760405162461bcd60e51b81526004016109449061423d565b6011546001600160a01b0383811691161461206f5760405162461bcd60e51b81526020600482015260146024820152731590d4940e881c1c9bda9958dd081dd85b1b195d60621b6044820152606401610944565b601180546001600160a01b0319169055611071826131ed565b60006001600160a01b0382166120b05760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0382166000908152600f602090815260409182902082516080810184528154815260019091015460ff8082161515938301939093526101008104831615159382019390935262010000909204161515606082018190526121295760405162461bcd60e51b815260040161094490614216565b6040015192915050565b60006001600160e01b03198216637965db0b60e01b14806108e157506301ffc9a760e01b6001600160e01b03198316146108e1565b61167781336133e7565b600082116121b95760405162461bcd60e51b815260206004820152601460248201527305643523a2073746172742074696d657374616d760641b6044820152606401610944565b600081116121f95760405162461bcd60e51b815260206004820152600d60248201526c2b21a91d10323ab930ba34b7b760991b6044820152606401610944565b61220242611b51565b156122455760405162461bcd60e51b81526020600482015260136024820152721590d48e881c99599d5b99081cdd185c9d1959606a1b6044820152606401610944565b600061225182846141c5565b600a849055600b839055600c819055604080518581526020810185905290810182905290915033907f6a68d4baa763748fa290c1535788786f09660025e1dcf935f40d3be2701fd090906060015b60405180910390a2505050565b6122b68282611afc565b6110715760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b60006001600160a01b03821661233f5760405162461bcd60e51b81526004016109449061423d565b60035461235e5760405162461bcd60e51b815260040161094490614178565b61236782612088565b156123a45760405162461bcd60e51b815260206004820152600d60248201526c1590d4940e881c995d9bdad959609a1b6044820152606401610944565b6000806123b0846110aa565b935050509150806123f45760405162461bcd60e51b815260206004820152600e60248201526d564352503a20696e61637469766560901b6044820152606401610944565b6123fd42611cf8565b1561240c575060009392505050565b61241584611f99565b61241e85611613565b61242890846141d8565b610b8191906141d8565b6001600160a01b0381166124885760405162461bcd60e51b815260206004820152601760248201527f41646d696e57616c6c65743a206e65772077616c6c65740000000000000000006044820152606401610944565b600280546001600160a01b038381166001600160a01b031983168117909355604051911691339183907fe8e5de042e492b67e017467ab56c92b8389694c5418551fb8026282978ef881790600090a45050565b6124e58282611afc565b156110715760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60005462010000900460ff161561258e5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610944565b565b600060128211156125dd5760405162461bcd60e51b8152602060048201526017602482015276556e6974436f6e7665727465723a20646563696d616c7360481b6044820152606401610944565b6012821080156125ed5750600083115b1561261e5760006125ff8360126141d8565b905061260c81600a614449565b6126169085614343565b9150506108e1565b5090919050565b600060128211156126725760405162461bcd60e51b8152602060048201526017602482015276556e6974436f6e7665727465723a20646563696d616c7360481b6044820152606401610944565b6012821080156126825750600083115b1561261e5760006126948360126141d8565b90506126a181600a614449565b612616908561427f565b6001600160a01b0382166126d15760405162461bcd60e51b8152600401610944906141eb565b600081116127145760405162461bcd60e51b815260206004820152601060248201526f1590d48e881e995c9bc8185b5bdd5b9d60821b6044820152606401610944565b61271c611075565b6127585760405162461bcd60e51b815260206004820152600d60248201526c2b21a91d103737ba1037b832b760991b6044820152606401610944565b6001600160a01b0382166000908152600d6020526040812080548392906127809084906141c5565b92505081905550806007600082825461279991906141c5565b90915550505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611162908490613440565b6127fc612542565b6000805462ff00001916620100001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586128353390565b6040516001600160a01b03909116815260200160405180910390a1565b600081116128965760405162461bcd60e51b81526020600482015260116024820152702b21a91d103732bb90323ab930ba34b7b760791b6044820152606401610944565b61289e611075565b6128da5760405162461bcd60e51b815260206004820152600d60248201526c2b21a91d103737ba1037b832b760991b6044820152606401610944565b600c54600a546000906128ee9084906141c5565b90508181116129305760405162461bcd60e51b815260206004820152600e60248201526d1590d48e881d1bdbc81cda1bdc9d60921b6044820152606401610944565b600b805490849055600c82905560408051858152602081018490529081018290526060810184905233907ff363c0e368607bfecfd5e84a04bb5a9dc7e7396ba4fa56eb898ed47431f060ca9060800160405180910390a250505050565b6001600160a01b0382166129b35760405162461bcd60e51b8152600401610944906141eb565b600081116129f65760405162461bcd60e51b815260206004820152601060248201526f1590d48e881e995c9bc8185b5bdd5b9d60821b6044820152606401610944565b6000612a0d6005548361259090919063ffffffff16565b90506000612a266005548361262590919063ffffffff16565b6001600160a01b0385166000908152600e6020526040812080549293508392909190612a539084906141c5565b925050819055508060086000828254612a6c91906141c5565b90915550506040518181526001600160a01b038516907fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df931799060200160405180910390a260045461198c906001600160a01b031685846127a2565b6000805b600354811015612bb0576000818152601060205260409020600101548310612bb0576000818152601060205260409020600301548310612b2457600081815260106020526040902054612b1d90836141c5565b9150612b9e565b600081815260106020526040812060020154612b4490620151809061427f565b600083815260106020526040812080546001909101549293509091612b6990876141d8565b612b73919061427f565b90508181612b81828761427f565b612b8b91906141c5565b612b959190614343565b93505050612bb0565b80612ba881614296565b915050612aca565b50919050565b600a54612bf65760405162461bcd60e51b815260206004820152600e60248201526d1590d48e881b9bc81c99599d5b9960921b6044820152606401610944565b612bff42611b51565b15612c425760405162461bcd60e51b81526020600482015260136024820152721590d48e881c99599d5b99081cdd185c9d1959606a1b6044820152606401610944565b600a8054600b8054600c80546000958690559285905593909355604080518381526020810185905290810182905291929133907f2578378599211ea2e71b1efec8749db843a1063cbee11dd248425e39358c7c599060600161229f565b612ca7613515565b6000805462ff0000191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612835565b6001600160a01b038316612d005760405162461bcd60e51b8152600401610944906141eb565b60008211612d495760405162461bcd60e51b81526020600482015260166024820152751590d48e881e995c9bc819dc985b9d08185b5bdd5b9d60521b6044820152606401610944565b612d5242611cf8565b15612d965760405162461bcd60e51b81526020600482015260146024820152731590d48e88185b1c9958591e481cdd185c9d195960621b6044820152606401610944565b6001600160a01b0383166000908152600f602090815260409182902082516080810184528154815260019091015460ff8082161515938301939093526101008104831615159382019390935262010000909204811615156060830152600254600160a01b90041680612e0a57508060600151155b612e4b5760405162461bcd60e51b81526020600482015260126024820152711590d48e88185b1c9958591e48185919195960721b6044820152606401610944565b80606001511580612e625750612e6084612088565b155b612ea55760405162461bcd60e51b81526020600482015260146024820152731590d48e88185b1c9958591e481c995d9bdad95960621b6044820152606401610944565b600554600090612eb990611aed8682612590565b905060008111612f0b5760405162461bcd60e51b815260206004820152601f60248201527f5643523a207a65726f20646563696d616c73206772616e7420616d6f756e74006044820152606401610944565b8060066000828254612f1d91906141c5565b9091555050600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015612f70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f94919061432a565b905060008111612fda5760405162461bcd60e51b81526020600482015260116024820152705643523a207a65726f2062616c616e636560781b6044820152606401610944565b6000612ff16005548361262590919063ffffffff16565b905060006007546009546008548461300991906141c5565b61301391906141c5565b61301d91906141c5565b90506006548110156130715760405162461bcd60e51b815260206004820152601c60248201527f5643523a20746f74616c206772616e74203e2072656d61696e646572000000006044820152606401610944565b8460600151156130a65784516130889085906141c5565b6001600160a01b0389166000908152600f6020526040902055613162565b6040518060800160405280858152602001871515815260200160001515815260200160011515815250600f60008a6001600160a01b03166001600160a01b031681526020019081526020016000206000820151816000015560208201518160010160006101000a81548160ff02191690831515021790555060408201518160010160016101000a81548160ff02191690831515021790555060608201518160010160026101000a81548160ff0219169083151502179055509050505b6040805185815287151560208201526001600160a01b038a16917f4e623b5b8a8f6ed80fac7bdb7744dcf9e24e56e76819aebd9c0321ba115d2466910160405180910390a25050505050505050565b600054610100900460ff166131d85760405162461bcd60e51b815260040161094490614455565b6131e58585858585613564565b611985613841565b6001600160a01b0381166132135760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0381166000908152600f602090815260409182902082516080810184528154815260019091015460ff80821615159383019390935261010081048316151593820193909352620100009092041615156060820181905261328c5760405162461bcd60e51b815260040161094490614216565b80602001516132d25760405162461bcd60e51b81526020600482015260126024820152715643523a206e6f74207265766f6361626c6560701b6044820152606401610944565b6132db82612088565b1561331f5760405162461bcd60e51b81526020600482015260146024820152731590d48e88185b1c9958591e481c995d9bdad95960621b6044820152606401610944565b600061332a83611f99565b9050600061333784611613565b905060008183856000015161334c91906141d8565b61335691906141d8565b9050806009600082825461336a91906141c5565b90915550506001600160a01b0385166000818152600f6020908152604091829020600101805461ff0019166101001790558651825185815291820152908101859052606081018490527fd0aca067c29f1954ddc14148bbc33e72e72c378848d1234b94adb235b87f9e0c9060800160405180910390a25050505050565b6133f18282611afc565b611071576133fe8161388e565b6134098360206138a0565b60405160200161341a9291906144c4565b60408051601f198184030181529082905262461bcd60e51b825261094491600401614539565b6000613495826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a439092919063ffffffff16565b90508051600014806134b65750808060200190518101906134b6919061456c565b6111625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610944565b60005462010000900460ff1661258e5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610944565b600054610100900460ff1661358b5760405162461bcd60e51b815260040161094490614455565b6001600160a01b0385166135d65760405162461bcd60e51b81526020600482015260126024820152715643523a20746f6b656e206164647265737360701b6044820152606401610944565b601284111561361d5760405162461bcd60e51b81526020600482015260136024820152725643523a20746f6b656e20646563696d616c7360681b6044820152606401610944565b6001600160a01b03821661366b5760405162461bcd60e51b81526020600482015260156024820152742b21a91d103130b1b5b7b33334b1b29030b236b4b760591b6044820152606401610944565b6001600160a01b0381166136b55760405162461bcd60e51b81526020600482015260116024820152702b21a91d103a32b730b73a1030b236b4b760791b6044820152606401610944565b6136cd60008051602061461d83398151915280613a52565b6137057f1cc585a35ee40bc8e30be46c66514537f1953ad0977428ef905e8e0df71a6ee760008051602061461d833981519152613a52565b61371d6000805160206145fd83398151915280613a52565b61374360008051602061463d8339815191526000805160206145fd833981519152613a52565b6137696000805160206145bd8339815191526000805160206145fd833981519152613a52565b61378160008051602061461d833981519152836122ac565b6137ab7f1cc585a35ee40bc8e30be46c66514537f1953ad0977428ef905e8e0df71a6ee7836122ac565b6137c36000805160206145fd833981519152826122ac565b6137db60008051602061463d833981519152826122ac565b6137f36000805160206145bd833981519152826122ac565b6137fc81612432565b5050600480546001600160a01b039094166001600160a01b03199094169390931790925560055560028054911515600160a01b0260ff60a01b19909216919091179055565b600054610100900460ff166138685760405162461bcd60e51b815260040161094490614455565b61258e6000805160206145dd83398151915260008051602061461d833981519152613a52565b60606108e16001600160a01b03831660145b606060006138af83600261427f565b6138ba9060026141c5565b67ffffffffffffffff8111156138d2576138d2613d81565b6040519080825280601f01601f1916602001820160405280156138fc576020820181803683370190505b509050600360fc1b8160008151811061391757613917614269565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061394657613946614269565b60200101906001600160f81b031916908160001a905350600061396a84600261427f565b6139759060016141c5565b90505b60018111156139ed576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106139a9576139a9614269565b1a60f81b8282815181106139bf576139bf614269565b60200101906001600160f81b031916908160001a90535060049490941c936139e681614589565b9050613978565b508315613a3c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610944565b9392505050565b6060610b818484600085613a9f565b6000828152600160208190526040808320909101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b606082471015613b005760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610944565b600080866001600160a01b03168587604051613b1c91906145a0565b60006040518083038185875af1925050503d8060008114613b59576040519150601f19603f3d011682016040523d82523d6000602084013e613b5e565b606091505b5091509150613b6f87838387613b7a565b979650505050505050565b60608315613be9578251600003613be2576001600160a01b0385163b613be25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610944565b5081610b81565b610b818383815115613bfe5781518083602001fd5b8060405162461bcd60e51b81526004016109449190614539565b600060208284031215613c2a57600080fd5b81356001600160e01b031981168114613a3c57600080fd5b60008060408385031215613c5557600080fd5b50508035926020909101359150565b80356001600160a01b0381168114613c7b57600080fd5b919050565b600060208284031215613c9257600080fd5b613a3c82613c64565b60008083601f840112613cad57600080fd5b50813567ffffffffffffffff811115613cc557600080fd5b6020830191508360208260051b8501011115613ce057600080fd5b9250929050565b60008060008060008060608789031215613d0057600080fd5b863567ffffffffffffffff80821115613d1857600080fd5b613d248a838b01613c9b565b90985096506020890135915080821115613d3d57600080fd5b613d498a838b01613c9b565b90965094506040890135915080821115613d6257600080fd5b50613d6f89828a01613c9b565b979a9699509497509295939492505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613dc057613dc0613d81565b604052919050565b600067ffffffffffffffff821115613de257613de2613d81565b5060051b60200190565b600082601f830112613dfd57600080fd5b81356020613e12613e0d83613dc8565b613d97565b82815260059290921b84018101918181019086841115613e3157600080fd5b8286015b84811015613e5357613e4681613c64565b8352918301918301613e35565b509695505050505050565b600060208284031215613e7057600080fd5b813567ffffffffffffffff811115613e8757600080fd5b610b8184828501613dec565b600060208284031215613ea557600080fd5b5035919050565b60008060408385031215613ebf57600080fd5b82359150613ecf60208401613c64565b90509250929050565b600081518084526020808501945080840160005b83811015613f0857815187529582019590820190600101613eec565b509495945050505050565b608081526000613f266080830187613ed8565b8281036020840152613f388187613ed8565b90508281036040840152613f4c8186613ed8565b90508281036060840152613b6f8185613ed8565b60008060408385031215613f7357600080fd5b613f7c83613c64565b946020939093013593505050565b801515811461167757600080fd5b600082601f830112613fa957600080fd5b81356020613fb9613e0d83613dc8565b82815260059290921b84018101918181019086841115613fd857600080fd5b8286015b84811015613e53578035613fef81613f8a565b8352918301918301613fdc565b60008060006060848603121561401157600080fd5b833567ffffffffffffffff8082111561402957600080fd5b61403587838801613dec565b945060209150818601358181111561404c57600080fd5b8601601f8101881361405d57600080fd5b803561406b613e0d82613dc8565b81815260059190911b8201840190848101908a83111561408a57600080fd5b928501925b828410156140a85783358252928501929085019061408f565b965050505060408601359150808211156140c157600080fd5b506140ce86828701613f98565b9150509250925092565b6000806000606084860312156140ed57600080fd5b6140f684613c64565b925060208401359150604084013561410d81613f8a565b809150509250925092565b600080600080600060a0868803121561413057600080fd5b61413986613c64565b945060208601359350604086013561415081613f8a565b925061415e60608701613c64565b915061416c60808701613c64565b90509295509295909350565b60208082526018908201527f564352503a20756e646566696e6564207363686564756c650000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b808201808211156108e1576108e16141af565b818103818111156108e1576108e16141af565b6020808252601190820152701590d48e881e995c9bc81858d8dbdd5b9d607a1b604082015260600190565b6020808252600d908201526c5643523a20696e61637469766560981b604082015260600190565b6020808252601290820152711590d4940e881e995c9bc81858d8dbdd5b9d60721b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b80820281158282048414176108e1576108e16141af565b6000600182016142a8576142a86141af565b5060010190565b81835260006001600160fb1b038311156142c857600080fd5b8260051b80836020870137939093016020019392505050565b6060815260006142f560608301888a6142af565b82810360208401526143088187896142af565b9050828103604084015261431d8185876142af565b9998505050505050505050565b60006020828403121561433c57600080fd5b5051919050565b60008261436057634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156143a0578160001904821115614386576143866141af565b8085161561439357918102915b93841c939080029061436a565b509250929050565b6000826143b7575060016108e1565b816143c4575060006108e1565b81600181146143da57600281146143e457614400565b60019150506108e1565b60ff8411156143f5576143f56141af565b50506001821b6108e1565b5060208310610133831016604e8410600b8410161715614423575081810a6108e1565b61442d8383614365565b8060001904821115614441576144416141af565b029392505050565b6000613a3c83836143a8565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b838110156144bb5781810151838201526020016144a3565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516144fc8160178501602088016144a0565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161452d8160288401602088016144a0565b01602801949350505050565b60208152600082518060208401526145588160408501602087016144a0565b601f01601f19169190910160400192915050565b60006020828403121561457e57600080fd5b8151613a3c81613f8a565b600081614598576145986141af565b506000190190565b600082516145b28184602087016144a0565b919091019291505056fe52bbfa6e876ba7eadc80dc9b099c193c6daea0056635c463ce4d9723fa6d7733212a403a90eb28e41316223c150d4fd70813f6190caa207ae2a42a13777b29ef07258f049a6ded7f9eee4348cd5f072dca4852fa78e9604f2468ddeaa723e588b58f543c34fc3c79e1c358174f46808f77878cdc5ca730c4617cdbe574382eb696569a1fadb2d4dcc763ecf02934e5ddc4e41d9d5f44b6b99af57748b38b5058a26469706673582212204be8b2ee4e1ba87dde88dbd0569ab4d190bafebca71b46d34382533aede83d1d64736f6c63430008130033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103db5760003560e01c80635c975abb1161020a578063aff01b6111610125578063d547741f116100b8578063ebfb141811610087578063ebfb141814610849578063f1c2111c1461085c578063f803b2cd14610870578063fa01dc0614610883578063fb872e191461089657600080fd5b8063d547741f146107fb578063de3e75201461080e578063ea93e51d14610821578063eba94ba01461083457600080fd5b8063beb08ab9116100f4578063beb08ab9146107b7578063bedecd4a146107ca578063c68a1014146107df578063cbe274d1146107f257600080fd5b8063aff01b6114610784578063b33712c514610794578063b4a0502f1461079c578063b8f6a04a146107af57600080fd5b806398a389b41161019d578063a5c4d1a41161016c578063a5c4d1a414610755578063a5c90c3a14610768578063a9b82bd414610771578063ac6ddd5d1461062957600080fd5b806398a389b41461070b5780639d76ea5814610732578063a217fddf14610745578063a4d50f571461074d57600080fd5b806383273cd1116101d957806383273cd1146106d457806386d1a69f146106dd5780638ac33be9146106e557806391d14854146106f857600080fd5b80635c975abb146106a257806361a52a36146106b357806368f113eb146106bd5780636fa6316c146106cb57600080fd5b806336b19cd7116102fa578063462ebf441161028d57806355c17ed11161025c57806355c17ed11461065957806355ddce451461066c57806359303ed8146106765780635a0d73aa1461067e57600080fd5b8063462ebf44146106145780634bf4e25e146106295780634ca800d0146106315780634ef7086b1461064457600080fd5b80633b9e916f116102c95780633b9e916f146105d1578063410085df146105e65780634229613d146105f9578063439766ce1461060c57600080fd5b806336b19cd7146105815780633a05f0d8146105a65780633b3f6296146105be5780633b97e856146105c857600080fd5b80631a5c95dd116103725780632f2ff15d116103415780632f2ff15d1461053557806331a2250c14610548578063350829331461055b57806336568abe1461056e57600080fd5b80631a5c95dd146104a7578063248a9ca3146104af57806326a1f5cc146104d35780632cf2dab2146104fa57600080fd5b806309b862b9116103ae57806309b862b91461044f5780630abeb2e6146104765780630ec7cfd51461048b57806311c05a221461049457600080fd5b806301ffc9a7146103e05780630239c7be1461040857806303b315e31461041b578063045ea76e1461042e575b600080fd5b6103f36103ee366004613c18565b6108bc565b60405190151581526020015b60405180910390f35b6103f3610416366004613c42565b6108e7565b6103f3610429366004613c80565b610a2b565b61044161043c366004613c80565b610aa6565b6040519081526020016103ff565b61045d632f80bacf60e21b81565b6040516001600160e01b031990911681526020016103ff565b610489610484366004613ce7565b610b89565b005b61044160095481565b6104896104a2366004613e5e565b611025565b6103f3611075565b6104416104bd366004613e93565b6000908152600160208190526040909120015490565b6104417f85485e0579110e3a8651ecc622c4a4de1af035fb88034e30905cf67a60881bfd81565b61050d610508366004613c80565b6110aa565b60408051948552921515602085015290151591830191909152151560608201526080016103ff565b610489610543366004613eac565b61113c565b610441610556366004613c80565b611167565b610489610569366004613c80565b611172565b61048961057c366004613eac565b611193565b6002546001600160a01b03165b6040516001600160a01b0390911681526020016103ff565b6105ae61120d565b6040516103ff9493929190613f13565b600a5415156103f3565b61044160055481565b6104416000805160206145dd83398151915281565b6103f36105f4366004613f60565b61142f565b610441610607366004613c80565b611613565b610489611657565b61044160008051602061463d83398151915281565b610441606481565b6103f361063f366004613e93565b61167a565b61044160008051602061461d83398151915281565b610441610667366004613c80565b61175d565b60035415156103f3565b6104896117b3565b600a54600b54600c54604080519384526020840192909252908201526060016103ff565b60005462010000900460ff166103f3565b6104416201518081565b6104896104a2366004613ffc565b61044160075481565b61044160085481565b610489611992565b6104416106f3366004613c80565b6119b1565b6103f3610706366004613eac565b611afc565b6104417f1cc585a35ee40bc8e30be46c66514537f1953ad0977428ef905e8e0df71a6ee781565b60045461058e906001600160a01b031681565b610441600081565b6103f3611b27565b6103f3610763366004613e93565b611b51565b61044160035481565b6103f361077f366004613c80565b611ba8565b61044168056bc75e2d6310000081565b610489611c1c565b6104416107aa366004613c80565b611c3c565b610441601281565b60115461058e906001600160a01b031681565b6104416000805160206145bd83398151915281565b6103f36107ed366004613e93565b611cf8565b61044160065481565b610489610809366004613eac565b611d78565b61048961081c3660046140d8565b611d9e565b61048961082f366004614118565b611e7e565b6104416000805160206145fd83398151915281565b610441610857366004613c80565b611f99565b6002546103f390600160a01b900460ff1681565b61048961087e366004613c80565b611fdd565b6103f3610891366004613c80565b612088565b7f7866924b44039f57cc7e434c06f38cc0a54edaa38ef5e1e10233e9acd30773cc610441565b60006001600160e01b0319821663a93f529b60e01b14806108e157506108e182612133565b92915050565b60006000805160206145dd83398151915261090181612168565b42841161094d5760405162461bcd60e51b81526020600482015260156024820152740564352503a2073746172742074696d657374616d7605c1b60448201526064015b60405180910390fd5b6000831161098e5760405162461bcd60e51b815260206004820152600e60248201526d2b21a9281d10323ab930ba34b7b760911b6044820152606401610944565b6003546109ad5760405162461bcd60e51b815260040161094490614178565b600060016109bb85876141c5565b6109c591906141d8565b90506109d081611cf8565b15610a165760405162461bcd60e51b81526020600482015260166024820152751590d4940e881cd8da19591d5b19481cdd185c9d195960521b6044820152606401610944565b610a208585612172565b506001949350505050565b60006001600160a01b038216610a535760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0382166000908152600f602052604090206001015462010000900460ff16610a945760405162461bcd60e51b815260040161094490614216565b6000610a9f83611613565b1192915050565b60006001600160a01b038216610ace5760405162461bcd60e51b81526004016109449061423d565b610ad742611cf8565b610b175760405162461bcd60e51b81526020600482015260116024820152701590d4940e881b9bdd081cdd185c9d1959607a1b6044820152606401610944565b610b2082612088565b15610b5d5760405162461bcd60e51b815260206004820152600d60248201526c1590d4940e881c995d9bdad959609a1b6044820152606401610944565b6000610b68836119b1565b90506000610b7584611613565b9050610b8181836141d8565b949350505050565b6000805160206145bd833981519152610ba181612168565b85610bdb5760405162461bcd60e51b815260206004820152600a6024820152695643523a20656d70747960b01b6044820152606401610944565b6064861115610c1e5760405162461bcd60e51b815260206004820152600f60248201526e0ac86a47440caf0c6cacac840dac2f608b1b6044820152606401610944565b838614610c6d5760405162461bcd60e51b815260206004820152601d60248201527f5643523a2070657263656e74206c656e67746820646966666572656e740000006044820152606401610944565b818614610cbc5760405162461bcd60e51b815260206004820152601e60248201527f5643523a206475726174696f6e206c656e67746820646966666572656e7400006044820152606401610944565b610cc542611cf8565b15610d095760405162461bcd60e51b81526020600482015260146024820152731590d48e88185b1c9958591e481cdd185c9d195960621b6044820152606401610944565b426000805b88811015610f88576000888883818110610d2a57610d2a614269565b9050602002013511610d725760405162461bcd60e51b81526020600482015260116024820152701590d48e881e995c9bc81c195c98d95b9d607a1b6044820152606401610944565b828a8a83818110610d8557610d85614269565b905060200201351015610dda5760405162461bcd60e51b815260206004820152601c60248201527f5643523a20696e76616c69642073746172742074696d657374616d70000000006044820152606401610944565b878782818110610dec57610dec614269565b9050602002013582610dfe91906141c5565b915068056bc75e2d63100000821115610e4c5760405162461bcd60e51b815260206004820152601060248201526f5643523a20657863656564203130302560801b6044820152606401610944565b6000868683818110610e6057610e60614269565b905060200201351115610ebe5762015180868683818110610e8357610e83614269565b90506020020135610e94919061427f565b8a8a83818110610ea657610ea6614269565b90506020020135610eb791906141c5565b9250610eda565b898982818110610ed057610ed0614269565b9050602002013592505b6040518060800160405280898984818110610ef757610ef7614269565b9050602002013581526020018b8b84818110610f1557610f15614269565b905060200201358152602001878784818110610f3357610f33614269565b6020908102929092013583525090810185905260008381526010825260409081902083518155918301516001830155820151600282015560609091015160039091015580610f8081614296565b915050610d0e565b5068056bc75e2d631000008114610fd15760405162461bcd60e51b815260206004820152600d60248201526c5643523a206e6f74203130302560981b6044820152606401610944565b600388905560405133907f0f1833d9024614968b40c7290fd02c4ec61b6b4167fdbe0bc3022aa6440e2d0b90611012908c908c908c908c908c908c906142e1565b60405180910390a2505050505050505050565b6000805160206145bd83398151915261103d81612168565b60405162461bcd60e51b8152602060048201526009602482015268564352503a206e2f6160b81b6044820152606401610944565b5050565b600a546000901580159061108a5750600c5415155b80156110985750600a544210155b80156110a55750600c5442105b905090565b60008080806001600160a01b0385166110d55760405162461bcd60e51b8152600401610944906141eb565b505050506001600160a01b03166000908152600f60209081526040918290208251608081018452815480825260019092015460ff80821615159483018590526101008204811615159583018690526201000090910416151560609091018190529093919291565b6000828152600160208190526040909120015461115881612168565b61116283836122ac565b505050565b60006108e182612317565b60008051602061463d83398151915261118a81612168565b61107182612432565b6001600160a01b03811633146112035760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610944565b61107182826124db565b60608060608060035467ffffffffffffffff81111561122e5761122e613d81565b604051908082528060200260200182016040528015611257578160200160208202803683370190505b50935060035467ffffffffffffffff81111561127557611275613d81565b60405190808252806020026020018201604052801561129e578160200160208202803683370190505b50925060035467ffffffffffffffff8111156112bc576112bc613d81565b6040519080825280602002602001820160405280156112e5578160200160208202803683370190505b50915060035467ffffffffffffffff81111561130357611303613d81565b60405190808252806020026020018201604052801561132c578160200160208202803683370190505b50600354909150156114295760005b60035481101561142757600081815260106020526040902060010154855186908390811061136b5761136b614269565b60200260200101818152505060106000828152602001908152602001600020600001548482815181106113a0576113a0614269565b60200260200101818152505060106000828152602001908152602001600020600201548382815181106113d5576113d5614269565b602002602001018181525050601060008281526020019081526020016000206003015482828151811061140a5761140a614269565b60209081029190910101528061141f81614296565b91505061133b565b505b90919293565b6000611439612542565b6000805160206145dd83398151915261145181612168565b6001600160a01b0384166114775760405162461bcd60e51b81526004016109449061423d565b600083116114c75760405162461bcd60e51b815260206004820152601860248201527f564352503a207a65726f20726566756e6420616d6f756e7400000000000000006044820152606401610944565b6011546000906114df906001600160a01b0316612317565b905060006114f86005548661259090919063ffffffff16565b905060006115116005548361262590919063ffffffff16565b9050600081116115575760405162461bcd60e51b81526020600482015260116024820152701590d4940e881e995c9bc8185b5bdd5b9d607a1b6044820152606401610944565b828111156115965760405162461bcd60e51b815260206004820152600c60248201526b1590d4940e88195e18d9595960a21b6044820152606401610944565b6011546115ac906001600160a01b0316826126ab565b866001600160a01b03167f4a38df4d86b2d93d9427931480e831f8dbede6c4d0fdc4490340fddc0c33627a826040516115e791815260200190565b60405180910390a2600454611606906001600160a01b031688846127a2565b5060019695505050505050565b60006001600160a01b03821661163b5760405162461bcd60e51b8152600401610944906141eb565b506001600160a01b03166000908152600e602052604090205490565b6000805160206145bd83398151915261166f81612168565b6116776127f4565b50565b60006000805160206145dd83398151915261169481612168565b600083116116d55760405162461bcd60e51b815260206004820152600e60248201526d2b21a9281d10323ab930ba34b7b760911b6044820152606401610944565b6003546116f45760405162461bcd60e51b815260040161094490614178565b600a54600061170385836141c5565b905061170e81611cf8565b156117545760405162461bcd60e51b81526020600482015260166024820152751590d4940e881cd8da19591d5b19481cdd185c9d195960521b6044820152606401610944565b610a2085612852565b60006001600160a01b0382166117855760405162461bcd60e51b8152600401610944906141eb565b61178e82612088565b1561179b57506000919050565b60006117a683611c3c565b90506000610b75846119b1565b6000805160206145bd8339815191526117cb81612168565b600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015611819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183d919061432a565b905060006118566005548361262590919063ffffffff16565b905060006006546007546009546008548561187191906141c5565b61187b91906141c5565b61188591906141c5565b61188f91906141d8565b9050600081116118e15760405162461bcd60e51b815260206004820152601860248201527f5643523a206e6f7468696e6720746f207472616e7366657200000000000000006044820152606401610944565b60006118f86005548361259090919063ffffffff16565b60085460095460075460065460408051888152602081018a9052908101949094526060840192909252608083015260a082015290915033907fa2233c5cbb0dc7c45a1a77e61670cd11eb315895207721ab0845d8977360f8999060c00160405180910390a26119856119726002546001600160a01b031690565b6004546001600160a01b031690836127a2565b5050505050565b50505050565b61199a612542565b60006119a533610aa6565b9050611677338261298d565b60006001600160a01b0382166119d95760405162461bcd60e51b8152600401610944906141eb565b6003541580611a1057506000805260106020527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb0254155b15611a1d57506000919050565b6000805260106020527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb0254421015611a5757506000919050565b611a6082612088565b15611a6e576108e182611613565b6000611a7983611c3c565b9050601060006001600354611a8e91906141d8565b8152602001908152602001600020600301544210611aac5792915050565b6000611ab742612ac6565b9050600068056bc75e2d63100000611acf838561427f565b611ad99190614343565b600554909150611af390611aed8382612590565b90612625565b95945050505050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006000805160206145dd833981519152611b4181612168565b611b49612bb6565b600191505090565b6000808211611b935760405162461bcd60e51b815260206004820152600e60248201526d05643523a2074696d657374616d760941b6044820152606401610944565b600a54158015906108e1575050600a54111590565b60006001600160a01b038216611bd05760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0382166000908152600f602052604090206001015462010000900460ff16611c115760405162461bcd60e51b815260040161094490614216565b6000610a9f83611f99565b6000805160206145bd833981519152611c3481612168565b611677612c9f565b60006001600160a01b038216611c645760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0382166000908152600f602090815260409182902082516080810184528154815260019091015460ff808216151593830193909352610100810483161515938201939093526201000090920416151560608201819052611cdd5760405162461bcd60e51b815260040161094490614216565b6000611ce884611f99565b8251909150610b819082906141d8565b6000808211611d3a5760405162461bcd60e51b815260206004820152600e60248201526d05643523a2074696d657374616d760941b6044820152606401610944565b60006003541180156108e15750506000805260106020527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb0254111590565b60008281526001602081905260409091200154611d9481612168565b61116283836124db565b6000805160206145bd833981519152611db681612168565b6001600160a01b038416611ddc5760405162461bcd60e51b81526004016109449061423d565b6011546001600160a01b03161580611e1557506011546001600160a01b038581169116148015611e155750600254600160a01b900460ff165b611e585760405162461bcd60e51b81526020600482015260146024820152731590d4940e881c1c9bda9958dd081dd85b1b195d60621b6044820152606401610944565b601180546001600160a01b0319166001600160a01b03861617905561198c848484612cda565b600054610100900460ff1615808015611e9e5750600054600160ff909116105b80611eb85750303b158015611eb8575060005460ff166001145b611f1b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610944565b6000805460ff191660011790558015611f3e576000805461ff0019166101001790555b611f4b86868686866131b1565b8015611f91576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b60006001600160a01b038216611fc15760405162461bcd60e51b8152600401610944906141eb565b506001600160a01b03166000908152600d602052604090205490565b6000805160206145bd833981519152611ff581612168565b6001600160a01b03821661201b5760405162461bcd60e51b81526004016109449061423d565b6011546001600160a01b0383811691161461206f5760405162461bcd60e51b81526020600482015260146024820152731590d4940e881c1c9bda9958dd081dd85b1b195d60621b6044820152606401610944565b601180546001600160a01b0319169055611071826131ed565b60006001600160a01b0382166120b05760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0382166000908152600f602090815260409182902082516080810184528154815260019091015460ff8082161515938301939093526101008104831615159382019390935262010000909204161515606082018190526121295760405162461bcd60e51b815260040161094490614216565b6040015192915050565b60006001600160e01b03198216637965db0b60e01b14806108e157506301ffc9a760e01b6001600160e01b03198316146108e1565b61167781336133e7565b600082116121b95760405162461bcd60e51b815260206004820152601460248201527305643523a2073746172742074696d657374616d760641b6044820152606401610944565b600081116121f95760405162461bcd60e51b815260206004820152600d60248201526c2b21a91d10323ab930ba34b7b760991b6044820152606401610944565b61220242611b51565b156122455760405162461bcd60e51b81526020600482015260136024820152721590d48e881c99599d5b99081cdd185c9d1959606a1b6044820152606401610944565b600061225182846141c5565b600a849055600b839055600c819055604080518581526020810185905290810182905290915033907f6a68d4baa763748fa290c1535788786f09660025e1dcf935f40d3be2701fd090906060015b60405180910390a2505050565b6122b68282611afc565b6110715760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b60006001600160a01b03821661233f5760405162461bcd60e51b81526004016109449061423d565b60035461235e5760405162461bcd60e51b815260040161094490614178565b61236782612088565b156123a45760405162461bcd60e51b815260206004820152600d60248201526c1590d4940e881c995d9bdad959609a1b6044820152606401610944565b6000806123b0846110aa565b935050509150806123f45760405162461bcd60e51b815260206004820152600e60248201526d564352503a20696e61637469766560901b6044820152606401610944565b6123fd42611cf8565b1561240c575060009392505050565b61241584611f99565b61241e85611613565b61242890846141d8565b610b8191906141d8565b6001600160a01b0381166124885760405162461bcd60e51b815260206004820152601760248201527f41646d696e57616c6c65743a206e65772077616c6c65740000000000000000006044820152606401610944565b600280546001600160a01b038381166001600160a01b031983168117909355604051911691339183907fe8e5de042e492b67e017467ab56c92b8389694c5418551fb8026282978ef881790600090a45050565b6124e58282611afc565b156110715760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60005462010000900460ff161561258e5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610944565b565b600060128211156125dd5760405162461bcd60e51b8152602060048201526017602482015276556e6974436f6e7665727465723a20646563696d616c7360481b6044820152606401610944565b6012821080156125ed5750600083115b1561261e5760006125ff8360126141d8565b905061260c81600a614449565b6126169085614343565b9150506108e1565b5090919050565b600060128211156126725760405162461bcd60e51b8152602060048201526017602482015276556e6974436f6e7665727465723a20646563696d616c7360481b6044820152606401610944565b6012821080156126825750600083115b1561261e5760006126948360126141d8565b90506126a181600a614449565b612616908561427f565b6001600160a01b0382166126d15760405162461bcd60e51b8152600401610944906141eb565b600081116127145760405162461bcd60e51b815260206004820152601060248201526f1590d48e881e995c9bc8185b5bdd5b9d60821b6044820152606401610944565b61271c611075565b6127585760405162461bcd60e51b815260206004820152600d60248201526c2b21a91d103737ba1037b832b760991b6044820152606401610944565b6001600160a01b0382166000908152600d6020526040812080548392906127809084906141c5565b92505081905550806007600082825461279991906141c5565b90915550505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611162908490613440565b6127fc612542565b6000805462ff00001916620100001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586128353390565b6040516001600160a01b03909116815260200160405180910390a1565b600081116128965760405162461bcd60e51b81526020600482015260116024820152702b21a91d103732bb90323ab930ba34b7b760791b6044820152606401610944565b61289e611075565b6128da5760405162461bcd60e51b815260206004820152600d60248201526c2b21a91d103737ba1037b832b760991b6044820152606401610944565b600c54600a546000906128ee9084906141c5565b90508181116129305760405162461bcd60e51b815260206004820152600e60248201526d1590d48e881d1bdbc81cda1bdc9d60921b6044820152606401610944565b600b805490849055600c82905560408051858152602081018490529081018290526060810184905233907ff363c0e368607bfecfd5e84a04bb5a9dc7e7396ba4fa56eb898ed47431f060ca9060800160405180910390a250505050565b6001600160a01b0382166129b35760405162461bcd60e51b8152600401610944906141eb565b600081116129f65760405162461bcd60e51b815260206004820152601060248201526f1590d48e881e995c9bc8185b5bdd5b9d60821b6044820152606401610944565b6000612a0d6005548361259090919063ffffffff16565b90506000612a266005548361262590919063ffffffff16565b6001600160a01b0385166000908152600e6020526040812080549293508392909190612a539084906141c5565b925050819055508060086000828254612a6c91906141c5565b90915550506040518181526001600160a01b038516907fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df931799060200160405180910390a260045461198c906001600160a01b031685846127a2565b6000805b600354811015612bb0576000818152601060205260409020600101548310612bb0576000818152601060205260409020600301548310612b2457600081815260106020526040902054612b1d90836141c5565b9150612b9e565b600081815260106020526040812060020154612b4490620151809061427f565b600083815260106020526040812080546001909101549293509091612b6990876141d8565b612b73919061427f565b90508181612b81828761427f565b612b8b91906141c5565b612b959190614343565b93505050612bb0565b80612ba881614296565b915050612aca565b50919050565b600a54612bf65760405162461bcd60e51b815260206004820152600e60248201526d1590d48e881b9bc81c99599d5b9960921b6044820152606401610944565b612bff42611b51565b15612c425760405162461bcd60e51b81526020600482015260136024820152721590d48e881c99599d5b99081cdd185c9d1959606a1b6044820152606401610944565b600a8054600b8054600c80546000958690559285905593909355604080518381526020810185905290810182905291929133907f2578378599211ea2e71b1efec8749db843a1063cbee11dd248425e39358c7c599060600161229f565b612ca7613515565b6000805462ff0000191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612835565b6001600160a01b038316612d005760405162461bcd60e51b8152600401610944906141eb565b60008211612d495760405162461bcd60e51b81526020600482015260166024820152751590d48e881e995c9bc819dc985b9d08185b5bdd5b9d60521b6044820152606401610944565b612d5242611cf8565b15612d965760405162461bcd60e51b81526020600482015260146024820152731590d48e88185b1c9958591e481cdd185c9d195960621b6044820152606401610944565b6001600160a01b0383166000908152600f602090815260409182902082516080810184528154815260019091015460ff8082161515938301939093526101008104831615159382019390935262010000909204811615156060830152600254600160a01b90041680612e0a57508060600151155b612e4b5760405162461bcd60e51b81526020600482015260126024820152711590d48e88185b1c9958591e48185919195960721b6044820152606401610944565b80606001511580612e625750612e6084612088565b155b612ea55760405162461bcd60e51b81526020600482015260146024820152731590d48e88185b1c9958591e481c995d9bdad95960621b6044820152606401610944565b600554600090612eb990611aed8682612590565b905060008111612f0b5760405162461bcd60e51b815260206004820152601f60248201527f5643523a207a65726f20646563696d616c73206772616e7420616d6f756e74006044820152606401610944565b8060066000828254612f1d91906141c5565b9091555050600480546040516370a0823160e01b815230928101929092526000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015612f70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f94919061432a565b905060008111612fda5760405162461bcd60e51b81526020600482015260116024820152705643523a207a65726f2062616c616e636560781b6044820152606401610944565b6000612ff16005548361262590919063ffffffff16565b905060006007546009546008548461300991906141c5565b61301391906141c5565b61301d91906141c5565b90506006548110156130715760405162461bcd60e51b815260206004820152601c60248201527f5643523a20746f74616c206772616e74203e2072656d61696e646572000000006044820152606401610944565b8460600151156130a65784516130889085906141c5565b6001600160a01b0389166000908152600f6020526040902055613162565b6040518060800160405280858152602001871515815260200160001515815260200160011515815250600f60008a6001600160a01b03166001600160a01b031681526020019081526020016000206000820151816000015560208201518160010160006101000a81548160ff02191690831515021790555060408201518160010160016101000a81548160ff02191690831515021790555060608201518160010160026101000a81548160ff0219169083151502179055509050505b6040805185815287151560208201526001600160a01b038a16917f4e623b5b8a8f6ed80fac7bdb7744dcf9e24e56e76819aebd9c0321ba115d2466910160405180910390a25050505050505050565b600054610100900460ff166131d85760405162461bcd60e51b815260040161094490614455565b6131e58585858585613564565b611985613841565b6001600160a01b0381166132135760405162461bcd60e51b8152600401610944906141eb565b6001600160a01b0381166000908152600f602090815260409182902082516080810184528154815260019091015460ff80821615159383019390935261010081048316151593820193909352620100009092041615156060820181905261328c5760405162461bcd60e51b815260040161094490614216565b80602001516132d25760405162461bcd60e51b81526020600482015260126024820152715643523a206e6f74207265766f6361626c6560701b6044820152606401610944565b6132db82612088565b1561331f5760405162461bcd60e51b81526020600482015260146024820152731590d48e88185b1c9958591e481c995d9bdad95960621b6044820152606401610944565b600061332a83611f99565b9050600061333784611613565b905060008183856000015161334c91906141d8565b61335691906141d8565b9050806009600082825461336a91906141c5565b90915550506001600160a01b0385166000818152600f6020908152604091829020600101805461ff0019166101001790558651825185815291820152908101859052606081018490527fd0aca067c29f1954ddc14148bbc33e72e72c378848d1234b94adb235b87f9e0c9060800160405180910390a25050505050565b6133f18282611afc565b611071576133fe8161388e565b6134098360206138a0565b60405160200161341a9291906144c4565b60408051601f198184030181529082905262461bcd60e51b825261094491600401614539565b6000613495826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a439092919063ffffffff16565b90508051600014806134b65750808060200190518101906134b6919061456c565b6111625760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610944565b60005462010000900460ff1661258e5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610944565b600054610100900460ff1661358b5760405162461bcd60e51b815260040161094490614455565b6001600160a01b0385166135d65760405162461bcd60e51b81526020600482015260126024820152715643523a20746f6b656e206164647265737360701b6044820152606401610944565b601284111561361d5760405162461bcd60e51b81526020600482015260136024820152725643523a20746f6b656e20646563696d616c7360681b6044820152606401610944565b6001600160a01b03821661366b5760405162461bcd60e51b81526020600482015260156024820152742b21a91d103130b1b5b7b33334b1b29030b236b4b760591b6044820152606401610944565b6001600160a01b0381166136b55760405162461bcd60e51b81526020600482015260116024820152702b21a91d103a32b730b73a1030b236b4b760791b6044820152606401610944565b6136cd60008051602061461d83398151915280613a52565b6137057f1cc585a35ee40bc8e30be46c66514537f1953ad0977428ef905e8e0df71a6ee760008051602061461d833981519152613a52565b61371d6000805160206145fd83398151915280613a52565b61374360008051602061463d8339815191526000805160206145fd833981519152613a52565b6137696000805160206145bd8339815191526000805160206145fd833981519152613a52565b61378160008051602061461d833981519152836122ac565b6137ab7f1cc585a35ee40bc8e30be46c66514537f1953ad0977428ef905e8e0df71a6ee7836122ac565b6137c36000805160206145fd833981519152826122ac565b6137db60008051602061463d833981519152826122ac565b6137f36000805160206145bd833981519152826122ac565b6137fc81612432565b5050600480546001600160a01b039094166001600160a01b03199094169390931790925560055560028054911515600160a01b0260ff60a01b19909216919091179055565b600054610100900460ff166138685760405162461bcd60e51b815260040161094490614455565b61258e6000805160206145dd83398151915260008051602061461d833981519152613a52565b60606108e16001600160a01b03831660145b606060006138af83600261427f565b6138ba9060026141c5565b67ffffffffffffffff8111156138d2576138d2613d81565b6040519080825280601f01601f1916602001820160405280156138fc576020820181803683370190505b509050600360fc1b8160008151811061391757613917614269565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061394657613946614269565b60200101906001600160f81b031916908160001a905350600061396a84600261427f565b6139759060016141c5565b90505b60018111156139ed576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106139a9576139a9614269565b1a60f81b8282815181106139bf576139bf614269565b60200101906001600160f81b031916908160001a90535060049490941c936139e681614589565b9050613978565b508315613a3c5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610944565b9392505050565b6060610b818484600085613a9f565b6000828152600160208190526040808320909101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b606082471015613b005760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610944565b600080866001600160a01b03168587604051613b1c91906145a0565b60006040518083038185875af1925050503d8060008114613b59576040519150601f19603f3d011682016040523d82523d6000602084013e613b5e565b606091505b5091509150613b6f87838387613b7a565b979650505050505050565b60608315613be9578251600003613be2576001600160a01b0385163b613be25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610944565b5081610b81565b610b818383815115613bfe5781518083602001fd5b8060405162461bcd60e51b81526004016109449190614539565b600060208284031215613c2a57600080fd5b81356001600160e01b031981168114613a3c57600080fd5b60008060408385031215613c5557600080fd5b50508035926020909101359150565b80356001600160a01b0381168114613c7b57600080fd5b919050565b600060208284031215613c9257600080fd5b613a3c82613c64565b60008083601f840112613cad57600080fd5b50813567ffffffffffffffff811115613cc557600080fd5b6020830191508360208260051b8501011115613ce057600080fd5b9250929050565b60008060008060008060608789031215613d0057600080fd5b863567ffffffffffffffff80821115613d1857600080fd5b613d248a838b01613c9b565b90985096506020890135915080821115613d3d57600080fd5b613d498a838b01613c9b565b90965094506040890135915080821115613d6257600080fd5b50613d6f89828a01613c9b565b979a9699509497509295939492505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613dc057613dc0613d81565b604052919050565b600067ffffffffffffffff821115613de257613de2613d81565b5060051b60200190565b600082601f830112613dfd57600080fd5b81356020613e12613e0d83613dc8565b613d97565b82815260059290921b84018101918181019086841115613e3157600080fd5b8286015b84811015613e5357613e4681613c64565b8352918301918301613e35565b509695505050505050565b600060208284031215613e7057600080fd5b813567ffffffffffffffff811115613e8757600080fd5b610b8184828501613dec565b600060208284031215613ea557600080fd5b5035919050565b60008060408385031215613ebf57600080fd5b82359150613ecf60208401613c64565b90509250929050565b600081518084526020808501945080840160005b83811015613f0857815187529582019590820190600101613eec565b509495945050505050565b608081526000613f266080830187613ed8565b8281036020840152613f388187613ed8565b90508281036040840152613f4c8186613ed8565b90508281036060840152613b6f8185613ed8565b60008060408385031215613f7357600080fd5b613f7c83613c64565b946020939093013593505050565b801515811461167757600080fd5b600082601f830112613fa957600080fd5b81356020613fb9613e0d83613dc8565b82815260059290921b84018101918181019086841115613fd857600080fd5b8286015b84811015613e53578035613fef81613f8a565b8352918301918301613fdc565b60008060006060848603121561401157600080fd5b833567ffffffffffffffff8082111561402957600080fd5b61403587838801613dec565b945060209150818601358181111561404c57600080fd5b8601601f8101881361405d57600080fd5b803561406b613e0d82613dc8565b81815260059190911b8201840190848101908a83111561408a57600080fd5b928501925b828410156140a85783358252928501929085019061408f565b965050505060408601359150808211156140c157600080fd5b506140ce86828701613f98565b9150509250925092565b6000806000606084860312156140ed57600080fd5b6140f684613c64565b925060208401359150604084013561410d81613f8a565b809150509250925092565b600080600080600060a0868803121561413057600080fd5b61413986613c64565b945060208601359350604086013561415081613f8a565b925061415e60608701613c64565b915061416c60808701613c64565b90509295509295909350565b60208082526018908201527f564352503a20756e646566696e6564207363686564756c650000000000000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b808201808211156108e1576108e16141af565b818103818111156108e1576108e16141af565b6020808252601190820152701590d48e881e995c9bc81858d8dbdd5b9d607a1b604082015260600190565b6020808252600d908201526c5643523a20696e61637469766560981b604082015260600190565b6020808252601290820152711590d4940e881e995c9bc81858d8dbdd5b9d60721b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b80820281158282048414176108e1576108e16141af565b6000600182016142a8576142a86141af565b5060010190565b81835260006001600160fb1b038311156142c857600080fd5b8260051b80836020870137939093016020019392505050565b6060815260006142f560608301888a6142af565b82810360208401526143088187896142af565b9050828103604084015261431d8185876142af565b9998505050505050505050565b60006020828403121561433c57600080fd5b5051919050565b60008261436057634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156143a0578160001904821115614386576143866141af565b8085161561439357918102915b93841c939080029061436a565b509250929050565b6000826143b7575060016108e1565b816143c4575060006108e1565b81600181146143da57600281146143e457614400565b60019150506108e1565b60ff8411156143f5576143f56141af565b50506001821b6108e1565b5060208310610133831016604e8410600b8410161715614423575081810a6108e1565b61442d8383614365565b8060001904821115614441576144416141af565b029392505050565b6000613a3c83836143a8565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b838110156144bb5781810151838201526020016144a3565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516144fc8160178501602088016144a0565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161452d8160288401602088016144a0565b01602801949350505050565b60208152600082518060208401526145588160408501602087016144a0565b601f01601f19169190910160400192915050565b60006020828403121561457e57600080fd5b8151613a3c81613f8a565b600081614598576145986141af565b506000190190565b600082516145b28184602087016144a0565b919091019291505056fe52bbfa6e876ba7eadc80dc9b099c193c6daea0056635c463ce4d9723fa6d7733212a403a90eb28e41316223c150d4fd70813f6190caa207ae2a42a13777b29ef07258f049a6ded7f9eee4348cd5f072dca4852fa78e9604f2468ddeaa723e588b58f543c34fc3c79e1c358174f46808f77878cdc5ca730c4617cdbe574382eb696569a1fadb2d4dcc763ecf02934e5ddc4e41d9d5f44b6b99af57748b38b5058a26469706673582212204be8b2ee4e1ba87dde88dbd0569ab4d190bafebca71b46d34382533aede83d1d64736f6c63430008130033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 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.