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 | 19017605 | 183 days ago | IN | Create: Sales | 0 ETH | 0.02995639 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
Sales
Compiler Version
v0.8.12+commit.f00d7308
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "./ISales.sol"; contract Sales is ContextUpgradeable, OwnableUpgradeable, ReentrancyGuardUpgradeable, AccessControlUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; bytes32 public constant CALLER_ROLE = keccak256("CALLER_ROLE"); IERC20Upgradeable public tube2Token; IERC20Upgradeable public eTubesToken; //shadow address[] private beneficiaries; uint256 public totalQuota; //ETUBES(ERC-20) stock uint256 public totalMinted; //ETUBES(ERC-20) stock uint256 public allOrderId; uint256 public rate; // 1 tube2 = 10 ETUBES(ERC-20) mapping(address => uint256[]) public userOrders; mapping(uint256 => Order) public allOrders; event BuyTube( address owner, uint256 orderId, uint256 orderDate, uint256 tube2Amount, uint256 amount, //(ETUBES ERC20 amt) address beneficiaryAddr ); modifier onlyValidCaller() { require( hasRole(CALLER_ROLE, msg.sender) || owner() == msg.sender, "Caller is not valid" ); _; } function initialize( address _tube2Token, address _etubes ) public initializer { __Ownable_init(); __ReentrancyGuard_init(); __AccessControl_init(); tube2Token = IERC20Upgradeable(_tube2Token); eTubesToken = IERC20Upgradeable(_etubes); rate = 10; } function setCaller(address addr) public onlyOwner { _setupRole(CALLER_ROLE, addr); } function updateRate(uint256 newRate) public onlyOwner { require(newRate > 0, "New rate cannot be 0"); rate = newRate; } function addBeneficiary(address _beneficiary) public onlyOwner { require(_beneficiary != address(0), "Invalid Beneficiary"); beneficiaries.push(_beneficiary); } function getBeneficiaries() public view onlyOwner returns (address[] memory) { return beneficiaries; } function addQuota(uint256 _quota) public onlyOwner { //reminder to also transfer etubes to address(this) from owner require(_quota > 0, "New quota cannot be 0"); totalQuota += _quota; } function getUserOrderIds( address addr ) public view returns (uint256[] memory _orderIds) { _orderIds = userOrders[addr]; } //============================== // SALES //============================== function buyTube(uint256 _tube2Amt) public { uint256 tubesAmt = _tube2Amt * rate; // ERC20 uint256 tube2InEther = _tube2Amt / 1 ether; require(tube2InEther % 100 == 0, "Invalid Buy Amount"); require(tubesAmt + totalMinted <= totalQuota, "Out of quota"); require(beneficiaries.length > 0, "Beneficiary empty"); require( eTubesToken.balanceOf(address(this)) >= tubesAmt, "Insufficient balance" ); allOrderId++; //starts with 1 uint256 beneficiaryIndex = (allOrderId - 1) % beneficiaries.length; address beneficiaryAddr = beneficiaries[beneficiaryIndex]; //add new order Order memory newOrder; newOrder.owner = msg.sender; newOrder.beneficiaryAddr = beneficiaryAddr; newOrder.orderDate = block.timestamp; newOrder.tube2Amount = _tube2Amt; newOrder.amount = tubesAmt; newOrder.orderId = allOrderId; allOrders[allOrderId] = newOrder; //order struct new order userOrders[msg.sender].push(allOrderId); totalMinted += tubesAmt; tube2Token.safeTransferFrom(msg.sender, beneficiaryAddr, _tube2Amt); eTubesToken.transfer(msg.sender, tubesAmt); emit BuyTube( msg.sender, allOrderId, block.timestamp, _tube2Amt, tubesAmt, beneficiaryAddr ); } //============================== // Maintenance / 1-time //============================== function resetMinted() public onlyOwner { totalMinted = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } 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(IAccessControlUpgradeable).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 ", StringsUpgradeable.toHexString(account), " is missing role ", StringsUpgradeable.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()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// 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 IAccessControlUpgradeable { /** * @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) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.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) || (!AddressUpgradeable.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.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// 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 IERC20Upgradeable { /** * @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/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 IERC20PermitUpgradeable { /** * @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.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable { using AddressUpgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20Upgradeable 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( IERC20PermitUpgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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))) && AddressUpgradeable.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 AddressUpgradeable { /** * @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; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; import "./math/SignedMathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { 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 = MathUpgradeable.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(SignedMathUpgradeable.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, MathUpgradeable.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// 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 IERC165Upgradeable { /** * @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 MathUpgradeable { 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 SignedMathUpgradeable { /** * @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 pragma solidity ^0.8.7; struct Order { address owner; address beneficiaryAddr; uint256 orderId; uint256 orderDate; uint256 tube2Amount; uint256 amount; } interface ISales {}
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"orderId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"orderDate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tube2Amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"beneficiaryAddr","type":"address"}],"name":"BuyTube","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"CALLER_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":[{"internalType":"address","name":"_beneficiary","type":"address"}],"name":"addBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quota","type":"uint256"}],"name":"addQuota","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allOrderId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allOrders","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"beneficiaryAddr","type":"address"},{"internalType":"uint256","name":"orderId","type":"uint256"},{"internalType":"uint256","name":"orderDate","type":"uint256"},{"internalType":"uint256","name":"tube2Amount","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tube2Amt","type":"uint256"}],"name":"buyTube","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eTubesToken","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBeneficiaries","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getUserOrderIds","outputs":[{"internalType":"uint256[]","name":"_orderIds","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tube2Token","type":"address"},{"internalType":"address","name":"_etubes","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetMinted","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":"addr","type":"address"}],"name":"setCaller","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":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalQuota","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tube2Token","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"updateRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userOrders","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506119a8806100206000396000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c8063856652e9116100f9578063a2309ff811610097578063d547741f11610071578063d547741f146103ab578063eb5945e4146103be578063ec641a1d14610447578063f2fde38b1461046757600080fd5b8063a2309ff81461037c578063ae5fee6414610385578063beb92f551461039857600080fd5b80638da5cb5b116100d35780638da5cb5b1461033b578063913b722c1461034c57806391d1485414610361578063a217fddf1461037457600080fd5b8063856652e914610317578063871fb2f91461032a5780638adaee581461033257600080fd5b80634cebcb311161016657806369ea17711161014057806369ea1771146102cb578063715018a6146102de57806371f3402d146102e6578063774237fc146102f057600080fd5b80634cebcb311461027a5780635926651d146102a55780635d051853146102b857600080fd5b80632c4e722e116101a25780632c4e722e146102375780632f2ff15d1461024157806336568abe14610254578063485cc9551461026757600080fd5b806301ffc9a7146101c95780630d38302e146101f1578063248a9ca314610206575b600080fd5b6101dc6101d736600461157d565b61047a565b60405190151581526020015b60405180910390f35b6102046101ff3660046115a7565b6104b1565b005b6102296102143660046115a7565b600090815260c9602052604090206001015490565b6040519081526020016101e8565b6102296101015481565b61020461024f3660046115dc565b610520565b6102046102623660046115dc565b61054a565b610204610275366004611608565b6105c8565b60fc5461028d906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b6102046102b3366004611632565b610720565b60fb5461028d906001600160a01b031681565b6102046102d93660046115a7565b6107c6565b61020461081b565b6102296101005481565b6102297f843c3a00fa95510a35f425371231fd3fe4642e719cb4595160763d6d02594b5081565b61022961032536600461164d565b61082f565b610204610861565b61022960fe5481565b6033546001600160a01b031661028d565b610354610870565b6040516101e89190611677565b6101dc61036f3660046115dc565b6108da565b610229600081565b61022960ff5481565b6102046103933660046115a7565b610905565b6102046103a6366004611632565b610ce0565b6102046103b93660046115dc565b610d15565b61040f6103cc3660046115a7565b610103602052600090815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039485169593909416939192909186565b604080516001600160a01b039788168152969095166020870152938501929092526060840152608083015260a082015260c0016101e8565b61045a610455366004611632565b610d3a565b6040516101e891906116c4565b610204610475366004611632565b610da7565b60006001600160e01b03198216637965db0b60e01b14806104ab57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6104b9610e1d565b600081116105065760405162461bcd60e51b815260206004820152601560248201527404e65772071756f74612063616e6e6f74206265203605c1b60448201526064015b60405180910390fd5b8060fe60008282546105189190611712565b909155505050565b600082815260c9602052604090206001015461053b81610e77565b6105458383610e81565b505050565b6001600160a01b03811633146105ba5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016104fd565b6105c48282610f07565b5050565b600054610100900460ff16158080156105e85750600054600160ff909116105b806106025750303b158015610602575060005460ff166001145b6106655760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104fd565b6000805460ff191660011790558015610688576000805461ff0019166101001790555b610690610f6e565b610698610f9d565b6106a0610fcc565b60fb80546001600160a01b038086166001600160a01b03199283161790925560fc805492851692909116919091179055600a610101558015610545576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b610728610e1d565b6001600160a01b0381166107745760405162461bcd60e51b8152602060048201526013602482015272496e76616c69642042656e656669636961727960681b60448201526064016104fd565b60fd80546001810182556000919091527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800180546001600160a01b0319166001600160a01b0392909216919091179055565b6107ce610e1d565b600081116108155760405162461bcd60e51b815260206004820152601460248201527304e657720726174652063616e6e6f7420626520360641b60448201526064016104fd565b61010155565b610823610e1d565b61082d6000610ff3565b565b610102602052816000526040600020818154811061084c57600080fd5b90600052602060002001600091509150505481565b610869610e1d565b600060ff55565b606061087a610e1d565b60fd8054806020026020016040519081016040528092919081815260200182805480156108d057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116108b2575b5050505050905090565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006101015482610916919061172a565b9050600061092c670de0b6b3a76400008461175f565b9050610939606482611773565b1561097b5760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a5908109d5e48105b5bdd5b9d60721b60448201526064016104fd565b60fe5460ff5461098b9084611712565b11156109c85760405162461bcd60e51b815260206004820152600c60248201526b4f7574206f662071756f746160a01b60448201526064016104fd565b60fd54610a0b5760405162461bcd60e51b815260206004820152601160248201527042656e656669636961727920656d70747960781b60448201526064016104fd565b60fc546040516370a0823160e01b815230600482015283916001600160a01b0316906370a0823190602401602060405180830381865afa158015610a53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a779190611787565b1015610abc5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b60448201526064016104fd565b6101008054906000610acd836117a0565b909155505060fd546101005460009190610ae9906001906117bb565b610af39190611773565b9050600060fd8281548110610b0a57610b0a6117d2565b6000918252602080832091909101546040805160c081018252338082526001600160a01b039384168286018181524260608501908152608085018e815260a086018e81526101008054888a01818152908d526101038c52898d2089518154908d166001600160a01b031991821617825596516001808301805492909e169190981617909b555160028b0155925160038a0155905160048901555160059097019690965591875261010286529286209354845491820185559386529385209093019190915560ff80549194509192879291610be5908490611712565b909155505060fb54610c02906001600160a01b0316338489611045565b60fc5460405163a9059cbb60e01b8152336004820152602481018790526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610c53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7791906117e8565b5061010054604080513381526020810192909252428282015260608201889052608082018790526001600160a01b03841660a0830152517f2e2b34cc95d82311e3c19fe33b50a176f388c7c6b1cd122e8dffec13765fd6169181900360c00190a1505050505050565b610ce8610e1d565b610d127f843c3a00fa95510a35f425371231fd3fe4642e719cb4595160763d6d02594b50826110a5565b50565b600082815260c96020526040902060010154610d3081610e77565b6105458383610f07565b6001600160a01b03811660009081526101026020908152604091829020805483518184028101840190945280845260609392830182828015610d9b57602002820191906000526020600020905b815481526020019060010190808311610d87575b50505050509050919050565b610daf610e1d565b6001600160a01b038116610e145760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fd565b610d1281610ff3565b6033546001600160a01b0316331461082d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104fd565b610d1281336110af565b610e8b82826108da565b6105c457600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610ec33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610f1182826108da565b156105c457600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff16610f955760405162461bcd60e51b81526004016104fd9061180a565b61082d611108565b600054610100900460ff16610fc45760405162461bcd60e51b81526004016104fd9061180a565b61082d611138565b600054610100900460ff1661082d5760405162461bcd60e51b81526004016104fd9061180a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261109f908590611166565b50505050565b6105c48282610e81565b6110b982826108da565b6105c4576110c68161123b565b6110d183602061124d565b6040516020016110e2929190611881565b60408051601f198184030181529082905262461bcd60e51b82526104fd916004016118f6565b600054610100900460ff1661112f5760405162461bcd60e51b81526004016104fd9061180a565b61082d33610ff3565b600054610100900460ff1661115f5760405162461bcd60e51b81526004016104fd9061180a565b6001606555565b60006111bb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113f09092919063ffffffff16565b90508051600014806111dc5750808060200190518101906111dc91906117e8565b6105455760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104fd565b60606104ab6001600160a01b03831660145b6060600061125c83600261172a565b611267906002611712565b67ffffffffffffffff81111561127f5761127f611929565b6040519080825280601f01601f1916602001820160405280156112a9576020820181803683370190505b509050600360fc1b816000815181106112c4576112c46117d2565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106112f3576112f36117d2565b60200101906001600160f81b031916908160001a905350600061131784600261172a565b611322906001611712565b90505b600181111561139a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611356576113566117d2565b1a60f81b82828151811061136c5761136c6117d2565b60200101906001600160f81b031916908160001a90535060049490941c936113938161193f565b9050611325565b5083156113e95760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104fd565b9392505050565b60606113ff8484600085611407565b949350505050565b6060824710156114685760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016104fd565b600080866001600160a01b031685876040516114849190611956565b60006040518083038185875af1925050503d80600081146114c1576040519150601f19603f3d011682016040523d82523d6000602084013e6114c6565b606091505b50915091506114d7878383876114e2565b979650505050505050565b6060831561154e578251611547576001600160a01b0385163b6115475760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104fd565b50816113ff565b6113ff83838151156115635781518083602001fd5b8060405162461bcd60e51b81526004016104fd91906118f6565b60006020828403121561158f57600080fd5b81356001600160e01b0319811681146113e957600080fd5b6000602082840312156115b957600080fd5b5035919050565b80356001600160a01b03811681146115d757600080fd5b919050565b600080604083850312156115ef57600080fd5b823591506115ff602084016115c0565b90509250929050565b6000806040838503121561161b57600080fd5b611624836115c0565b91506115ff602084016115c0565b60006020828403121561164457600080fd5b6113e9826115c0565b6000806040838503121561166057600080fd5b611669836115c0565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b818110156116b85783516001600160a01b031683529284019291840191600101611693565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156116b8578351835292840192918401916001016116e0565b634e487b7160e01b600052601160045260246000fd5b60008219821115611725576117256116fc565b500190565b6000816000190483118215151615611744576117446116fc565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261176e5761176e611749565b500490565b60008261178257611782611749565b500690565b60006020828403121561179957600080fd5b5051919050565b60006000198214156117b4576117b46116fc565b5060010190565b6000828210156117cd576117cd6116fc565b500390565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156117fa57600080fd5b815180151581146113e957600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015611870578181015183820152602001611858565b8381111561109f5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516118b9816017850160208801611855565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516118ea816028840160208801611855565b01602801949350505050565b6020815260008251806020840152611915816040850160208701611855565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b60008161194e5761194e6116fc565b506000190190565b60008251611968818460208701611855565b919091019291505056fea2646970667358221220abfb2130237848c09ccf74cad00671a591c67475b175dc1933ff213550cc48e664736f6c634300080c0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c8063856652e9116100f9578063a2309ff811610097578063d547741f11610071578063d547741f146103ab578063eb5945e4146103be578063ec641a1d14610447578063f2fde38b1461046757600080fd5b8063a2309ff81461037c578063ae5fee6414610385578063beb92f551461039857600080fd5b80638da5cb5b116100d35780638da5cb5b1461033b578063913b722c1461034c57806391d1485414610361578063a217fddf1461037457600080fd5b8063856652e914610317578063871fb2f91461032a5780638adaee581461033257600080fd5b80634cebcb311161016657806369ea17711161014057806369ea1771146102cb578063715018a6146102de57806371f3402d146102e6578063774237fc146102f057600080fd5b80634cebcb311461027a5780635926651d146102a55780635d051853146102b857600080fd5b80632c4e722e116101a25780632c4e722e146102375780632f2ff15d1461024157806336568abe14610254578063485cc9551461026757600080fd5b806301ffc9a7146101c95780630d38302e146101f1578063248a9ca314610206575b600080fd5b6101dc6101d736600461157d565b61047a565b60405190151581526020015b60405180910390f35b6102046101ff3660046115a7565b6104b1565b005b6102296102143660046115a7565b600090815260c9602052604090206001015490565b6040519081526020016101e8565b6102296101015481565b61020461024f3660046115dc565b610520565b6102046102623660046115dc565b61054a565b610204610275366004611608565b6105c8565b60fc5461028d906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b6102046102b3366004611632565b610720565b60fb5461028d906001600160a01b031681565b6102046102d93660046115a7565b6107c6565b61020461081b565b6102296101005481565b6102297f843c3a00fa95510a35f425371231fd3fe4642e719cb4595160763d6d02594b5081565b61022961032536600461164d565b61082f565b610204610861565b61022960fe5481565b6033546001600160a01b031661028d565b610354610870565b6040516101e89190611677565b6101dc61036f3660046115dc565b6108da565b610229600081565b61022960ff5481565b6102046103933660046115a7565b610905565b6102046103a6366004611632565b610ce0565b6102046103b93660046115dc565b610d15565b61040f6103cc3660046115a7565b610103602052600090815260409020805460018201546002830154600384015460048501546005909501546001600160a01b039485169593909416939192909186565b604080516001600160a01b039788168152969095166020870152938501929092526060840152608083015260a082015260c0016101e8565b61045a610455366004611632565b610d3a565b6040516101e891906116c4565b610204610475366004611632565b610da7565b60006001600160e01b03198216637965db0b60e01b14806104ab57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6104b9610e1d565b600081116105065760405162461bcd60e51b815260206004820152601560248201527404e65772071756f74612063616e6e6f74206265203605c1b60448201526064015b60405180910390fd5b8060fe60008282546105189190611712565b909155505050565b600082815260c9602052604090206001015461053b81610e77565b6105458383610e81565b505050565b6001600160a01b03811633146105ba5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016104fd565b6105c48282610f07565b5050565b600054610100900460ff16158080156105e85750600054600160ff909116105b806106025750303b158015610602575060005460ff166001145b6106655760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104fd565b6000805460ff191660011790558015610688576000805461ff0019166101001790555b610690610f6e565b610698610f9d565b6106a0610fcc565b60fb80546001600160a01b038086166001600160a01b03199283161790925560fc805492851692909116919091179055600a610101558015610545576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b610728610e1d565b6001600160a01b0381166107745760405162461bcd60e51b8152602060048201526013602482015272496e76616c69642042656e656669636961727960681b60448201526064016104fd565b60fd80546001810182556000919091527f9346ac6dd7de6b96975fec380d4d994c4c12e6a8897544f22915316cc6cca2800180546001600160a01b0319166001600160a01b0392909216919091179055565b6107ce610e1d565b600081116108155760405162461bcd60e51b815260206004820152601460248201527304e657720726174652063616e6e6f7420626520360641b60448201526064016104fd565b61010155565b610823610e1d565b61082d6000610ff3565b565b610102602052816000526040600020818154811061084c57600080fd5b90600052602060002001600091509150505481565b610869610e1d565b600060ff55565b606061087a610e1d565b60fd8054806020026020016040519081016040528092919081815260200182805480156108d057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116108b2575b5050505050905090565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60006101015482610916919061172a565b9050600061092c670de0b6b3a76400008461175f565b9050610939606482611773565b1561097b5760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a5908109d5e48105b5bdd5b9d60721b60448201526064016104fd565b60fe5460ff5461098b9084611712565b11156109c85760405162461bcd60e51b815260206004820152600c60248201526b4f7574206f662071756f746160a01b60448201526064016104fd565b60fd54610a0b5760405162461bcd60e51b815260206004820152601160248201527042656e656669636961727920656d70747960781b60448201526064016104fd565b60fc546040516370a0823160e01b815230600482015283916001600160a01b0316906370a0823190602401602060405180830381865afa158015610a53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a779190611787565b1015610abc5760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b60448201526064016104fd565b6101008054906000610acd836117a0565b909155505060fd546101005460009190610ae9906001906117bb565b610af39190611773565b9050600060fd8281548110610b0a57610b0a6117d2565b6000918252602080832091909101546040805160c081018252338082526001600160a01b039384168286018181524260608501908152608085018e815260a086018e81526101008054888a01818152908d526101038c52898d2089518154908d166001600160a01b031991821617825596516001808301805492909e169190981617909b555160028b0155925160038a0155905160048901555160059097019690965591875261010286529286209354845491820185559386529385209093019190915560ff80549194509192879291610be5908490611712565b909155505060fb54610c02906001600160a01b0316338489611045565b60fc5460405163a9059cbb60e01b8152336004820152602481018790526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610c53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7791906117e8565b5061010054604080513381526020810192909252428282015260608201889052608082018790526001600160a01b03841660a0830152517f2e2b34cc95d82311e3c19fe33b50a176f388c7c6b1cd122e8dffec13765fd6169181900360c00190a1505050505050565b610ce8610e1d565b610d127f843c3a00fa95510a35f425371231fd3fe4642e719cb4595160763d6d02594b50826110a5565b50565b600082815260c96020526040902060010154610d3081610e77565b6105458383610f07565b6001600160a01b03811660009081526101026020908152604091829020805483518184028101840190945280845260609392830182828015610d9b57602002820191906000526020600020905b815481526020019060010190808311610d87575b50505050509050919050565b610daf610e1d565b6001600160a01b038116610e145760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104fd565b610d1281610ff3565b6033546001600160a01b0316331461082d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104fd565b610d1281336110af565b610e8b82826108da565b6105c457600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610ec33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610f1182826108da565b156105c457600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff16610f955760405162461bcd60e51b81526004016104fd9061180a565b61082d611108565b600054610100900460ff16610fc45760405162461bcd60e51b81526004016104fd9061180a565b61082d611138565b600054610100900460ff1661082d5760405162461bcd60e51b81526004016104fd9061180a565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261109f908590611166565b50505050565b6105c48282610e81565b6110b982826108da565b6105c4576110c68161123b565b6110d183602061124d565b6040516020016110e2929190611881565b60408051601f198184030181529082905262461bcd60e51b82526104fd916004016118f6565b600054610100900460ff1661112f5760405162461bcd60e51b81526004016104fd9061180a565b61082d33610ff3565b600054610100900460ff1661115f5760405162461bcd60e51b81526004016104fd9061180a565b6001606555565b60006111bb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113f09092919063ffffffff16565b90508051600014806111dc5750808060200190518101906111dc91906117e8565b6105455760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104fd565b60606104ab6001600160a01b03831660145b6060600061125c83600261172a565b611267906002611712565b67ffffffffffffffff81111561127f5761127f611929565b6040519080825280601f01601f1916602001820160405280156112a9576020820181803683370190505b509050600360fc1b816000815181106112c4576112c46117d2565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106112f3576112f36117d2565b60200101906001600160f81b031916908160001a905350600061131784600261172a565b611322906001611712565b90505b600181111561139a576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611356576113566117d2565b1a60f81b82828151811061136c5761136c6117d2565b60200101906001600160f81b031916908160001a90535060049490941c936113938161193f565b9050611325565b5083156113e95760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104fd565b9392505050565b60606113ff8484600085611407565b949350505050565b6060824710156114685760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016104fd565b600080866001600160a01b031685876040516114849190611956565b60006040518083038185875af1925050503d80600081146114c1576040519150601f19603f3d011682016040523d82523d6000602084013e6114c6565b606091505b50915091506114d7878383876114e2565b979650505050505050565b6060831561154e578251611547576001600160a01b0385163b6115475760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104fd565b50816113ff565b6113ff83838151156115635781518083602001fd5b8060405162461bcd60e51b81526004016104fd91906118f6565b60006020828403121561158f57600080fd5b81356001600160e01b0319811681146113e957600080fd5b6000602082840312156115b957600080fd5b5035919050565b80356001600160a01b03811681146115d757600080fd5b919050565b600080604083850312156115ef57600080fd5b823591506115ff602084016115c0565b90509250929050565b6000806040838503121561161b57600080fd5b611624836115c0565b91506115ff602084016115c0565b60006020828403121561164457600080fd5b6113e9826115c0565b6000806040838503121561166057600080fd5b611669836115c0565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b818110156116b85783516001600160a01b031683529284019291840191600101611693565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156116b8578351835292840192918401916001016116e0565b634e487b7160e01b600052601160045260246000fd5b60008219821115611725576117256116fc565b500190565b6000816000190483118215151615611744576117446116fc565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261176e5761176e611749565b500490565b60008261178257611782611749565b500690565b60006020828403121561179957600080fd5b5051919050565b60006000198214156117b4576117b46116fc565b5060010190565b6000828210156117cd576117cd6116fc565b500390565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156117fa57600080fd5b815180151581146113e957600080fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015611870578181015183820152602001611858565b8381111561109f5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516118b9816017850160208801611855565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516118ea816028840160208801611855565b01602801949350505050565b6020815260008251806020840152611915816040850160208701611855565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b60008161194e5761194e6116fc565b506000190190565b60008251611968818460208701611855565b919091019291505056fea2646970667358221220abfb2130237848c09ccf74cad00671a591c67475b175dc1933ff213550cc48e664736f6c634300080c0033
Deployed Bytecode Sourcemap
497:4215:16:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3029:213:0;;;;;;:::i;:::-;;:::i;:::-;;;470:14:17;;463:22;445:41;;433:2;418:18;3029:213:0;;;;;;;;2560:217:16;;;;;;:::i;:::-;;:::i;:::-;;4834:129:0;;;;;;:::i;:::-;4908:7;4934:12;;;:6;:12;;;;;:22;;;;4834:129;;;;1013:25:17;;;1001:2;986:18;4834:129:0;867:177:17;1039:19:16;;;;;;5259:145:0;;;;;;:::i;:::-;;:::i;6368:214::-;;;;;;:::i;:::-;;:::i;1610:330:16:-;;;;;;:::i;:::-;;:::i;804:36::-;;;;;-1:-1:-1;;;;;804:36:16;;;;;;-1:-1:-1;;;;;2122:32:17;;;2104:51;;2092:2;2077:18;804:36:16;1933:228:17;2204:183:16;;;;;;:::i;:::-;;:::i;762:35::-;;;;;-1:-1:-1;;;;;762:35:16;;;2054:142;;;;;;:::i;:::-;;:::i;2064:101:2:-;;;:::i;1007:25:16:-;;;;;;691:62;;729:24;691:62;;1096:47;;;;;;:::i;:::-;;:::i;4635:74::-;;;:::i;896:25::-;;;;;;1441:85:2;1513:6;;-1:-1:-1;;;;;1513:6:2;1441:85;;2395:157:16;;;:::i;:::-;;;;;;;:::i;3329:145:0:-;;;;;;:::i;:::-;;:::i;2450:49::-;;2495:4;2450:49;;951:26:16;;;;;;3045:1473;;;;;;:::i;:::-;;:::i;1948:98::-;;;;;;:::i;:::-;;:::i;5684:147:0:-;;;;;;:::i;:::-;;:::i;1150:42:16:-;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1150:42:16;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3830:15:17;;;3812:34;;3882:15;;;;3877:2;3862:18;;3855:43;3914:18;;;3907:34;;;;3972:2;3957:18;;3950:34;4015:3;4000:19;;3993:35;3792:3;4044:19;;4037:35;3761:3;3746:19;1150:42:16;3487:591:17;2785:151:16;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;2314:198:2:-;;;;;;:::i;:::-;;:::i;3029:213:0:-;3114:4;-1:-1:-1;;;;;;3137:58:0;;-1:-1:-1;;;3137:58:0;;:98;;-1:-1:-1;;;;;;;;;;1168:51:11;;;3199:36:0;3130:105;3029:213;-1:-1:-1;;3029:213:0:o;2560:217:16:-;1334:13:2;:11;:13::i;:::-;2711:1:16::1;2702:6;:10;2694:44;;;::::0;-1:-1:-1;;;2694:44:16;;4922:2:17;2694:44:16::1;::::0;::::1;4904:21:17::0;4961:2;4941:18;;;4934:30;-1:-1:-1;;;4980:18:17;;;4973:51;5041:18;;2694:44:16::1;;;;;;;;;2763:6;2749:10;;:20;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;;;2560:217:16:o;5259:145:0:-;4908:7;4934:12;;;:6;:12;;;;;:22;;;2928:16;2939:4;2928:10;:16::i;:::-;5372:25:::1;5383:4;5389:7;5372:10;:25::i;:::-;5259:145:::0;;;:::o;6368:214::-;-1:-1:-1;;;;;6463:23:0;;929:10:9;6463:23:0;6455:83;;;;-1:-1:-1;;;6455:83:0;;5537:2:17;6455:83:0;;;5519:21:17;5576:2;5556:18;;;5549:30;5615:34;5595:18;;;5588:62;-1:-1:-1;;;5666:18:17;;;5659:45;5721:19;;6455:83:0;5335:411:17;6455:83:0;6549:26;6561:4;6567:7;6549:11;:26::i;:::-;6368:214;;:::o;1610:330:16:-;3279:19:3;3302:13;;;;;;3301:14;;3347:34;;;;-1:-1:-1;3365:12:3;;3380:1;3365:12;;;;:16;3347:34;3346:108;;;-1:-1:-1;3426:4:3;1713:19:8;:23;;;3387:66:3;;-1:-1:-1;3436:12:3;;;;;:17;3387:66;3325:201;;;;-1:-1:-1;;;3325:201:3;;5953:2:17;3325:201:3;;;5935:21:17;5992:2;5972:18;;;5965:30;6031:34;6011:18;;;6004:62;-1:-1:-1;;;6082:18:17;;;6075:44;6136:19;;3325:201:3;5751:410:17;3325:201:3;3536:12;:16;;-1:-1:-1;;3536:16:3;3551:1;3536:16;;;3562:65;;;;3596:13;:20;;-1:-1:-1;;3596:20:3;;;;;3562:65;1723:16:16::1;:14;:16::i;:::-;1750:24;:22;:24::i;:::-;1785:22;:20;:22::i;:::-;1818:10;:43:::0;;-1:-1:-1;;;;;1818:43:16;;::::1;-1:-1:-1::0;;;;;;1818:43:16;;::::1;;::::0;;;1872:11:::1;:40:::0;;;;::::1;::::0;;;::::1;::::0;;;::::1;::::0;;1930:2:::1;1923:4;:9:::0;3647:99:3;;;;3697:5;3681:21;;-1:-1:-1;;3681:21:3;;;3721:14;;-1:-1:-1;6318:36:17;;3721:14:3;;6306:2:17;6291:18;3721:14:3;;;;;;;3269:483;1610:330:16;;:::o;2204:183::-;1334:13:2;:11;:13::i;:::-;-1:-1:-1;;;;;2286:26:16;::::1;2278:58;;;::::0;-1:-1:-1;;;2278:58:16;;6567:2:17;2278:58:16::1;::::0;::::1;6549:21:17::0;6606:2;6586:18;;;6579:30;-1:-1:-1;;;6625:18:17;;;6618:49;6684:18;;2278:58:16::1;6365:343:17::0;2278:58:16::1;2347:13;:32:::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;2347:32:16;;;;;::::1;::::0;;-1:-1:-1;;;;;;2347:32:16::1;-1:-1:-1::0;;;;;2347:32:16;;;::::1;::::0;;;::::1;::::0;;2204:183::o;2054:142::-;1334:13:2;:11;:13::i;:::-;2137:1:16::1;2127:7;:11;2119:44;;;::::0;-1:-1:-1;;;2119:44:16;;6915:2:17;2119:44:16::1;::::0;::::1;6897:21:17::0;6954:2;6934:18;;;6927:30;-1:-1:-1;;;6973:18:17;;;6966:50;7033:18;;2119:44:16::1;6713:344:17::0;2119:44:16::1;2174:4;:14:::0;2054:142::o;2064:101:2:-;1334:13;:11;:13::i;:::-;2128:30:::1;2155:1;2128:18;:30::i;:::-;2064:101::o:0;1096:47:16:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;4635:74::-;1334:13:2;:11;:13::i;:::-;4700:1:16::1;4686:11;:15:::0;4635:74::o;2395:157::-;2490:16;1334:13:2;:11;:13::i;:::-;2531::16::1;2524:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;;-1:-1:-1;;;;;2524:20:16::1;::::0;;;;;::::1;::::0;::::1;;::::0;;::::1;;;;;;;;;;;2395:157:::0;:::o;3329:145:0:-;3415:4;3438:12;;;:6;:12;;;;;;;;-1:-1:-1;;;;;3438:29:0;;;;;;;;;;;;;;;3329:145::o;3045:1473:16:-;3099:16;3130:4;;3118:9;:16;;;;:::i;:::-;3099:35;-1:-1:-1;3154:20:16;3177:19;3189:7;3177:9;:19;:::i;:::-;3154:42;-1:-1:-1;3215:18:16;3230:3;3154:42;3215:18;:::i;:::-;:23;3207:54;;;;-1:-1:-1;;;3207:54:16;;7811:2:17;3207:54:16;;;7793:21:17;7850:2;7830:18;;;7823:30;-1:-1:-1;;;7869:18:17;;;7862:48;7927:18;;3207:54:16;7609:342:17;3207:54:16;3306:10;;3291:11;;3280:22;;:8;:22;:::i;:::-;:36;;3272:61;;;;-1:-1:-1;;;3272:61:16;;8158:2:17;3272:61:16;;;8140:21:17;8197:2;8177:18;;;8170:30;-1:-1:-1;;;8216:18:17;;;8209:42;8268:18;;3272:61:16;7956:336:17;3272:61:16;3352:13;:20;3344:54;;;;-1:-1:-1;;;3344:54:16;;8499:2:17;3344:54:16;;;8481:21:17;8538:2;8518:18;;;8511:30;-1:-1:-1;;;8557:18:17;;;8550:47;8614:18;;3344:54:16;8297:341:17;3344:54:16;3431:11;;:36;;-1:-1:-1;;;3431:36:16;;3461:4;3431:36;;;2104:51:17;3471:8:16;;-1:-1:-1;;;;;3431:11:16;;:21;;2077:18:17;;3431:36:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:48;;3409:118;;;;-1:-1:-1;;;3409:118:16;;9034:2:17;3409:118:16;;;9016:21:17;9073:2;9053:18;;;9046:30;-1:-1:-1;;;9092:18:17;;;9085:50;9152:18;;3409:118:16;8832:344:17;3409:118:16;3538:10;:12;;;:10;:12;;;:::i;:::-;;;;-1:-1:-1;;3625:13:16;:20;3607:10;;3579:24;;3625:20;3607:14;;3620:1;;3607:14;:::i;:::-;3606:39;;;;:::i;:::-;3579:66;;3656:23;3682:13;3696:16;3682:31;;;;;;;;:::i;:::-;;;;;;;;;;;;;;-1:-1:-1;;;;;;;;3800:10:16;3783:27;;;-1:-1:-1;;;;;3682:31:16;;;-1:-1:-1;;;3821:42:16;;;3895:15;-1:-1:-1;;;3874:36:16;;;-1:-1:-1;;;3921:32:16;;;-1:-1:-1;;;3964:26:16;;;4020:10;;;-1:-1:-1;;;4001:29:16;;;4041:21;;;:9;:21;;;;;:32;;;;;;;-1:-1:-1;;;;;;4041:32:16;;;;;;;;-1:-1:-1;4041:32:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4111:22;;;:10;:22;;;;;4139:10;;4111:39;;;;;;;;;;;;;;;;;;;;4161:11;:23;;3682:31;;-1:-1:-1;;;3964:26:16;;4161:11;:23;;3964:26;;4161:23;:::i;:::-;;;;-1:-1:-1;;4197:10:16;;:67;;-1:-1:-1;;;;;4197:10:16;4225;4237:15;4254:9;4197:27;:67::i;:::-;4275:11;;:42;;-1:-1:-1;;;4275:42:16;;4296:10;4275:42;;;9757:51:17;9824:18;;;9817:34;;;-1:-1:-1;;;;;4275:11:16;;;;:20;;9730:18:17;;4275:42:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;4382:10:16;;4335:175;;;4357:10;10469:34:17;;10534:2;10519:18;;10512:34;;;;4407:15:16;10562:18:17;;;10555:34;10620:2;10605:18;;10598:34;;;10663:3;10648:19;;10641:35;;;-1:-1:-1;;;;;10713:15:17;;10449:3;10692:19;;10685:44;4335:175:16;;;;;;10418:3:17;4335:175:16;;;3088:1430;;;;;3045:1473;:::o;1948:98::-;1334:13:2;:11;:13::i;:::-;2009:29:16::1;729:24;2033:4;2009:10;:29::i;:::-;1948:98:::0;:::o;5684:147:0:-;4908:7;4934:12;;;:6;:12;;;;;:22;;;2928:16;2939:4;2928:10;:16::i;:::-;5798:26:::1;5810:4;5816:7;5798:11;:26::i;2785:151:16:-:0;-1:-1:-1;;;;;2912:16:16;;;;;;:10;:16;;;;;;;;;2900:28;;;;;;;;;;;;;;;;;2861:26;;2900:28;;;2912:16;2900:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2785:151;;;:::o;2314:198:2:-;1334:13;:11;:13::i;:::-;-1:-1:-1;;;;;2402:22:2;::::1;2394:73;;;::::0;-1:-1:-1;;;2394:73:2;;10942:2:17;2394:73:2::1;::::0;::::1;10924:21:17::0;10981:2;10961:18;;;10954:30;11020:34;11000:18;;;10993:62;-1:-1:-1;;;11071:18:17;;;11064:36;11117:19;;2394:73:2::1;10740:402:17::0;2394:73:2::1;2477:28;2496:8;2477:18;:28::i;1599:130::-:0;1513:6;;-1:-1:-1;;;;;1513:6:2;929:10:9;1662:23:2;1654:68;;;;-1:-1:-1;;;1654:68:2;;11349:2:17;1654:68:2;;;11331:21:17;;;11368:18;;;11361:30;11427:34;11407:18;;;11400:62;11479:18;;1654:68:2;11147:356:17;3768:103:0;3834:30;3845:4;929:10:9;3834::0;:30::i;7917:233::-;8000:22;8008:4;8014:7;8000;:22::i;:::-;7995:149;;8038:12;;;;:6;:12;;;;;;;;-1:-1:-1;;;;;8038:29:0;;;;;;;;;:36;;-1:-1:-1;;8038:36:0;8070:4;8038:36;;;8120:12;929:10:9;;850:96;8120:12:0;-1:-1:-1;;;;;8093:40:0;8111:7;-1:-1:-1;;;;;8093:40:0;8105:4;8093:40;;;;;;;;;;7917:233;;:::o;8321:234::-;8404:22;8412:4;8418:7;8404;:22::i;:::-;8400:149;;;8474:5;8442:12;;;:6;:12;;;;;;;;-1:-1:-1;;;;;8442:29:0;;;;;;;;;;:37;;-1:-1:-1;;8442:37:0;;;8498:40;929:10:9;;8442:12:0;;8498:40;;8474:5;8498:40;8321:234;;:::o;1003:95:2:-;5374:13:3;;;;;;;5366:69;;;;-1:-1:-1;;;5366:69:3;;;;;;;:::i;:::-;1065:26:2::1;:24;:26::i;1868:111:4:-:0;5374:13:3;;;;;;;5366:69;;;;-1:-1:-1;;;5366:69:3;;;;;;;:::i;:::-;1938:34:4::1;:32;:34::i;2151:65:0:-:0;5374:13:3;;;;;;;5366:69;;;;-1:-1:-1;;;5366:69:3;;;;;;;:::i;2666:187:2:-;2758:6;;;-1:-1:-1;;;;;2774:17:2;;;-1:-1:-1;;;;;;2774:17:2;;;;;;;2806:40;;2758:6;;;2774:17;2758:6;;2806:40;;2739:16;;2806:40;2729:124;2666:187;:::o;1421:214:7:-;1559:68;;;-1:-1:-1;;;;;12178:15:17;;;1559:68:7;;;12160:34:17;12230:15;;12210:18;;;12203:43;12262:18;;;;12255:34;;;1559:68:7;;;;;;;;;;12095:18:17;;;;1559:68:7;;;;;;;;-1:-1:-1;;;;;1559:68:7;-1:-1:-1;;;1559:68:7;;;1532:96;;1552:5;;1532:19;:96::i;:::-;1421:214;;;;:::o;7267:110:0:-;7345:25;7356:4;7362:7;7345:10;:25::i;4152:501::-;4240:22;4248:4;4254:7;4240;:22::i;:::-;4235:412;;4423:39;4454:7;4423:30;:39::i;:::-;4533:49;4572:4;4579:2;4533:30;:49::i;:::-;4330:274;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;4330:274:0;;;;;;;;;;-1:-1:-1;;;4278:358:0;;;;;;;:::i;1104:111:2:-;5374:13:3;;;;;;;5366:69;;;;-1:-1:-1;;;5366:69:3;;;;;;;:::i;:::-;1176:32:2::1;929:10:9::0;1176:18:2::1;:32::i;1985:109:4:-:0;5374:13:3;;;;;;;5366:69;;;;-1:-1:-1;;;5366:69:3;;;;;;;:::i;:::-;1787:1:4::1;2065:7;:22:::0;1985:109::o;5328:653:7:-;5758:23;5784:69;5812:4;5784:69;;;;;;;;;;;;;;;;;5792:5;-1:-1:-1;;;;;5784:27:7;;;:69;;;;;:::i;:::-;5758:95;;5871:10;:17;5892:1;5871:22;:56;;;;5908:10;5897:30;;;;;;;;;;;;:::i;:::-;5863:111;;;;-1:-1:-1;;;5863:111:7;;13944:2:17;5863:111:7;;;13926:21:17;13983:2;13963:18;;;13956:30;14022:34;14002:18;;;13995:62;-1:-1:-1;;;14073:18:17;;;14066:40;14123:19;;5863:111:7;13742:406:17;2473:149:10;2531:13;2563:52;-1:-1:-1;;;;;2575:22:10;;376:2;1884:437;1959:13;1984:19;2016:10;2020:6;2016:1;:10;:::i;:::-;:14;;2029:1;2016:14;:::i;:::-;2006:25;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2006:25:10;;1984:47;;-1:-1:-1;;;2041:6:10;2048:1;2041:9;;;;;;;;:::i;:::-;;;;:15;-1:-1:-1;;;;;2041:15:10;;;;;;;;;-1:-1:-1;;;2066:6:10;2073:1;2066:9;;;;;;;;:::i;:::-;;;;:15;-1:-1:-1;;;;;2066:15:10;;;;;;;;-1:-1:-1;2096:9:10;2108:10;2112:6;2108:1;:10;:::i;:::-;:14;;2121:1;2108:14;:::i;:::-;2096:26;;2091:128;2128:1;2124;:5;2091:128;;;-1:-1:-1;;;2171:5:10;2179:3;2171:11;2162:21;;;;;;;:::i;:::-;;;;2150:6;2157:1;2150:9;;;;;;;;:::i;:::-;;;;:33;-1:-1:-1;;;;;2150:33:10;;;;;;;;-1:-1:-1;2207:1:10;2197:11;;;;;2131:3;;;:::i;:::-;;;2091:128;;;-1:-1:-1;2236:10:10;;2228:55;;;;-1:-1:-1;;;2228:55:10;;14628:2:17;2228:55:10;;;14610:21:17;;;14647:18;;;14640:30;14706:34;14686:18;;;14679:62;14758:18;;2228:55:10;14426:356:17;2228:55:10;2307:6;1884:437;-1:-1:-1;;;1884:437:10:o;4119:223:8:-;4252:12;4283:52;4305:6;4313:4;4319:1;4322:12;4283:21;:52::i;:::-;4276:59;4119:223;-1:-1:-1;;;;4119:223:8:o;5176:446::-;5341:12;5398:5;5373:21;:30;;5365:81;;;;-1:-1:-1;;;5365:81:8;;14989:2:17;5365:81:8;;;14971:21:17;15028:2;15008:18;;;15001:30;15067:34;15047:18;;;15040:62;-1:-1:-1;;;15118:18:17;;;15111:36;15164:19;;5365:81:8;14787:402:17;5365:81:8;5457:12;5471:23;5498:6;-1:-1:-1;;;;;5498:11:8;5517:5;5524:4;5498:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5456:73;;;;5546:69;5573:6;5581:7;5590:10;5602:12;5546:26;:69::i;:::-;5539:76;5176:446;-1:-1:-1;;;;;;;5176:446:8:o;7682:628::-;7862:12;7890:7;7886:418;;;7917:17;;7913:286;;-1:-1:-1;;;;;1713:19:8;;;8124:60;;;;-1:-1:-1;;;8124:60:8;;15675:2:17;8124:60:8;;;15657:21:17;15714:2;15694:18;;;15687:30;15753:31;15733:18;;;15726:59;15802:18;;8124:60:8;15473:353:17;8124:60:8;-1:-1:-1;8219:10:8;8212:17;;7886:418;8260:33;8268:10;8280:12;8991:17;;:21;8987:379;;9219:10;9213:17;9275:15;9262:10;9258:2;9254:19;9247:44;8987:379;9342:12;9335:20;;-1:-1:-1;;;9335:20:8;;;;;;;;:::i;14:286:17:-;72:6;125:2;113:9;104:7;100:23;96:32;93:52;;;141:1;138;131:12;93:52;167:23;;-1:-1:-1;;;;;;219:32:17;;209:43;;199:71;;266:1;263;256:12;497:180;556:6;609:2;597:9;588:7;584:23;580:32;577:52;;;625:1;622;615:12;577:52;-1:-1:-1;648:23:17;;497:180;-1:-1:-1;497:180:17:o;1231:173::-;1299:20;;-1:-1:-1;;;;;1348:31:17;;1338:42;;1328:70;;1394:1;1391;1384:12;1328:70;1231:173;;;:::o;1409:254::-;1477:6;1485;1538:2;1526:9;1517:7;1513:23;1509:32;1506:52;;;1554:1;1551;1544:12;1506:52;1590:9;1577:23;1567:33;;1619:38;1653:2;1642:9;1638:18;1619:38;:::i;:::-;1609:48;;1409:254;;;;;:::o;1668:260::-;1736:6;1744;1797:2;1785:9;1776:7;1772:23;1768:32;1765:52;;;1813:1;1810;1803:12;1765:52;1836:29;1855:9;1836:29;:::i;:::-;1826:39;;1884:38;1918:2;1907:9;1903:18;1884:38;:::i;2166:186::-;2225:6;2278:2;2266:9;2257:7;2253:23;2249:32;2246:52;;;2294:1;2291;2284:12;2246:52;2317:29;2336:9;2317:29;:::i;2357:254::-;2425:6;2433;2486:2;2474:9;2465:7;2461:23;2457:32;2454:52;;;2502:1;2499;2492:12;2454:52;2525:29;2544:9;2525:29;:::i;:::-;2515:39;2601:2;2586:18;;;;2573:32;;-1:-1:-1;;;2357:254:17:o;2824:658::-;2995:2;3047:21;;;3117:13;;3020:18;;;3139:22;;;2966:4;;2995:2;3218:15;;;;3192:2;3177:18;;;2966:4;3261:195;3275:6;3272:1;3269:13;3261:195;;;3340:13;;-1:-1:-1;;;;;3336:39:17;3324:52;;3431:15;;;;3396:12;;;;3372:1;3290:9;3261:195;;;-1:-1:-1;3473:3:17;;2824:658;-1:-1:-1;;;;;;2824:658:17:o;4083:632::-;4254:2;4306:21;;;4376:13;;4279:18;;;4398:22;;;4225:4;;4254:2;4477:15;;;;4451:2;4436:18;;;4225:4;4520:169;4534:6;4531:1;4528:13;4520:169;;;4595:13;;4583:26;;4664:15;;;;4629:12;;;;4556:1;4549:9;4520:169;;5070:127;5131:10;5126:3;5122:20;5119:1;5112:31;5162:4;5159:1;5152:15;5186:4;5183:1;5176:15;5202:128;5242:3;5273:1;5269:6;5266:1;5263:13;5260:39;;;5279:18;;:::i;:::-;-1:-1:-1;5315:9:17;;5202:128::o;7062:168::-;7102:7;7168:1;7164;7160:6;7156:14;7153:1;7150:21;7145:1;7138:9;7131:17;7127:45;7124:71;;;7175:18;;:::i;:::-;-1:-1:-1;7215:9:17;;7062:168::o;7235:127::-;7296:10;7291:3;7287:20;7284:1;7277:31;7327:4;7324:1;7317:15;7351:4;7348:1;7341:15;7367:120;7407:1;7433;7423:35;;7438:18;;:::i;:::-;-1:-1:-1;7472:9:17;;7367:120::o;7492:112::-;7524:1;7550;7540:35;;7555:18;;:::i;:::-;-1:-1:-1;7589:9:17;;7492:112::o;8643:184::-;8713:6;8766:2;8754:9;8745:7;8741:23;8737:32;8734:52;;;8782:1;8779;8772:12;8734:52;-1:-1:-1;8805:16:17;;8643:184;-1:-1:-1;8643:184:17:o;9181:135::-;9220:3;-1:-1:-1;;9241:17:17;;9238:43;;;9261:18;;:::i;:::-;-1:-1:-1;9308:1:17;9297:13;;9181:135::o;9321:125::-;9361:4;9389:1;9386;9383:8;9380:34;;;9394:18;;:::i;:::-;-1:-1:-1;9431:9:17;;9321:125::o;9451:127::-;9512:10;9507:3;9503:20;9500:1;9493:31;9543:4;9540:1;9533:15;9567:4;9564:1;9557:15;9862:277;9929:6;9982:2;9970:9;9961:7;9957:23;9953:32;9950:52;;;9998:1;9995;9988:12;9950:52;10030:9;10024:16;10083:5;10076:13;10069:21;10062:5;10059:32;10049:60;;10105:1;10102;10095:12;11508:407;11710:2;11692:21;;;11749:2;11729:18;;;11722:30;11788:34;11783:2;11768:18;;11761:62;-1:-1:-1;;;11854:2:17;11839:18;;11832:41;11905:3;11890:19;;11508:407::o;12300:258::-;12372:1;12382:113;12396:6;12393:1;12390:13;12382:113;;;12472:11;;;12466:18;12453:11;;;12446:39;12418:2;12411:10;12382:113;;;12513:6;12510:1;12507:13;12504:48;;;-1:-1:-1;;12548:1:17;12530:16;;12523:27;12300:258::o;12563:786::-;12974:25;12969:3;12962:38;12944:3;13029:6;13023:13;13045:62;13100:6;13095:2;13090:3;13086:12;13079:4;13071:6;13067:17;13045:62;:::i;:::-;-1:-1:-1;;;13166:2:17;13126:16;;;13158:11;;;13151:40;13216:13;;13238:63;13216:13;13287:2;13279:11;;13272:4;13260:17;;13238:63;:::i;:::-;13321:17;13340:2;13317:26;;12563:786;-1:-1:-1;;;;12563:786:17:o;13354:383::-;13503:2;13492:9;13485:21;13466:4;13535:6;13529:13;13578:6;13573:2;13562:9;13558:18;13551:34;13594:66;13653:6;13648:2;13637:9;13633:18;13628:2;13620:6;13616:15;13594:66;:::i;:::-;13721:2;13700:15;-1:-1:-1;;13696:29:17;13681:45;;;;13728:2;13677:54;;13354:383;-1:-1:-1;;13354:383:17:o;14153:127::-;14214:10;14209:3;14205:20;14202:1;14195:31;14245:4;14242:1;14235:15;14269:4;14266:1;14259:15;14285:136;14324:3;14352:5;14342:39;;14361:18;;:::i;:::-;-1:-1:-1;;;14397:18:17;;14285:136::o;15194:274::-;15323:3;15361:6;15355:13;15377:53;15423:6;15418:3;15411:4;15403:6;15399:17;15377:53;:::i;:::-;15446:16;;;;;15194:274;-1:-1:-1;;15194:274:17:o
Swarm Source
ipfs://abfb2130237848c09ccf74cad00671a591c67475b175dc1933ff213550cc48e6
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.