Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 213 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Buy Mystery Box | 19161084 | 363 days ago | IN | 0 ETH | 0.00492726 | ||||
Buy Mystery Box | 19159208 | 363 days ago | IN | 0 ETH | 0.00255853 | ||||
Buy Mystery Box | 19156837 | 363 days ago | IN | 0 ETH | 0.00566622 | ||||
Buy Mystery Box | 19151326 | 364 days ago | IN | 0 ETH | 0.00749749 | ||||
Buy Mystery Box | 19147761 | 365 days ago | IN | 0 ETH | 0.00473201 | ||||
Buy Mystery Box | 19143435 | 365 days ago | IN | 0 ETH | 0.00365989 | ||||
Mint To | 19119065 | 369 days ago | IN | 0 ETH | 0.0064388 | ||||
Buy Mystery Box | 19092359 | 372 days ago | IN | 0 ETH | 0.00952242 | ||||
Buy Mystery Box | 19076020 | 375 days ago | IN | 0 ETH | 0.00378344 | ||||
Buy Mystery Box | 19071031 | 375 days ago | IN | 0 ETH | 0.0040813 | ||||
Buy Mystery Box | 19040744 | 380 days ago | IN | 0 ETH | 0.00676087 | ||||
Buy Mystery Box | 19001004 | 385 days ago | IN | 0 ETH | 0.00610819 | ||||
Buy Mystery Box | 18993023 | 386 days ago | IN | 0 ETH | 0.0046341 | ||||
Buy Mystery Box | 18947100 | 393 days ago | IN | 0 ETH | 0.00290896 | ||||
Buy Mystery Box | 18946803 | 393 days ago | IN | 0 ETH | 0.00311938 | ||||
Buy Mystery Box | 18946651 | 393 days ago | IN | 0 ETH | 0.00335474 | ||||
Buy Mystery Box | 18939187 | 394 days ago | IN | 0 ETH | 0.00274125 | ||||
Buy Mystery Box | 18938907 | 394 days ago | IN | 0 ETH | 0.00320481 | ||||
Buy Mystery Box | 18938871 | 394 days ago | IN | 0 ETH | 0.00318153 | ||||
Buy Mystery Box | 18933486 | 395 days ago | IN | 0 ETH | 0.00337887 | ||||
Buy Mystery Box | 18933042 | 395 days ago | IN | 0 ETH | 0.00427286 | ||||
Buy Mystery Box | 18932789 | 395 days ago | IN | 0 ETH | 0.00435195 | ||||
Buy Mystery Box | 18932429 | 395 days ago | IN | 0 ETH | 0.00416167 | ||||
Buy Mystery Box | 18932353 | 395 days ago | IN | 0 ETH | 0.00301125 | ||||
Buy Mystery Box | 18903653 | 399 days ago | IN | 0 ETH | 0.00258638 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
MysteryDropV2
Compiler Version
v0.8.12+commit.f00d7308
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "./interfaces/ICollectionV3.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./interfaces/AggregatorInterface.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; contract MysteryDropV2 is ReentrancyGuard, AccessControl { /** Events **/ event MysteryBoxDropped( uint8 tier, address collection, uint256 id, address user, uint32 version ); event MysteryBoxCC(uint8 tier, address user, string purchaseId); /** Structs **/ struct Item { uint256 startTokenId; uint256 endTokenId; ICollectionV3 collection; } struct Tier { uint16 available; uint256 amount; uint16 rewards; } struct Purchase { uint256 amount; uint32 version; } /* Storage */ mapping(address => Purchase) public bought; // General drop paramaters IERC20 public erc20; address public treasurer; bytes32 public root; uint256 public maxPerWallet; uint256 public whitelistStartTime; uint256 public startTime; uint256 public endTime; Tier[] public tiers; // Tree data structure // About 40% gas cost reduction by using uint16. Limited to max 64K nfts. Item[] public items; uint16[] public tree; uint16 start_leaf; uint16 tree_length; uint32 current_version; address[] nftHolderAddresses; constructor() { _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); current_version = 0; } modifier isStarted() { require( startTime <= block.timestamp && endTime > block.timestamp, "Drop has not started yet!" ); _; } modifier isWhitelistStarted() { require( whitelistStartTime <= block.timestamp && endTime > block.timestamp, "Drop whitelist has not started yet!" ); _; } /** Public functions **/ /* * Get the number of available boxes for a tier */ function getAvailable(uint8 _tier) public view returns (uint256) { if (_tier >= tiers.length) { return 0; } return tiers[_tier].available; } function _validatePurchase( address _user, uint8 _tier, uint8 _quantity ) internal { require(_tier < tiers.length, "Invalid tier id"); require(tiers[_tier].available >= _quantity, "Sold out"); if (bought[_user].version != current_version) { bought[_user].amount = 0; bought[_user].version = current_version; } require( bought[_user].amount + _quantity <= maxPerWallet, "Limit per wallet reached" ); bought[_user].amount += _quantity; } function _takeFunds(address _user, uint8 _tier, uint8 quantity) internal { uint256 _amount = tiers[_tier].amount * quantity; require( erc20.transferFrom(_user, treasurer, _amount), "Payment was unsuccessful" ); } function _sendMysteryBox( address _user, uint8 _tier, uint8 _quantity ) internal { for (uint8 j = 0; j < _quantity; j++) { for (uint256 i = 0; i < tiers[_tier].rewards; i++) { (ICollectionV3 collection, uint256 tokenId) = _pickNft( j * _quantity + i ); mint(collection, _user, tokenId); emit MysteryBoxDropped( _tier, address(collection), tokenId, _user, current_version ); } } } function _purchaseMysteryBox( address _user, uint8 _tier, uint8 _quantity ) internal { tiers[_tier].available -= _quantity; _sendMysteryBox(_user, _tier, _quantity); } /* *This function picks random card and mints this random card to user */ function buyMysteryBox( uint8 _tier, uint8 quantity ) external isStarted nonReentrant { address _user = _msgSender(); _validatePurchase(_user, _tier, quantity); _takeFunds(_user, _tier, quantity); _purchaseMysteryBox(_user, _tier, quantity); } function buyWithWhitelist( uint8 _tier, uint8 quantity, bytes32[] calldata proof ) external isWhitelistStarted nonReentrant { address _user = _msgSender(); require(isWhitelisted(_user, proof), "User is not whitelisted"); _validatePurchase(_user, _tier, quantity); _takeFunds(_user, _tier, quantity); _purchaseMysteryBox(_user, _tier, quantity); } /* *User can buy mysteryBox via this function with creditcard */ function buyCreditMysteryBox( address _user, uint8 _tier, uint8 _quantity, string calldata _purchaseId ) external onlyRole(DEFAULT_ADMIN_ROLE) { _validatePurchase(_user, _tier, _quantity); _purchaseMysteryBox(_user, _tier, _quantity); emit MysteryBoxCC(_tier, _user, _purchaseId); } function mintTo( address _user, uint8 _tier, uint8 _quantity ) external onlyRole(DEFAULT_ADMIN_ROLE) { require(_tier < tiers.length, "Invalid tier id"); require( tree[0] >= tiers[_tier].rewards * _quantity, "Not enough nfts left" ); _sendMysteryBox(_user, _tier, _quantity); } function isWhitelisted( address _user, bytes32[] calldata proof ) public view returns (bool) { return MerkleProof.verify(proof, root, keccak256(abi.encodePacked(_user))); } function mint( ICollectionV3 collection, address user, uint256 tokenId ) internal { for (uint8 i = 0; i < nftHolderAddresses.length; i++) { if (collection.balanceOf(nftHolderAddresses[i], tokenId) > 0) { collection.safeTransferFrom( nftHolderAddresses[i], user, tokenId, 1, "" ); return; } } collection.mint(user, tokenId); } function setNftHolderAddresses( address[] memory _nftHolderAddresses ) public onlyRole(DEFAULT_ADMIN_ROLE) { delete nftHolderAddresses; for (uint8 i = 0; i < _nftHolderAddresses.length; i++) { nftHolderAddresses.push(_nftHolderAddresses[i]); } } /** Code for managing drop paramaters **/ function setGeneralDropParamaters( address _erc20, uint256 _maxPerWallet, uint256 _whitelistStartTime, uint256 _startTime, uint256 _endTime ) public onlyRole(DEFAULT_ADMIN_ROLE) { erc20 = IERC20(_erc20); maxPerWallet = _maxPerWallet; startTime = _startTime; endTime = _endTime; whitelistStartTime = _whitelistStartTime; } function setTreasurer( address _treasurer ) public onlyRole(DEFAULT_ADMIN_ROLE) { treasurer = _treasurer; } function setRoot(bytes32 _root) public onlyRole(DEFAULT_ADMIN_ROLE) { root = _root; } function setTiersParamaters( Tier[] calldata _tiers ) public onlyRole(DEFAULT_ADMIN_ROLE) { delete tiers; for (uint256 i = 0; i < _tiers.length; i++) { tiers.push(_tiers[i]); } } /** Code related to the tree structure used to store items in the pack **/ function resetItems() public onlyRole(DEFAULT_ADMIN_ROLE) { delete items; start_leaf = 0; tree_length = 0; delete tree; current_version += 1; } function addItems( Item[] calldata _items ) public onlyRole(DEFAULT_ADMIN_ROLE) { for (uint256 i = 0; i < _items.length; i++) { items.push(_items[i]); } } function preCompute() public onlyRole(DEFAULT_ADMIN_ROLE) { uint64 log; while (2 ** log < items.length) { log++; } start_leaf = uint16((2 ** log) - 1); tree_length = uint16(2 ** (log + 1) - 1); tree = new uint16[](tree_length); uint64 j = 0; for ( uint64 i = uint64(start_leaf); (i < tree_length) && (j < items.length); i++ ) { tree[i] = uint16( items[i - start_leaf].endTokenId - items[i - start_leaf].startTokenId + 1 ); j++; } if (tree_length > 1) { for (uint256 i = (2 ** log) - 2; i >= 1; i--) { tree[i] = tree[2 * i + 1] + tree[2 * i + 2]; } tree[0] = tree[1] + tree[2]; } } function _pickNft(uint256 seed) internal returns (ICollectionV3, uint256) { uint16 position = uint16(_getRandom(tree[0], seed)); uint16 item = _findPosition(position); _removeOne(item); require( items[item].startTokenId <= items[item].endTokenId, "Nft reward soldout" ); uint256 tokenId = items[item].startTokenId; ICollectionV3 collection = items[item].collection; items[item].startTokenId += 1; return (collection, tokenId); } function _getRandom( uint256 gamerange, uint256 seed ) internal view returns (uint256) { return 1 + (uint256( keccak256( abi.encodePacked( block.timestamp, block.difficulty, keccak256(abi.encodePacked(block.coinbase)), seed ) ) ) % gamerange); } function _findPosition(uint16 value) internal view returns (uint16) { uint16 i = 0; require(tree[0] >= value, "Value is bigger than remaining elements"); while (2 * i + 2 < tree_length) { uint16 left = 2 * i + 1; uint16 right = 2 * i + 2; if (value <= tree[left]) { i = left; } else { i = right; value = value - tree[left]; } } return i - start_leaf; } function _removeOne(uint16 position) internal { uint16 i = position + start_leaf; require(tree[i] > 0, "Element is already containing 0 values"); tree[i]--; while (i > 0) { if (i % 2 == 1) { i++; } uint16 parent = (i / 2) - 1; tree[parent] = tree[i - 1] + tree[i]; i = parent; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * 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}: * * ``` * 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. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 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 10, 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 * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.12; interface AggregatorInterface { function latestAnswer() external view returns (int256 answer); }
// SPDX-License-Identifier: MIT // Latest stable version of solidity pragma solidity 0.8.12; interface ICollectionV3 { function initialize( string memory uri, uint256 _total, uint256 _whitelistedStartTime, uint256 _startTime, uint256 _endTime, uint256 _amount, uint256 _percent, address _admin, address _facAddress ) external; function __CollectionV3_init_unchained( string memory uri, uint256 _total, uint256 _whitelistedStartTime, uint256 _startTime, uint256 _endTime, uint256 _amount, uint256 _percent, address _admin, address _facAddress ) external; function addExternalAddresses( address _token, address _stone, address _treasure ) external; function recoverToken(address _token) external; function changeOnlyWhitelisted(bool _status) external; function buy(address buyer, uint256 _id) external; function mint(address to, uint256 _id) external; function mintBatch( address to, uint256[] memory ids, uint256[] memory amount_ ) external; function addPayees( address[] memory payees_, uint256[] memory sharePerc_ ) external; function _addPayee(address account, uint256 sharePerc_) external; function release() external; function getAmountPer(uint256 sharePerc) external view returns (uint256); function calcPerc( uint256 _amount, uint256 _percent ) external pure returns (uint256); function calcTrasAndShare() external view returns (uint256, uint256); function setStarTime(uint256 _starTime) external; function setEndTime(uint256 _endTime) external; function setWhiteListUser(address _addr) external; function setBatchWhiteListUser(address[] calldata _addr) external; function setAmount(uint256 _amount) external; function delShare(address account) external; function totalReleased() external view returns (uint256); function released(address account) external view returns (uint256); function shares(address account) external view returns (uint256); function allShares() external view returns (address[] memory); function available() external view returns (uint256); function balanceOf( address account, uint256 id ) external view returns (uint256); function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"tier","type":"uint8"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"string","name":"purchaseId","type":"string"}],"name":"MysteryBoxCC","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"tier","type":"uint8"},{"indexed":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint32","name":"version","type":"uint32"}],"name":"MysteryBoxDropped","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":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"startTokenId","type":"uint256"},{"internalType":"uint256","name":"endTokenId","type":"uint256"},{"internalType":"contract ICollectionV3","name":"collection","type":"address"}],"internalType":"struct MysteryDropV2.Item[]","name":"_items","type":"tuple[]"}],"name":"addItems","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"bought","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"version","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint8","name":"_tier","type":"uint8"},{"internalType":"uint8","name":"_quantity","type":"uint8"},{"internalType":"string","name":"_purchaseId","type":"string"}],"name":"buyCreditMysteryBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_tier","type":"uint8"},{"internalType":"uint8","name":"quantity","type":"uint8"}],"name":"buyMysteryBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_tier","type":"uint8"},{"internalType":"uint8","name":"quantity","type":"uint8"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"buyWithWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc20","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_tier","type":"uint8"}],"name":"getAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"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":"_user","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"items","outputs":[{"internalType":"uint256","name":"startTokenId","type":"uint256"},{"internalType":"uint256","name":"endTokenId","type":"uint256"},{"internalType":"contract ICollectionV3","name":"collection","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerWallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint8","name":"_tier","type":"uint8"},{"internalType":"uint8","name":"_quantity","type":"uint8"}],"name":"mintTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"preCompute","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":"resetItems","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":[],"name":"root","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_erc20","type":"address"},{"internalType":"uint256","name":"_maxPerWallet","type":"uint256"},{"internalType":"uint256","name":"_whitelistStartTime","type":"uint256"},{"internalType":"uint256","name":"_startTime","type":"uint256"},{"internalType":"uint256","name":"_endTime","type":"uint256"}],"name":"setGeneralDropParamaters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_nftHolderAddresses","type":"address[]"}],"name":"setNftHolderAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"setRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint16","name":"available","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint16","name":"rewards","type":"uint16"}],"internalType":"struct MysteryDropV2.Tier[]","name":"_tiers","type":"tuple[]"}],"name":"setTiersParamaters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasurer","type":"address"}],"name":"setTreasurer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tiers","outputs":[{"internalType":"uint16","name":"available","type":"uint16"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint16","name":"rewards","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasurer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tree","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50600160009081556200002590336200003b565b600d805463ffffffff60201b19169055620000c4565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16620000c05760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45b5050565b612d3a80620000d46000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c8063667022fd1161010f578063acec599e116100a2578063dc31755011610071578063dc317550146104a9578063ebf0c717146104b1578063fda49eb4146104ba578063ff12e08d146104cd57600080fd5b8063acec599e14610444578063bfb231d21461044c578063d547741f14610483578063dab5f3401461049657600080fd5b806378e97925116100de57806378e979251461041757806391d14854146104205780639292caaf14610433578063a217fddf1461043c57600080fd5b8063667022fd1461037f578063671d6429146103c6578063698a55d5146103d9578063785e9e86146103ec57600080fd5b80633197cbb6116101875780634196d0b8116101565780634196d0b81461033d578063453c231014610350578063457110e8146103595780635a23dd991461036c57600080fd5b80633197cbb6146102fb5780633524f5981461030457806336568abe146103175780633c6f38291461032a57600080fd5b80631f0b1423116101c35780631f0b14231461028b578063248a9ca31461029e5780632f2ff15d146102c257806331352936146102d557600080fd5b806301ffc9a7146101f5578063039af9eb1461021d578063142cbfe4146102555780631e1a0c0c1461026a575b600080fd5b6102086102033660046122e8565b6104e0565b60405190151581526020015b60405180910390f35b61023061022b366004612312565b610517565b6040805161ffff94851681526020810193909352921691810191909152606001610214565b610268610263366004612341565b610550565b005b61027d610278366004612374565b6105ed565b604051908152602001610214565b6102686102993660046123af565b610635565b61027d6102ac366004612312565b6000908152600160208190526040909120015490565b6102686102d03660046123f4565b610752565b6102e86102e3366004612312565b61077d565b60405161ffff9091168152602001610214565b61027d60095481565b610268610312366004612424565b6107b5565b6102686103253660046123f4565b6107f9565b61026861033836600461247e565b610873565b61026861034b36600461258d565b6108fd565b61027d60065481565b61026861036736600461258d565b610976565b61020861037a366004612612565b6109e3565b6103ac61038d366004612666565b6002602052600090815260409020805460019091015463ffffffff1682565b6040805192835263ffffffff909116602083015201610214565b6102686103d4366004612666565b610a63565b6102686103e7366004612683565b610a91565b6003546103ff906001600160a01b031681565b6040516001600160a01b039091168152602001610214565b61027d60085481565b61020861042e3660046123f4565b610af7565b61027d60075481565b61027d600081565b610268610b22565b61045f61045a366004612312565b610b95565b6040805193845260208401929092526001600160a01b031690820152606001610214565b6102686104913660046123f4565b610bd1565b6102686104a4366004612312565b610bf7565b610268610c08565b61027d60055481565b6004546103ff906001600160a01b031681565b6102686104db366004612726565b611034565b60006001600160e01b03198216637965db0b60e01b148061051157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600a818154811061052757600080fd5b600091825260209091206003909102018054600182015460029092015461ffff91821693501683565b4260085411158015610563575042600954115b6105b45760405162461bcd60e51b815260206004820152601960248201527f44726f7020686173206e6f74207374617274656420796574210000000000000060448201526064015b60405180910390fd5b6105bc61112b565b336105c8818484611185565b6105d381848461135a565b6105de818484611464565b506105e96001600055565b5050565b600a5460009060ff83161061060457506000919050565b600a8260ff168154811061061a5761061a612786565b600091825260209091206003909102015461ffff1692915050565b6000610640816114c6565b600a5460ff8416106106865760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081d1a595c881a59608a1b60448201526064016105ab565b8160ff16600a8460ff16815481106106a0576106a0612786565b60009182526020909120600260039092020101546106c2919061ffff166127b2565b61ffff16600c6000815481106106da576106da612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff1610156107415760405162461bcd60e51b8152602060048201526014602482015273139bdd08195b9bdd59da081b999d1cc81b19599d60621b60448201526064016105ab565b61074c8484846114d3565b50505050565b6000828152600160208190526040909120015461076e816114c6565b61077883836115e2565b505050565b600c818154811061078d57600080fd5b9060005260206000209060109182820401919006600202915054906101000a900461ffff1681565b60006107c0816114c6565b50600380546001600160a01b0319166001600160a01b039690961695909517909455600692909255600891909155600991909155600755565b6001600160a01b03811633146108695760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105ab565b6105e9828261164d565b600061087e816114c6565b61088a600e600061214a565b60005b82518160ff16101561077857600e838260ff16815181106108b0576108b0612786565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806108f5816127dc565b91505061088d565b6000610908816114c6565b610914600a6000612168565b60005b8281101561074c57600a84848381811061093357610933612786565b8354600181018555600094855260209094206060909102929092019260030290910190506109618282612810565b5050808061096e9061285f565b915050610917565b6000610981816114c6565b60005b8281101561074c57600b8484838181106109a0576109a0612786565b8354600181018555600094855260209094206060909102929092019260030290910190506109ce828261287a565b505080806109db9061285f565b915050610984565b6000610a5b838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506005546040516bffffffffffffffffffffffff1960608b901b1660208201529092506034019050604051602081830303815290604052805190602001206116b4565b949350505050565b6000610a6e816114c6565b50600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000610a9c816114c6565b610aa7868686611185565b610ab2868686611464565b7f51b720e2ad3ad5be6b819d17d845c066a39969c0b85b2daf4a4bf8f69079114b85878585604051610ae794939291906128b9565b60405180910390a1505050505050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610b2d816114c6565b610b39600b6000612189565b600d805463ffffffff19169055610b52600c60006121aa565b6001600d60048282829054906101000a900463ffffffff16610b749190612903565b92506101000a81548163ffffffff021916908363ffffffff16021790555050565b600b8181548110610ba557600080fd5b60009182526020909120600390910201805460018201546002909201549092506001600160a01b031683565b60008281526001602081905260409091200154610bed816114c6565b610778838361164d565b6000610c02816114c6565b50600555565b6000610c13816114c6565b60005b600b54610c24826002612a0f565b1015610c3c5780610c3481612a24565b915050610c16565b6001610c49826002612a0f565b610c539190612a4b565b600d805461ffff191661ffff929092169190911790556001610c758282612a62565b610c80906002612a0f565b610c8a9190612a4b565b600d805463ffff000019166201000061ffff938416810291909117918290559004166001600160401b03811115610cc357610cc3612468565b604051908082528060200260200182016040528015610cec578160200160208202803683370190505b508051610d0191600c916020909101906121cf565b50600d5460009061ffff165b600d5462010000900461ffff166001600160401b038216108015610d3b5750600b546001600160401b038316105b15610e3e57600d54600b90610d549061ffff1683612a84565b6001600160401b031681548110610d6d57610d6d612786565b6000918252602090912060039091020154600d54600b90610d929061ffff1684612a84565b6001600160401b031681548110610dab57610dab612786565b906000526020600020906003020160010154610dc79190612a4b565b610dd2906001612aac565b600c826001600160401b031681548110610dee57610dee612786565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055508180610e2890612a24565b9250508080610e3690612a24565b915050610d0d565b50600d5460016201000090910461ffff1611156107785760006002610e638482612a0f565b610e6d9190612a4b565b90505b60018110610f7157600c610e85826002612ac4565b610e90906002612aac565b81548110610ea057610ea0612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff16600c826002610ed39190612ac4565b610ede906001612aac565b81548110610eee57610eee612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff16610f1c9190612ae3565b600c8281548110610f2f57610f2f612786565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055508080610f6990612b00565b915050610e70565b50600c600281548110610f8657610f86612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff16600c600181548110610fbe57610fbe612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff16610fec9190612ae3565b600c60008154811061100057611000612786565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff160217905550505050565b4260075411158015611047575042600954115b61109f5760405162461bcd60e51b815260206004820152602360248201527f44726f702077686974656c69737420686173206e6f742073746172746564207960448201526265742160e81b60648201526084016105ab565b6110a761112b565b336110b38184846109e3565b6110ff5760405162461bcd60e51b815260206004820152601760248201527f55736572206973206e6f742077686974656c697374656400000000000000000060448201526064016105ab565b61110a818686611185565b61111581868661135a565b611120818686611464565b5061074c6001600055565b6002600054141561117e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ab565b6002600055565b600a5460ff8316106111cb5760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081d1a595c881a59608a1b60448201526064016105ab565b8060ff16600a8360ff16815481106111e5576111e5612786565b600091825260209091206003909102015461ffff1610156112335760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b60448201526064016105ab565b600d546001600160a01b03841660009081526002602052604090206001015463ffffffff90811664010000000090920416146112ad576001600160a01b0383166000908152600260205260408120908155600d546001909101805464010000000090920463ffffffff1663ffffffff199092169190911790555b6006546001600160a01b0384166000908152600260205260409020546112d79060ff841690612aac565b11156113255760405162461bcd60e51b815260206004820152601860248201527f4c696d6974207065722077616c6c65742072656163686564000000000000000060448201526064016105ab565b6001600160a01b0383166000908152600260205260408120805460ff84169290611350908490612aac565b9091555050505050565b60008160ff16600a8460ff168154811061137657611376612786565b9060005260206000209060030201600101546113929190612ac4565b600354600480546040516323b872dd60e01b81526001600160a01b038981169382019390935290821660248201526044810184905292935016906323b872dd906064016020604051808303816000875af11580156113f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114189190612b17565b61074c5760405162461bcd60e51b815260206004820152601860248201527f5061796d656e742077617320756e7375636365737366756c000000000000000060448201526064016105ab565b8060ff16600a8360ff168154811061147e5761147e612786565b60009182526020822060039091020180549091906114a190849061ffff16612b39565b92506101000a81548161ffff021916908361ffff1602179055506107788383836114d3565b6114d081336116ca565b50565b60005b8160ff168160ff16101561074c5760005b600a8460ff16815481106114fd576114fd612786565b600091825260209091206002600390920201015461ffff168110156115cf5760008061153f8361152d8787612b54565b60ff1661153a9190612aac565b611723565b9150915061154e8288836118cc565b600d546040805160ff891681526001600160a01b038581166020830152918101849052908916606082015264010000000090910463ffffffff1660808201527fb48a3f4dab3b7d9c6a59f8fd2b97e1336ce85b34bc2c9bc96b59f964cfa7b0c39060a00160405180910390a1505080806115c79061285f565b9150506114e7565b50806115da816127dc565b9150506114d6565b6115ec8282610af7565b6105e95760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6116578282610af7565b156105e95760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000826116c18584611ab1565b14949350505050565b6116d48282610af7565b6105e9576116e181611afe565b6116ec836020611b10565b6040516020016116fd929190612ba1565b60408051601f198184030181529082905262461bcd60e51b82526105ab91600401612c16565b6000806000611767600c60008154811061173f5761173f612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff1685611cb2565b9050600061177482611d31565b905061177f81611ee7565b600b8161ffff168154811061179657611796612786565b906000526020600020906003020160010154600b8261ffff16815481106117bf576117bf612786565b90600052602060002090600302016000015411156118145760405162461bcd60e51b815260206004820152601260248201527113999d081c995dd85c99081cdbdb191bdd5d60721b60448201526064016105ab565b6000600b8261ffff168154811061182d5761182d612786565b90600052602060002090600302016000015490506000600b8361ffff168154811061185a5761185a612786565b906000526020600020906003020160020160009054906101000a90046001600160a01b031690506001600b8461ffff168154811061189a5761189a612786565b906000526020600020906003020160000160008282546118ba9190612aac565b90915550909791965090945050505050565b60005b600e5460ff82161015611a49576000846001600160a01b031662fdd58e600e8460ff168154811061190257611902612786565b60009182526020909120015460405160e083901b6001600160e01b03191681526001600160a01b03909116600482015260248101869052604401602060405180830381865afa158015611959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197d9190612c49565b1115611a3757836001600160a01b031663f242432a600e8360ff16815481106119a8576119a8612786565b600091825260208220015460405160e084901b6001600160e01b03191681526001600160a01b0391821660048201529087166024820152604481018690526001606482015260a0608482015260a481019190915260c401600060405180830381600087803b158015611a1957600080fd5b505af1158015611a2d573d6000803e3d6000fd5b5050505050505050565b80611a41816127dc565b9150506118cf565b506040516340c10f1960e01b81526001600160a01b038381166004830152602482018390528416906340c10f1990604401600060405180830381600087803b158015611a9457600080fd5b505af1158015611aa8573d6000803e3d6000fd5b50505050505050565b600081815b8451811015611af657611ae282868381518110611ad557611ad5612786565b602002602001015161211b565b915080611aee8161285f565b915050611ab6565b509392505050565b60606105116001600160a01b03831660145b60606000611b1f836002612ac4565b611b2a906002612aac565b6001600160401b03811115611b4157611b41612468565b6040519080825280601f01601f191660200182016040528015611b6b576020820181803683370190505b509050600360fc1b81600081518110611b8657611b86612786565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611bb557611bb5612786565b60200101906001600160f81b031916908160001a9053506000611bd9846002612ac4565b611be4906001612aac565b90505b6001811115611c5c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611c1857611c18612786565b1a60f81b828281518110611c2e57611c2e612786565b60200101906001600160f81b031916908160001a90535060049490941c93611c5581612b00565b9050611be7565b508315611cab5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105ab565b9392505050565b604080514160601b6bffffffffffffffffffffffff191660208083019190915282516014818403018152603483018452805190820120426054840152446074840152609483015260b48083018590528351808403909101815260d49092019092528051910120600090611d26908490612c78565b611cab906001612aac565b600080600090508261ffff16600c600081548110611d5157611d51612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff161015611dd15760405162461bcd60e51b815260206004820152602760248201527f56616c756520697320626967676572207468616e2072656d61696e696e6720656044820152666c656d656e747360c81b60648201526084016105ab565b600d5462010000900461ffff16611de98260026127b2565b611df4906002612ae3565b61ffff161015611ed6576000611e0b8260026127b2565b611e16906001612ae3565b90506000611e258360026127b2565b611e30906002612ae3565b9050600c8261ffff1681548110611e4957611e49612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff168561ffff1611611e8357819250611ecf565b809250600c8261ffff1681548110611e9d57611e9d612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff1685611ecc9190612b39565b94505b5050611dd1565b600d54611cab9061ffff1682612b39565b600d54600090611efb9061ffff1683612ae3565b90506000600c8261ffff1681548110611f1657611f16612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff1611611f945760405162461bcd60e51b815260206004820152602660248201527f456c656d656e7420697320616c726561647920636f6e7461696e696e6720302060448201526576616c75657360d01b60648201526084016105ab565b600c8161ffff1681548110611fab57611fab612786565b906000526020600020906010918282040191900660020281819054906101000a900461ffff1680929190611fde90612c8c565b91906101000a81548161ffff021916908361ffff160217905550505b61ffff8116156105e95761200f600282612caa565b61ffff1660011415612029578061202581612ccb565b9150505b60006001612038600284612ce3565b6120429190612b39565b9050600c8261ffff168154811061205b5761205b612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff16600c61208a600185612b39565b61ffff168154811061209e5761209e612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff166120cc9190612ae3565b600c8261ffff16815481106120e3576120e3612786565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff16021790555080915050611ffa565b6000818310612137576000828152602084905260409020611cab565b6000838152602083905260409020611cab565b50805460008255906000526020600020908101906114d09190612278565b50805460008255600302906000526020600020908101906114d0919061228d565b50805460008255600302906000526020600020908101906114d091906122bb565b50805460008255600f0160109004906000526020600020908101906114d09190612278565b82805482825590600052602060002090600f016010900481019282156122685791602002820160005b8382111561223857835183826101000a81548161ffff021916908361ffff16021790555092602001926002016020816001010492830192600103026121f8565b80156122665782816101000a81549061ffff0219169055600201602081600101049283019260010302612238565b505b50612274929150612278565b5090565b5b808211156122745760008155600101612279565b5b8082111561227457805461ffff19908116825560006001830155600282018054909116905560030161228e565b5b8082111561227457600080825560018201556002810180546001600160a01b03191690556003016122bc565b6000602082840312156122fa57600080fd5b81356001600160e01b031981168114611cab57600080fd5b60006020828403121561232457600080fd5b5035919050565b803560ff8116811461233c57600080fd5b919050565b6000806040838503121561235457600080fd5b61235d8361232b565b915061236b6020840161232b565b90509250929050565b60006020828403121561238657600080fd5b611cab8261232b565b6001600160a01b03811681146114d057600080fd5b803561233c8161238f565b6000806000606084860312156123c457600080fd5b83356123cf8161238f565b92506123dd6020850161232b565b91506123eb6040850161232b565b90509250925092565b6000806040838503121561240757600080fd5b8235915060208301356124198161238f565b809150509250929050565b600080600080600060a0868803121561243c57600080fd5b85356124478161238f565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561249157600080fd5b82356001600160401b03808211156124a857600080fd5b818501915085601f8301126124bc57600080fd5b8135818111156124ce576124ce612468565b8060051b604051601f19603f830116810181811085821117156124f3576124f3612468565b60405291825284820192508381018501918883111561251157600080fd5b938501935b8285101561253657612527856123a4565b84529385019392850192612516565b98975050505050505050565b60008083601f84011261255457600080fd5b5081356001600160401b0381111561256b57600080fd5b60208301915083602060608302850101111561258657600080fd5b9250929050565b600080602083850312156125a057600080fd5b82356001600160401b038111156125b657600080fd5b6125c285828601612542565b90969095509350505050565b60008083601f8401126125e057600080fd5b5081356001600160401b038111156125f757600080fd5b6020830191508360208260051b850101111561258657600080fd5b60008060006040848603121561262757600080fd5b83356126328161238f565b925060208401356001600160401b0381111561264d57600080fd5b612659868287016125ce565b9497909650939450505050565b60006020828403121561267857600080fd5b8135611cab8161238f565b60008060008060006080868803121561269b57600080fd5b85356126a68161238f565b94506126b46020870161232b565b93506126c26040870161232b565b925060608601356001600160401b03808211156126de57600080fd5b818801915088601f8301126126f257600080fd5b81358181111561270157600080fd5b89602082850101111561271357600080fd5b9699959850939650602001949392505050565b6000806000806060858703121561273c57600080fd5b6127458561232b565b93506127536020860161232b565b925060408501356001600160401b0381111561276e57600080fd5b61277a878288016125ce565b95989497509550505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600061ffff808316818516818304811182151516156127d3576127d361279c565b02949350505050565b600060ff821660ff8114156127f3576127f361279c565b60010192915050565b6000813561ffff8116811461051157600080fd5b61282f61281c836127fc565b825461ffff191661ffff91909116178255565b602082013560018201556105e9612848604084016127fc565b6002830161ffff821661ffff198254161781555050565b60006000198214156128735761287361279c565b5060010190565b813581556020820135600182015560028101604083013561289a8161238f565b81546001600160a01b0319166001600160a01b03919091161790555050565b60ff851681526001600160a01b03841660208201526060604082018190528101829052818360808301376000818301608090810191909152601f909201601f191601019392505050565b600063ffffffff8083168185168083038211156129225761292261279c565b01949350505050565b600181815b8085111561296657816000190482111561294c5761294c61279c565b8085161561295957918102915b93841c9390800290612930565b509250929050565b60008261297d57506001610511565b8161298a57506000610511565b81600181146129a057600281146129aa576129c6565b6001915050610511565b60ff8411156129bb576129bb61279c565b50506001821b610511565b5060208310610133831016604e8410600b84101617156129e9575081810a610511565b6129f3838361292b565b8060001904821115612a0757612a0761279c565b029392505050565b6000611cab6001600160401b0384168361296e565b60006001600160401b0380831681811415612a4157612a4161279c565b6001019392505050565b600082821015612a5d57612a5d61279c565b500390565b60006001600160401b038083168185168083038211156129225761292261279c565b60006001600160401b0383811690831681811015612aa457612aa461279c565b039392505050565b60008219821115612abf57612abf61279c565b500190565b6000816000190483118215151615612ade57612ade61279c565b500290565b600061ffff8083168185168083038211156129225761292261279c565b600081612b0f57612b0f61279c565b506000190190565b600060208284031215612b2957600080fd5b81518015158114611cab57600080fd5b600061ffff83811690831681811015612aa457612aa461279c565b600060ff821660ff84168160ff0481118215151615612a0757612a0761279c565b60005b83811015612b90578181015183820152602001612b78565b8381111561074c5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612bd9816017850160208801612b75565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612c0a816028840160208801612b75565b01602801949350505050565b6020815260008251806020840152612c35816040850160208701612b75565b601f01601f19169190910160400192915050565b600060208284031215612c5b57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082612c8757612c87612c62565b500690565b600061ffff821680612ca057612ca061279c565b6000190192915050565b600061ffff80841680612cbf57612cbf612c62565b92169190910692915050565b600061ffff80831681811415612a4157612a4161279c565b600061ffff80841680612cf857612cf8612c62565b9216919091049291505056fea2646970667358221220e0b31d2dcc9adb0ad3af43d74047b14f7560daa6a3d22e43b95667171a82a23664736f6c634300080c0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063667022fd1161010f578063acec599e116100a2578063dc31755011610071578063dc317550146104a9578063ebf0c717146104b1578063fda49eb4146104ba578063ff12e08d146104cd57600080fd5b8063acec599e14610444578063bfb231d21461044c578063d547741f14610483578063dab5f3401461049657600080fd5b806378e97925116100de57806378e979251461041757806391d14854146104205780639292caaf14610433578063a217fddf1461043c57600080fd5b8063667022fd1461037f578063671d6429146103c6578063698a55d5146103d9578063785e9e86146103ec57600080fd5b80633197cbb6116101875780634196d0b8116101565780634196d0b81461033d578063453c231014610350578063457110e8146103595780635a23dd991461036c57600080fd5b80633197cbb6146102fb5780633524f5981461030457806336568abe146103175780633c6f38291461032a57600080fd5b80631f0b1423116101c35780631f0b14231461028b578063248a9ca31461029e5780632f2ff15d146102c257806331352936146102d557600080fd5b806301ffc9a7146101f5578063039af9eb1461021d578063142cbfe4146102555780631e1a0c0c1461026a575b600080fd5b6102086102033660046122e8565b6104e0565b60405190151581526020015b60405180910390f35b61023061022b366004612312565b610517565b6040805161ffff94851681526020810193909352921691810191909152606001610214565b610268610263366004612341565b610550565b005b61027d610278366004612374565b6105ed565b604051908152602001610214565b6102686102993660046123af565b610635565b61027d6102ac366004612312565b6000908152600160208190526040909120015490565b6102686102d03660046123f4565b610752565b6102e86102e3366004612312565b61077d565b60405161ffff9091168152602001610214565b61027d60095481565b610268610312366004612424565b6107b5565b6102686103253660046123f4565b6107f9565b61026861033836600461247e565b610873565b61026861034b36600461258d565b6108fd565b61027d60065481565b61026861036736600461258d565b610976565b61020861037a366004612612565b6109e3565b6103ac61038d366004612666565b6002602052600090815260409020805460019091015463ffffffff1682565b6040805192835263ffffffff909116602083015201610214565b6102686103d4366004612666565b610a63565b6102686103e7366004612683565b610a91565b6003546103ff906001600160a01b031681565b6040516001600160a01b039091168152602001610214565b61027d60085481565b61020861042e3660046123f4565b610af7565b61027d60075481565b61027d600081565b610268610b22565b61045f61045a366004612312565b610b95565b6040805193845260208401929092526001600160a01b031690820152606001610214565b6102686104913660046123f4565b610bd1565b6102686104a4366004612312565b610bf7565b610268610c08565b61027d60055481565b6004546103ff906001600160a01b031681565b6102686104db366004612726565b611034565b60006001600160e01b03198216637965db0b60e01b148061051157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600a818154811061052757600080fd5b600091825260209091206003909102018054600182015460029092015461ffff91821693501683565b4260085411158015610563575042600954115b6105b45760405162461bcd60e51b815260206004820152601960248201527f44726f7020686173206e6f74207374617274656420796574210000000000000060448201526064015b60405180910390fd5b6105bc61112b565b336105c8818484611185565b6105d381848461135a565b6105de818484611464565b506105e96001600055565b5050565b600a5460009060ff83161061060457506000919050565b600a8260ff168154811061061a5761061a612786565b600091825260209091206003909102015461ffff1692915050565b6000610640816114c6565b600a5460ff8416106106865760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081d1a595c881a59608a1b60448201526064016105ab565b8160ff16600a8460ff16815481106106a0576106a0612786565b60009182526020909120600260039092020101546106c2919061ffff166127b2565b61ffff16600c6000815481106106da576106da612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff1610156107415760405162461bcd60e51b8152602060048201526014602482015273139bdd08195b9bdd59da081b999d1cc81b19599d60621b60448201526064016105ab565b61074c8484846114d3565b50505050565b6000828152600160208190526040909120015461076e816114c6565b61077883836115e2565b505050565b600c818154811061078d57600080fd5b9060005260206000209060109182820401919006600202915054906101000a900461ffff1681565b60006107c0816114c6565b50600380546001600160a01b0319166001600160a01b039690961695909517909455600692909255600891909155600991909155600755565b6001600160a01b03811633146108695760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016105ab565b6105e9828261164d565b600061087e816114c6565b61088a600e600061214a565b60005b82518160ff16101561077857600e838260ff16815181106108b0576108b0612786565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806108f5816127dc565b91505061088d565b6000610908816114c6565b610914600a6000612168565b60005b8281101561074c57600a84848381811061093357610933612786565b8354600181018555600094855260209094206060909102929092019260030290910190506109618282612810565b5050808061096e9061285f565b915050610917565b6000610981816114c6565b60005b8281101561074c57600b8484838181106109a0576109a0612786565b8354600181018555600094855260209094206060909102929092019260030290910190506109ce828261287a565b505080806109db9061285f565b915050610984565b6000610a5b838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506005546040516bffffffffffffffffffffffff1960608b901b1660208201529092506034019050604051602081830303815290604052805190602001206116b4565b949350505050565b6000610a6e816114c6565b50600480546001600160a01b0319166001600160a01b0392909216919091179055565b6000610a9c816114c6565b610aa7868686611185565b610ab2868686611464565b7f51b720e2ad3ad5be6b819d17d845c066a39969c0b85b2daf4a4bf8f69079114b85878585604051610ae794939291906128b9565b60405180910390a1505050505050565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610b2d816114c6565b610b39600b6000612189565b600d805463ffffffff19169055610b52600c60006121aa565b6001600d60048282829054906101000a900463ffffffff16610b749190612903565b92506101000a81548163ffffffff021916908363ffffffff16021790555050565b600b8181548110610ba557600080fd5b60009182526020909120600390910201805460018201546002909201549092506001600160a01b031683565b60008281526001602081905260409091200154610bed816114c6565b610778838361164d565b6000610c02816114c6565b50600555565b6000610c13816114c6565b60005b600b54610c24826002612a0f565b1015610c3c5780610c3481612a24565b915050610c16565b6001610c49826002612a0f565b610c539190612a4b565b600d805461ffff191661ffff929092169190911790556001610c758282612a62565b610c80906002612a0f565b610c8a9190612a4b565b600d805463ffff000019166201000061ffff938416810291909117918290559004166001600160401b03811115610cc357610cc3612468565b604051908082528060200260200182016040528015610cec578160200160208202803683370190505b508051610d0191600c916020909101906121cf565b50600d5460009061ffff165b600d5462010000900461ffff166001600160401b038216108015610d3b5750600b546001600160401b038316105b15610e3e57600d54600b90610d549061ffff1683612a84565b6001600160401b031681548110610d6d57610d6d612786565b6000918252602090912060039091020154600d54600b90610d929061ffff1684612a84565b6001600160401b031681548110610dab57610dab612786565b906000526020600020906003020160010154610dc79190612a4b565b610dd2906001612aac565b600c826001600160401b031681548110610dee57610dee612786565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055508180610e2890612a24565b9250508080610e3690612a24565b915050610d0d565b50600d5460016201000090910461ffff1611156107785760006002610e638482612a0f565b610e6d9190612a4b565b90505b60018110610f7157600c610e85826002612ac4565b610e90906002612aac565b81548110610ea057610ea0612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff16600c826002610ed39190612ac4565b610ede906001612aac565b81548110610eee57610eee612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff16610f1c9190612ae3565b600c8281548110610f2f57610f2f612786565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055508080610f6990612b00565b915050610e70565b50600c600281548110610f8657610f86612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff16600c600181548110610fbe57610fbe612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff16610fec9190612ae3565b600c60008154811061100057611000612786565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff160217905550505050565b4260075411158015611047575042600954115b61109f5760405162461bcd60e51b815260206004820152602360248201527f44726f702077686974656c69737420686173206e6f742073746172746564207960448201526265742160e81b60648201526084016105ab565b6110a761112b565b336110b38184846109e3565b6110ff5760405162461bcd60e51b815260206004820152601760248201527f55736572206973206e6f742077686974656c697374656400000000000000000060448201526064016105ab565b61110a818686611185565b61111581868661135a565b611120818686611464565b5061074c6001600055565b6002600054141561117e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105ab565b6002600055565b600a5460ff8316106111cb5760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081d1a595c881a59608a1b60448201526064016105ab565b8060ff16600a8360ff16815481106111e5576111e5612786565b600091825260209091206003909102015461ffff1610156112335760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b60448201526064016105ab565b600d546001600160a01b03841660009081526002602052604090206001015463ffffffff90811664010000000090920416146112ad576001600160a01b0383166000908152600260205260408120908155600d546001909101805464010000000090920463ffffffff1663ffffffff199092169190911790555b6006546001600160a01b0384166000908152600260205260409020546112d79060ff841690612aac565b11156113255760405162461bcd60e51b815260206004820152601860248201527f4c696d6974207065722077616c6c65742072656163686564000000000000000060448201526064016105ab565b6001600160a01b0383166000908152600260205260408120805460ff84169290611350908490612aac565b9091555050505050565b60008160ff16600a8460ff168154811061137657611376612786565b9060005260206000209060030201600101546113929190612ac4565b600354600480546040516323b872dd60e01b81526001600160a01b038981169382019390935290821660248201526044810184905292935016906323b872dd906064016020604051808303816000875af11580156113f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114189190612b17565b61074c5760405162461bcd60e51b815260206004820152601860248201527f5061796d656e742077617320756e7375636365737366756c000000000000000060448201526064016105ab565b8060ff16600a8360ff168154811061147e5761147e612786565b60009182526020822060039091020180549091906114a190849061ffff16612b39565b92506101000a81548161ffff021916908361ffff1602179055506107788383836114d3565b6114d081336116ca565b50565b60005b8160ff168160ff16101561074c5760005b600a8460ff16815481106114fd576114fd612786565b600091825260209091206002600390920201015461ffff168110156115cf5760008061153f8361152d8787612b54565b60ff1661153a9190612aac565b611723565b9150915061154e8288836118cc565b600d546040805160ff891681526001600160a01b038581166020830152918101849052908916606082015264010000000090910463ffffffff1660808201527fb48a3f4dab3b7d9c6a59f8fd2b97e1336ce85b34bc2c9bc96b59f964cfa7b0c39060a00160405180910390a1505080806115c79061285f565b9150506114e7565b50806115da816127dc565b9150506114d6565b6115ec8282610af7565b6105e95760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6116578282610af7565b156105e95760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000826116c18584611ab1565b14949350505050565b6116d48282610af7565b6105e9576116e181611afe565b6116ec836020611b10565b6040516020016116fd929190612ba1565b60408051601f198184030181529082905262461bcd60e51b82526105ab91600401612c16565b6000806000611767600c60008154811061173f5761173f612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff1685611cb2565b9050600061177482611d31565b905061177f81611ee7565b600b8161ffff168154811061179657611796612786565b906000526020600020906003020160010154600b8261ffff16815481106117bf576117bf612786565b90600052602060002090600302016000015411156118145760405162461bcd60e51b815260206004820152601260248201527113999d081c995dd85c99081cdbdb191bdd5d60721b60448201526064016105ab565b6000600b8261ffff168154811061182d5761182d612786565b90600052602060002090600302016000015490506000600b8361ffff168154811061185a5761185a612786565b906000526020600020906003020160020160009054906101000a90046001600160a01b031690506001600b8461ffff168154811061189a5761189a612786565b906000526020600020906003020160000160008282546118ba9190612aac565b90915550909791965090945050505050565b60005b600e5460ff82161015611a49576000846001600160a01b031662fdd58e600e8460ff168154811061190257611902612786565b60009182526020909120015460405160e083901b6001600160e01b03191681526001600160a01b03909116600482015260248101869052604401602060405180830381865afa158015611959573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197d9190612c49565b1115611a3757836001600160a01b031663f242432a600e8360ff16815481106119a8576119a8612786565b600091825260208220015460405160e084901b6001600160e01b03191681526001600160a01b0391821660048201529087166024820152604481018690526001606482015260a0608482015260a481019190915260c401600060405180830381600087803b158015611a1957600080fd5b505af1158015611a2d573d6000803e3d6000fd5b5050505050505050565b80611a41816127dc565b9150506118cf565b506040516340c10f1960e01b81526001600160a01b038381166004830152602482018390528416906340c10f1990604401600060405180830381600087803b158015611a9457600080fd5b505af1158015611aa8573d6000803e3d6000fd5b50505050505050565b600081815b8451811015611af657611ae282868381518110611ad557611ad5612786565b602002602001015161211b565b915080611aee8161285f565b915050611ab6565b509392505050565b60606105116001600160a01b03831660145b60606000611b1f836002612ac4565b611b2a906002612aac565b6001600160401b03811115611b4157611b41612468565b6040519080825280601f01601f191660200182016040528015611b6b576020820181803683370190505b509050600360fc1b81600081518110611b8657611b86612786565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611bb557611bb5612786565b60200101906001600160f81b031916908160001a9053506000611bd9846002612ac4565b611be4906001612aac565b90505b6001811115611c5c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611c1857611c18612786565b1a60f81b828281518110611c2e57611c2e612786565b60200101906001600160f81b031916908160001a90535060049490941c93611c5581612b00565b9050611be7565b508315611cab5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105ab565b9392505050565b604080514160601b6bffffffffffffffffffffffff191660208083019190915282516014818403018152603483018452805190820120426054840152446074840152609483015260b48083018590528351808403909101815260d49092019092528051910120600090611d26908490612c78565b611cab906001612aac565b600080600090508261ffff16600c600081548110611d5157611d51612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff161015611dd15760405162461bcd60e51b815260206004820152602760248201527f56616c756520697320626967676572207468616e2072656d61696e696e6720656044820152666c656d656e747360c81b60648201526084016105ab565b600d5462010000900461ffff16611de98260026127b2565b611df4906002612ae3565b61ffff161015611ed6576000611e0b8260026127b2565b611e16906001612ae3565b90506000611e258360026127b2565b611e30906002612ae3565b9050600c8261ffff1681548110611e4957611e49612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff168561ffff1611611e8357819250611ecf565b809250600c8261ffff1681548110611e9d57611e9d612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff1685611ecc9190612b39565b94505b5050611dd1565b600d54611cab9061ffff1682612b39565b600d54600090611efb9061ffff1683612ae3565b90506000600c8261ffff1681548110611f1657611f16612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff1611611f945760405162461bcd60e51b815260206004820152602660248201527f456c656d656e7420697320616c726561647920636f6e7461696e696e6720302060448201526576616c75657360d01b60648201526084016105ab565b600c8161ffff1681548110611fab57611fab612786565b906000526020600020906010918282040191900660020281819054906101000a900461ffff1680929190611fde90612c8c565b91906101000a81548161ffff021916908361ffff160217905550505b61ffff8116156105e95761200f600282612caa565b61ffff1660011415612029578061202581612ccb565b9150505b60006001612038600284612ce3565b6120429190612b39565b9050600c8261ffff168154811061205b5761205b612786565b60009182526020909120601082040154600f9091166002026101000a900461ffff16600c61208a600185612b39565b61ffff168154811061209e5761209e612786565b90600052602060002090601091828204019190066002029054906101000a900461ffff166120cc9190612ae3565b600c8261ffff16815481106120e3576120e3612786565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff16021790555080915050611ffa565b6000818310612137576000828152602084905260409020611cab565b6000838152602083905260409020611cab565b50805460008255906000526020600020908101906114d09190612278565b50805460008255600302906000526020600020908101906114d0919061228d565b50805460008255600302906000526020600020908101906114d091906122bb565b50805460008255600f0160109004906000526020600020908101906114d09190612278565b82805482825590600052602060002090600f016010900481019282156122685791602002820160005b8382111561223857835183826101000a81548161ffff021916908361ffff16021790555092602001926002016020816001010492830192600103026121f8565b80156122665782816101000a81549061ffff0219169055600201602081600101049283019260010302612238565b505b50612274929150612278565b5090565b5b808211156122745760008155600101612279565b5b8082111561227457805461ffff19908116825560006001830155600282018054909116905560030161228e565b5b8082111561227457600080825560018201556002810180546001600160a01b03191690556003016122bc565b6000602082840312156122fa57600080fd5b81356001600160e01b031981168114611cab57600080fd5b60006020828403121561232457600080fd5b5035919050565b803560ff8116811461233c57600080fd5b919050565b6000806040838503121561235457600080fd5b61235d8361232b565b915061236b6020840161232b565b90509250929050565b60006020828403121561238657600080fd5b611cab8261232b565b6001600160a01b03811681146114d057600080fd5b803561233c8161238f565b6000806000606084860312156123c457600080fd5b83356123cf8161238f565b92506123dd6020850161232b565b91506123eb6040850161232b565b90509250925092565b6000806040838503121561240757600080fd5b8235915060208301356124198161238f565b809150509250929050565b600080600080600060a0868803121561243c57600080fd5b85356124478161238f565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561249157600080fd5b82356001600160401b03808211156124a857600080fd5b818501915085601f8301126124bc57600080fd5b8135818111156124ce576124ce612468565b8060051b604051601f19603f830116810181811085821117156124f3576124f3612468565b60405291825284820192508381018501918883111561251157600080fd5b938501935b8285101561253657612527856123a4565b84529385019392850192612516565b98975050505050505050565b60008083601f84011261255457600080fd5b5081356001600160401b0381111561256b57600080fd5b60208301915083602060608302850101111561258657600080fd5b9250929050565b600080602083850312156125a057600080fd5b82356001600160401b038111156125b657600080fd5b6125c285828601612542565b90969095509350505050565b60008083601f8401126125e057600080fd5b5081356001600160401b038111156125f757600080fd5b6020830191508360208260051b850101111561258657600080fd5b60008060006040848603121561262757600080fd5b83356126328161238f565b925060208401356001600160401b0381111561264d57600080fd5b612659868287016125ce565b9497909650939450505050565b60006020828403121561267857600080fd5b8135611cab8161238f565b60008060008060006080868803121561269b57600080fd5b85356126a68161238f565b94506126b46020870161232b565b93506126c26040870161232b565b925060608601356001600160401b03808211156126de57600080fd5b818801915088601f8301126126f257600080fd5b81358181111561270157600080fd5b89602082850101111561271357600080fd5b9699959850939650602001949392505050565b6000806000806060858703121561273c57600080fd5b6127458561232b565b93506127536020860161232b565b925060408501356001600160401b0381111561276e57600080fd5b61277a878288016125ce565b95989497509550505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600061ffff808316818516818304811182151516156127d3576127d361279c565b02949350505050565b600060ff821660ff8114156127f3576127f361279c565b60010192915050565b6000813561ffff8116811461051157600080fd5b61282f61281c836127fc565b825461ffff191661ffff91909116178255565b602082013560018201556105e9612848604084016127fc565b6002830161ffff821661ffff198254161781555050565b60006000198214156128735761287361279c565b5060010190565b813581556020820135600182015560028101604083013561289a8161238f565b81546001600160a01b0319166001600160a01b03919091161790555050565b60ff851681526001600160a01b03841660208201526060604082018190528101829052818360808301376000818301608090810191909152601f909201601f191601019392505050565b600063ffffffff8083168185168083038211156129225761292261279c565b01949350505050565b600181815b8085111561296657816000190482111561294c5761294c61279c565b8085161561295957918102915b93841c9390800290612930565b509250929050565b60008261297d57506001610511565b8161298a57506000610511565b81600181146129a057600281146129aa576129c6565b6001915050610511565b60ff8411156129bb576129bb61279c565b50506001821b610511565b5060208310610133831016604e8410600b84101617156129e9575081810a610511565b6129f3838361292b565b8060001904821115612a0757612a0761279c565b029392505050565b6000611cab6001600160401b0384168361296e565b60006001600160401b0380831681811415612a4157612a4161279c565b6001019392505050565b600082821015612a5d57612a5d61279c565b500390565b60006001600160401b038083168185168083038211156129225761292261279c565b60006001600160401b0383811690831681811015612aa457612aa461279c565b039392505050565b60008219821115612abf57612abf61279c565b500190565b6000816000190483118215151615612ade57612ade61279c565b500290565b600061ffff8083168185168083038211156129225761292261279c565b600081612b0f57612b0f61279c565b506000190190565b600060208284031215612b2957600080fd5b81518015158114611cab57600080fd5b600061ffff83811690831681811015612aa457612aa461279c565b600060ff821660ff84168160ff0481118215151615612a0757612a0761279c565b60005b83811015612b90578181015183820152602001612b78565b8381111561074c5750506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612bd9816017850160208801612b75565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612c0a816028840160208801612b75565b01602801949350505050565b6020815260008251806020840152612c35816040850160208701612b75565b601f01601f19169190910160400192915050565b600060208284031215612c5b57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082612c8757612c87612c62565b500690565b600061ffff821680612ca057612ca061279c565b6000190192915050565b600061ffff80841680612cbf57612cbf612c62565b92169190910692915050565b600061ffff80831681811415612a4157612a4161279c565b600061ffff80841680612cf857612cf8612c62565b9216919091049291505056fea2646970667358221220e0b31d2dcc9adb0ad3af43d74047b14f7560daa6a3d22e43b95667171a82a23664736f6c634300080c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 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.