Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
810 NFES2
Holders
299
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
3 NFES2Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
NFes2
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 20 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.9; //import "erc721psi/contracts/ERC721Psi.sol"; import "erc721psi/contracts/extension/ERC721PsiAddressData.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "operator-filter-registry/src/DefaultOperatorFilterer.sol"; import "./libs/IDescriptor.sol"; import "contract-allow-list/contracts/proxy/interface/IContractAllowListProxy.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; abstract contract NFes2State { /////////////////////////////////////////////////////////////////////////// // Enum / Struct /////////////////////////////////////////////////////////////////////////// enum SalePhase { FreeMint, PreSale1, PreSale2, PublicSale } /////////////////////////////////////////////////////////////////////////// // Constants /////////////////////////////////////////////////////////////////////////// uint256 public constant MAX_SUPPLY = 1500; address public constant PRIMARY_ADDRESS = 0xB9Bd747986c543aC94bCfdD0FA6EdD711853D5c0; /////////////////////////////////////////////////////////////////////////// // Variables /////////////////////////////////////////////////////////////////////////// address public withdrawAddress = 0xEB080d202DFb816318c08503A9E8f261ACf48fDb; // CAL IContractAllowListProxy public CAL; uint256 public CALLevel = 1; // AL mapping(SalePhase => mapping(address => uint16)) public allowLists; mapping(address => uint16[4]) public limitedMintedAmount; // Sale Status bool public paused = true; SalePhase public salePhase; uint16[4] public maxMintAmountPerTx = [ 2, 3, 3, 3 ]; // Automatic sale control bool public usePeriodSale = true; uint256[4] public timeStart = [ 1676188800, /* 2/12 1700JST */ 1676197800, /* 2/12 1930JST */ 1676206800, /* 2/12 2200JST*/ 0 ]; uint256[4] public timeDuration = [ 2 hours, 2 hours, 2 hours, 0 ]; // cost uint256[4] public cost = [ 0, 0.03 ether, 0.03 ether, 0.04 ether ]; // metadata IDescriptor public descriptor; // royalty address public royaltyAddress = withdrawAddress; uint96 public royaltyFee = 500; // default:5% // SBT bool public isSBT; /////////////////////////////////////////////////////////////////////////// // Error Functions /////////////////////////////////////////////////////////////////////////// error ZeroAddress(); error InvlidRoyaltyFee(uint256 fee); error SaleIsPaused(); error NoAllocationInThisSale(); error InsufficientAllocation(); error ArrayLengthNotMatch(); error MintAmountExceeded(); error MaxSupplyExceeded(); error InsufficientFunds(); error CallerNotUser(); error MintAmountIsZero(); error ProhibitedBecauseSBT(); error NotAllowedByCAL(address operator); } abstract contract NFes2Admin is NFes2State, IERC2981, DefaultOperatorFilterer, AccessControl, Ownable, ERC721PsiAddressData { /////////////////////////////////////////////////////////////////////////// // Withdraw funds /////////////////////////////////////////////////////////////////////////// function withdraw() public payable onlyAdmin { (bool os, ) = payable(withdrawAddress).call{ value: address(this).balance }(""); require(os); } /////////////////////////////////////////////////////////////////////////// // Owner Mint function /////////////////////////////////////////////////////////////////////////// function adminMint(address to, uint256 quantity) public onlyAdmin { _mint(to, quantity); } /////////////////////////////////////////////////////////////////////////// // Setter functions /////////////////////////////////////////////////////////////////////////// function setWithdrawAddress(address addr) external onlyAdmin { if (addr == address(0)) revert ZeroAddress(); withdrawAddress = addr; } function setPause(bool state) external onlyAdmin { paused = state; } function setSalePhase(SalePhase phase) external onlyAdmin { salePhase = phase; } function setCost(uint256 newCost, SalePhase phase) external onlyAdmin { cost[uint256(phase)] = newCost; } function setAllowList(SalePhase phase, address[] memory addr, uint16[] memory alloc) external onlyAdmin { uint256 len = addr.length; if (len != alloc.length) revert ArrayLengthNotMatch(); for (uint256 i = 0; i < len; i++) { allowLists[phase][addr[i]] = alloc[i]; } } function setDescriptor(IDescriptor _new) external onlyAdmin { descriptor = _new; } function setRoyaltyAddress(address _new) external onlyAdmin { if (_new == address(0)) revert ZeroAddress(); royaltyAddress = _new; } function setRoyaltyFee(uint96 _new) external onlyAdmin { if (_new >= 10000) revert InvlidRoyaltyFee(_new); royaltyFee = _new; } function setIsSBT(bool _state) external onlyAdmin { isSBT = _state; } function setTimeStart(SalePhase phase, uint256 newTime) external onlyAdmin { timeStart[uint256(phase)] = newTime; } function setTimeDuration(uint256 index, uint256 newDuration) external onlyAdmin { timeDuration[index] = newDuration; } function setUsePeriodSale(bool _state) external onlyAdmin { usePeriodSale = _state; } function setCAL(IContractAllowListProxy _newCAL) external onlyAdmin { CAL = _newCAL; } function setCALLevel(uint256 _newLevel) external onlyAdmin { CALLevel = _newLevel; } /////////////////////////////////////////////////////////////////////////// // Essential getter functions /////////////////////////////////////////////////////////////////////////// /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, IERC165, ERC721Psi) returns (bool) { return interfaceId == type(IERC2981).interfaceId || AccessControl.supportsInterface(interfaceId) || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo( uint256, /*_tokenId*/ uint256 _salePrice ) public view virtual override returns (address, uint256) { return (royaltyAddress, (_salePrice * uint256(royaltyFee)) / 10000); } /////////////////////////////////////////////////////////////////////////// // State functions /////////////////////////////////////////////////////////////////////////// /* function nowOnSale() external view whenOnSale returns (bool) { return true; } */ function nowOnSale() public view returns (bool) { if (paused) { if (!usePeriodSale) { return false; } else { uint256 index = uint256(salePhase); uint256 start = timeStart[index]; return (start <= block.timestamp && block.timestamp <= start + timeDuration[index]); } } return true; } /////////////////////////////////////////////////////////////////////////// // Modifiers /////////////////////////////////////////////////////////////////////////// modifier onlyAdmin() { _checkRole(DEFAULT_ADMIN_ROLE); _; } modifier whenOnSale() { if (!nowOnSale()) revert SaleIsPaused(); _; } modifier callerIsUser() { if (tx.origin != msg.sender) revert CallerNotUser(); _; } modifier whenValidMintAmount(uint256 amount) { // Check mint amount in one transaction if (amount > maxMintAmountPerTx[uint256(salePhase)]) revert MintAmountExceeded(); if (amount == 0) revert MintAmountIsZero(); SalePhase phase = salePhase; if (phase != SalePhase.PublicSale) { if (allowLists[phase][msg.sender] == 0) revert NoAllocationInThisSale(); // Check remaining quantity of allocation uint256 alloc = allowLists[phase][msg.sender]; if ( alloc < amount + limitedMintedAmount[msg.sender][uint256(phase)] ) revert InsufficientAllocation(); } _; } modifier whenEnoughFunds(uint256 value, uint256 amount) { if (value < (amount * cost[uint256(salePhase)])) revert InsufficientFunds(); _; } } contract NFes2 is NFes2Admin { using Strings for uint256; /////////////////////////////////////////////////////////////////////////// // Constructor /////////////////////////////////////////////////////////////////////////// constructor() ERC721Psi("NFTFestival2nd", "NFES2") { _transferOwnership(PRIMARY_ADDRESS); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(DEFAULT_ADMIN_ROLE, PRIMARY_ADDRESS); // TODO _mint(PRIMARY_ADDRESS, 1); // _mint(owner(), 10); } /////////////////////////////////////////////////////////////////////////// // Mint functions /////////////////////////////////////////////////////////////////////////// function mint(uint256 amount) external payable whenOnSale callerIsUser whenValidMintAmount(amount) whenEnoughFunds(msg.value, amount) { limitedMintedAmount[msg.sender][uint256(salePhase)] += uint16(amount); // _safeMint is not needed because under CallerIsUser _mint(msg.sender, amount); } function _mint(address to, uint256 quantity) internal override { if (quantity + totalSupply() > MAX_SUPPLY) revert MaxSupplyExceeded(); super._mint(to, quantity); } /////////////////////////////////////////////////////////////////////////// // Metadata functions /////////////////////////////////////////////////////////////////////////// function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token"); return descriptor.tokenURI(tokenId); } /////////////////////////////////////////////////////////////////////////// // Transfer functions /////////////////////////////////////////////////////////////////////////// function transferFrom( address from, address to, uint256 tokenId ) public override onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId ) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual override { if ( isSBT && from != address(0) && to != address(0x000000000000000000000000000000000000dEaD) ) revert ProhibitedBecauseSBT(); super._beforeTokenTransfers(from, to, startTokenId, quantity); } /////////////////////////////////////////////////////////////////////////// // Approve functions /////////////////////////////////////////////////////////////////////////// function setApprovalForAll(address operator, bool approved) public virtual override onlyAllowedOperatorApproval(operator) { if (approved){ if (isSBT) revert ProhibitedBecauseSBT(); if (address(CAL) != address(0)){ if (!CAL.isAllowed(operator, CALLevel)) revert NotAllowedByCAL(operator); } } super.setApprovalForAll(operator, approved); } function approve(address operator, uint256 tokenId) public virtual override onlyAllowedOperatorApproval(operator) { if (operator != address(0)) { if (isSBT) revert ProhibitedBecauseSBT(); if (address(CAL) != address(0)){ if (!CAL.isAllowed(operator, CALLevel)) revert NotAllowedByCAL(operator); } } super.approve(operator, tokenId); } }
// 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.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// 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 pragma solidity >=0.7.0 <0.9.0; interface IContractAllowListProxy { function isAllowed(address _transferer, uint256 _level) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface IDescriptor { function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT /** ______ _____ _____ ______ ___ __ _ _ _ | ____| __ \ / ____|____ |__ \/_ | || || | | |__ | |__) | | / / ) || | \| |/ | | __| | _ /| | / / / / | |\_ _/ | |____| | \ \| |____ / / / /_ | | | | |______|_| \_\\_____|/_/ |____||_| |_| - github: https://github.com/estarriolvetch/ERC721Psi - npm: https://www.npmjs.com/package/erc721psi */ pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; import "solidity-bits/contracts/BitMaps.sol"; contract ERC721Psi is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; using BitMaps for BitMaps.BitMap; BitMaps.BitMap private _batchHead; string private _name; string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) internal _owners; uint256 private _currentIndex; mapping(uint256 => address) private _tokenApprovals; mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal pure returns (uint256) { // It will become modifiable in the future versions return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { return _currentIndex - _startTokenId(); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint) { require(owner != address(0), "ERC721Psi: balance query for the zero address"); uint count; for( uint i = _startTokenId(); i < _nextTokenId(); ++i ){ if(_exists(i)){ if( owner == ownerOf(i)){ ++count; } } } return count; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { (address owner, ) = _ownerAndBatchHeadOf(tokenId); return owner; } function _ownerAndBatchHeadOf(uint256 tokenId) internal view returns (address owner, uint256 tokenIdBatchHead){ require(_exists(tokenId), "ERC721Psi: owner query for nonexistent token"); tokenIdBatchHead = _getBatchHead(tokenId); owner = _owners[tokenIdBatchHead]; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ownerOf(tokenId); require(to != owner, "ERC721Psi: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721Psi: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require( _exists(tokenId), "ERC721Psi: approved query for nonexistent token" ); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721Psi: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721Psi: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721Psi: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, 1,_data), "ERC721Psi: transfer to non ERC721Receiver implementer" ); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return tokenId < _nextTokenId() && _startTokenId() <= tokenId; } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require( _exists(tokenId), "ERC721Psi: operator query for nonexistent token" ); address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ""); } function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { uint256 nextTokenId = _nextTokenId(); _mint(to, quantity); require( _checkOnERC721Received(address(0), to, nextTokenId, quantity, _data), "ERC721Psi: transfer to non ERC721Receiver implementer" ); } function _mint( address to, uint256 quantity ) internal virtual { uint256 nextTokenId = _nextTokenId(); require(quantity > 0, "ERC721Psi: quantity must be greater 0"); require(to != address(0), "ERC721Psi: mint to the zero address"); _beforeTokenTransfers(address(0), to, nextTokenId, quantity); _currentIndex += quantity; _owners[nextTokenId] = to; _batchHead.set(nextTokenId); _afterTokenTransfers(address(0), to, nextTokenId, quantity); // Emit events for(uint256 tokenId=nextTokenId; tokenId < nextTokenId + quantity; tokenId++){ emit Transfer(address(0), to, tokenId); } } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { (address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf(tokenId); require( owner == from, "ERC721Psi: transfer of token that is not own" ); require(to != address(0), "ERC721Psi: transfer to the zero address"); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId); uint256 subsequentTokenId = tokenId + 1; if(!_batchHead.get(subsequentTokenId) && subsequentTokenId < _nextTokenId() ) { _owners[subsequentTokenId] = from; _batchHead.set(subsequentTokenId); } _owners[tokenId] = to; if(tokenId != tokenIdBatchHead) { _batchHead.set(tokenId); } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param startTokenId uint256 the first ID of the tokens to be transferred * @param quantity uint256 amount of the tokens to be transfered. * @param _data bytes optional data to send along with the call * @return r bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 startTokenId, uint256 quantity, bytes memory _data ) private returns (bool r) { if (to.isContract()) { r = true; for(uint256 tokenId = startTokenId; tokenId < startTokenId + quantity; tokenId++){ try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { r = r && retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721Psi: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } return r; } else { return true; } } function _getBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdBatchHead) { tokenIdBatchHead = _batchHead.scanForward(tokenId); } function totalSupply() public virtual view returns (uint256) { return _totalMinted(); } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * This function is compatiable with ERC721AQueryable. */ function tokensOfOwner(address owner) external view virtual returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { if (_exists(i)) { if (ownerOf(i) == owner) { tokenIds[tokenIdsIdx++] = i; } } } return tokenIds; } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} }
// SPDX-License-Identifier: MIT /** ______ _____ _____ ______ ___ __ _ _ _ | ____| __ \ / ____|____ |__ \/_ | || || | | |__ | |__) | | / / ) || | \| |/ | | __| | _ /| | / / / / | |\_ _/ | |____| | \ \| |____ / / / /_ | | | | |______|_| \_\\_____|/_/ |____||_| |_| */ pragma solidity ^0.8.0; import "solidity-bits/contracts/BitMaps.sol"; import "../ERC721Psi.sol"; /** @dev This extension follows the AddressData format of ERC721A, so it can be a dropped-in replacement for the contract that requires AddressData */ abstract contract ERC721PsiAddressData is ERC721Psi { // Mapping owner address to address data mapping(address => AddressData) _addressData; // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; // For miscellaneous variable(s) pertaining to the address // (e.g. number of whitelist mint slots used). // If there are multiple variables, please pack them into a uint64. uint64 aux; } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint) { require(owner != address(0), "ERC721Psi: balance query for the zero address"); return uint256(_addressData[owner].balance); } /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal override virtual { require(quantity < 2 ** 64); uint64 _quantity = uint64(quantity); if(from != address(0)){ _addressData[from].balance -= _quantity; } else { // Mint _addressData[to].numberMinted += _quantity; } if(to != address(0)){ _addressData[to].balance += _quantity; } else { // Burn _addressData[from].numberBurned += _quantity; } super._afterTokenTransfers(from, to, startTokenId, quantity); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; import {CANONICAL_CORI_SUBSCRIPTION} from "./lib/Constants.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. * @dev Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { /// @dev The constructor that is called when the contract is being deployed. constructor() OperatorFilterer(CANONICAL_CORI_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; import {CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. * Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract OperatorFilterer { /// @dev Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS); /// @dev The constructor that is called when the contract is being deployed. constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } /** * @dev A helper function to check if an operator is allowed. */ modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } /** * @dev A helper function to check if an operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @dev A helper function to check if an operator is allowed. */ function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // under normal circumstances, this function will revert rather than return false, but inheriting contracts // may specify their own OperatorFilterRegistry implementations, which may behave differently if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - npm: https://www.npmjs.com/package/solidity-bits - github: https://github.com/estarriolvetch/solidity-bits */ pragma solidity ^0.8.0; import "./BitScan.sol"; /** * @dev This Library is a modified version of Openzeppelin's BitMaps library. * Functions of finding the index of the closest set bit from a given index are added. * The indexing of each bucket is modifed to count from the MSB to the LSB instead of from the LSB to the MSB. * The modification of indexing makes finding the closest previous set bit more efficient in gas usage. */ /** * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential. * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. */ library BitMaps { using BitScan for uint256; uint256 private constant MASK_INDEX_ZERO = (1 << 255); uint256 private constant MASK_FULL = type(uint256).max; struct BitMap { mapping(uint256 => uint256) _data; } /** * @dev Returns whether the bit at `index` is set. */ function get(BitMap storage bitmap, uint256 index) internal view returns (bool) { uint256 bucket = index >> 8; uint256 mask = MASK_INDEX_ZERO >> (index & 0xff); return bitmap._data[bucket] & mask != 0; } /** * @dev Sets the bit at `index` to the boolean `value`. */ function setTo( BitMap storage bitmap, uint256 index, bool value ) internal { if (value) { set(bitmap, index); } else { unset(bitmap, index); } } /** * @dev Sets the bit at `index`. */ function set(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = MASK_INDEX_ZERO >> (index & 0xff); bitmap._data[bucket] |= mask; } /** * @dev Unsets the bit at `index`. */ function unset(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = MASK_INDEX_ZERO >> (index & 0xff); bitmap._data[bucket] &= ~mask; } /** * @dev Consecutively sets `amount` of bits starting from the bit at `startIndex`. */ function setBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { bitmap._data[bucket] |= MASK_FULL << (256 - amount) >> bucketStartIndex; } else { bitmap._data[bucket] |= MASK_FULL >> bucketStartIndex; amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { bitmap._data[bucket] = MASK_FULL; amount -= 256; bucket++; } bitmap._data[bucket] |= MASK_FULL << (256 - amount); } } } /** * @dev Consecutively unsets `amount` of bits starting from the bit at `startIndex`. */ function unsetBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal { uint256 bucket = startIndex >> 8; uint256 bucketStartIndex = (startIndex & 0xff); unchecked { if(bucketStartIndex + amount < 256) { bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount) >> bucketStartIndex); } else { bitmap._data[bucket] &= ~(MASK_FULL >> bucketStartIndex); amount -= (256 - bucketStartIndex); bucket++; while(amount > 256) { bitmap._data[bucket] = 0; amount -= 256; bucket++; } bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount)); } } } /** * @dev Find the closest index of the set bit before `index`. */ function scanForward(BitMap storage bitmap, uint256 index) internal view returns (uint256 setBitIndex) { uint256 bucket = index >> 8; // index within the bucket uint256 bucketIndex = (index & 0xff); // load a bitboard from the bitmap. uint256 bb = bitmap._data[bucket]; // offset the bitboard to scan from `bucketIndex`. bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex) if(bb > 0) { unchecked { setBitIndex = (bucket << 8) | (bucketIndex - bb.bitScanForward256()); } } else { while(true) { require(bucket > 0, "BitMaps: The set bit before the index doesn't exist."); unchecked { bucket--; } // No offset. Always scan from the least significiant bit now. bb = bitmap._data[bucket]; if(bb > 0) { unchecked { setBitIndex = (bucket << 8) | (255 - bb.bitScanForward256()); break; } } } } } function getBucket(BitMap storage bitmap, uint256 bucket) internal view returns (uint256) { return bitmap._data[bucket]; } }
// SPDX-License-Identifier: MIT /** _____ ___ ___ __ ____ _ __ / ___/____ / (_)___/ (_) /___ __ / __ )(_) /______ \__ \/ __ \/ / / __ / / __/ / / / / __ / / __/ ___/ ___/ / /_/ / / / /_/ / / /_/ /_/ / / /_/ / / /_(__ ) /____/\____/_/_/\__,_/_/\__/\__, / /_____/_/\__/____/ /____/ - npm: https://www.npmjs.com/package/solidity-bits - github: https://github.com/estarriolvetch/solidity-bits */ pragma solidity ^0.8.0; library BitScan { uint256 constant private DEBRUIJN_256 = 0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff; bytes constant private LOOKUP_TABLE_256 = hex"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8"; /** @dev Isolate the least significant set bit. */ function isolateLS1B256(uint256 bb) pure internal returns (uint256) { require(bb > 0); unchecked { return bb & (0 - bb); } } /** @dev Isolate the most significant set bit. */ function isolateMS1B256(uint256 bb) pure internal returns (uint256) { require(bb > 0); unchecked { bb |= bb >> 128; bb |= bb >> 64; bb |= bb >> 32; bb |= bb >> 16; bb |= bb >> 8; bb |= bb >> 4; bb |= bb >> 2; bb |= bb >> 1; return (bb >> 1) + 1; } } /** @dev Find the index of the lest significant set bit. (trailing zero count) */ function bitScanForward256(uint256 bb) pure internal returns (uint8) { unchecked { return uint8(LOOKUP_TABLE_256[(isolateLS1B256(bb) * DEBRUIJN_256) >> 248]); } } /** @dev Find the index of the most significant set bit. */ function bitScanReverse256(uint256 bb) pure internal returns (uint8) { unchecked { return 255 - uint8(LOOKUP_TABLE_256[((isolateMS1B256(bb) * DEBRUIJN_256) >> 248)]); } } function log2(uint256 bb) pure internal returns (uint8) { unchecked { return uint8(LOOKUP_TABLE_256[(isolateMS1B256(bb) * DEBRUIJN_256) >> 248]); } } }
{ "optimizer": { "enabled": true, "runs": 20 }, "viaIR": false, "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"},{"inputs":[],"name":"ArrayLengthNotMatch","type":"error"},{"inputs":[],"name":"CallerNotUser","type":"error"},{"inputs":[],"name":"InsufficientAllocation","type":"error"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"InvlidRoyaltyFee","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintAmountExceeded","type":"error"},{"inputs":[],"name":"MintAmountIsZero","type":"error"},{"inputs":[],"name":"NoAllocationInThisSale","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"NotAllowedByCAL","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"ProhibitedBecauseSBT","type":"error"},{"inputs":[],"name":"SaleIsPaused","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"CAL","outputs":[{"internalType":"contract IContractAllowListProxy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CALLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRIMARY_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"adminMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum NFes2State.SalePhase","name":"","type":"uint8"},{"internalType":"address","name":"","type":"address"}],"name":"allowLists","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"descriptor","outputs":[{"internalType":"contract IDescriptor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"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":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSBT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"limitedMintedAmount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"maxMintAmountPerTx","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nowOnSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"royaltyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyFee","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"salePhase","outputs":[{"internalType":"enum NFes2State.SalePhase","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum NFes2State.SalePhase","name":"phase","type":"uint8"},{"internalType":"address[]","name":"addr","type":"address[]"},{"internalType":"uint16[]","name":"alloc","type":"uint16[]"}],"name":"setAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IContractAllowListProxy","name":"_newCAL","type":"address"}],"name":"setCAL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newLevel","type":"uint256"}],"name":"setCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCost","type":"uint256"},{"internalType":"enum NFes2State.SalePhase","name":"phase","type":"uint8"}],"name":"setCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IDescriptor","name":"_new","type":"address"}],"name":"setDescriptor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setIsSBT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_new","type":"address"}],"name":"setRoyaltyAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"_new","type":"uint96"}],"name":"setRoyaltyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum NFes2State.SalePhase","name":"phase","type":"uint8"}],"name":"setSalePhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"setTimeDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum NFes2State.SalePhase","name":"phase","type":"uint8"},{"internalType":"uint256","name":"newTime","type":"uint256"}],"name":"setTimeStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setUsePeriodSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setWithdrawAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"timeDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"timeStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usePeriodSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdrawAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
600080546001600160a01b03191673eb080d202dfb816318c08503a9e8f261acf48fdb179055600160028181556005805460ff19169092179091556101006040526080908152600360a081905260c081905260e0526200006490600690600462000934565b506007805460ff19166001179055604080516080810182526363e89c8081526363e8bfa860208201526363e8e2d09181019190915260006060820152620000b0906008906004620009d0565b5060408051608081018252611c20808252602082018190529181019190915260006060820152620000e690600c90600462000a09565b506040805160808101825260008152666a94d74f4300006020820181905291810191909152668e1bc9bf04000060608201526200012890601090600462000a40565b506000546001600160a01b0316607d60a21b176015553480156200014b57600080fd5b50604080518082018252600e81526d13919511995cdd1a5d985b0c9b9960921b60208083019190915282518084019093526005835264272322a99960d91b9083015290733cc6cdda760b79bafa08df41ecfa224f810dceb660016daaeb6d7670e522a718067333cd4e3b15620002ea5780156200023857604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200021957600080fd5b505af11580156200022e573d6000803e3d6000fd5b50505050620002ea565b6001600160a01b03821615620002895760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401620001fe565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620002d057600080fd5b505af1158015620002e5573d6000803e3d6000fd5b505050505b50620002f890503362000391565b601a62000306838262000b38565b50601b62000315828262000b38565b50506000601d55506200033c73b9bd747986c543ac94bcfdd0fa6edd711853d5c062000391565b62000349600033620003e3565b6200036a600073b9bd747986c543ac94bcfdd0fa6edd711853d5c0620003e3565b6200038b73b9bd747986c543ac94bcfdd0fa6edd711853d5c060016200046e565b62000caf565b601880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b620003ef8282620004be565b6200046a5760008281526017602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620004293390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6105dc6200047b620004eb565b62000487908362000c1a565b1115620004a757604051638a164f6360e01b815260040160405180910390fd5b6200046a8282620004fc60201b62001add1760201c565b60008281526017602090815260408083206001600160a01b038516845290915290205460ff165b92915050565b6000620004f7620006b5565b905090565b600062000508601d5490565b9050600082116200056e5760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b60648201526084015b60405180910390fd5b6001600160a01b038316620005d25760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b606482015260840162000565565b620005e16000848385620006c7565b81601d6000828254620005f5919062000c1a565b90915550506000818152601c6020908152604090912080546001600160a01b0319166001600160a01b0386161790556200063d90601990839062000732811b62001c6a17901c565b6200064c60008483856200075e565b805b6200065a838362000c1a565b811015620006af5760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480620006a68162000c30565b9150506200064e565b50505050565b600080601d54620004f7919062000c4c565b60165460ff168015620006e257506001600160a01b03841615155b8015620006fa57506001600160a01b03831661dead14155b15620007195760405163f30c72c560e01b815260040160405180910390fd5b620006af84848484620006af60201b62000e1d1760201c565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6801000000000000000081106200077457600080fd5b806001600160a01b03851615620007e1576001600160a01b038516600090815260208052604081208054839290620007b79084906001600160401b031662000c62565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555062000847565b6001600160a01b038416600090815260208052604090208054829190600890620008229084906801000000000000000090046001600160401b031662000c8c565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b03841615620008b3576001600160a01b038416600090815260208052604081208054839290620008899084906001600160401b031662000c8c565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555062000914565b6001600160a01b038516600090815260208052604090208054829190601090620008ef908490600160801b90046001600160401b031662000c8c565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6200092d85858585620006af60201b62000e1d1760201c565b5050505050565b600183019183908215620009be5791602002820160005b838211156200098c57835183826101000a81548161ffff021916908360ff16021790555092602001926002016020816001010492830192600103026200094b565b8015620009bc5782816101000a81549061ffff02191690556002016020816001010492830192600103026200098c565b505b50620009cc92915062000a7c565b5090565b8260048101928215620009be579160200282015b82811115620009be578251829063ffffffff16905591602001919060010190620009e4565b8260048101928215620009be579160200282015b82811115620009be578251829061ffff1690559160200191906001019062000a1d565b8260048101928215620009be579160200282015b82811115620009be578251829066ffffffffffffff1690559160200191906001019062000a54565b5b80821115620009cc576000815560010162000a7d565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168062000abe57607f821691505b60208210810362000adf57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000b3357600081815260208120601f850160051c8101602086101562000b0e5750805b601f850160051c820191505b8181101562000b2f5782815560010162000b1a565b5050505b505050565b81516001600160401b0381111562000b545762000b5462000a93565b62000b6c8162000b65845462000aa9565b8462000ae5565b602080601f83116001811462000ba4576000841562000b8b5750858301515b600019600386901b1c1916600185901b17855562000b2f565b600085815260208120601f198616915b8281101562000bd55788860151825594840194600190910190840162000bb4565b508582101562000bf45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b80820180821115620004e557620004e562000c04565b60006001820162000c455762000c4562000c04565b5060010190565b81810381811115620004e557620004e562000c04565b6001600160401b0382811682821603908082111562000c855762000c8562000c04565b5092915050565b6001600160401b0381811683821601908082111562000c855762000c8562000c04565b61377c8062000cbf6000396000f3fe6080604052600436106102cd5760003560e01c80636352211e116101775780636352211e146106a85780636f95423c146106c857806370a08231146106fb578063715018a61461071b5780637686f48b146107305780637ad594311461076c5780638462151c1461078c5780638da5cb5b146107b95780639097548d146107ce57806391d14854146107ee57806395d89b411461080e5780639c1d12fc14610823578063a0712d6814610843578063a18b1d4814610856578063a217fddf14610870578063a22cb46514610885578063ad2f852a146108a5578063b88d4fde146108c5578063b8997a97146108e5578063bedb86fb14610919578063c87b56dd14610939578063cf3d49c414610959578063cf99640a14610979578063d547741f146109a1578063df9cc7e3146109c1578063e3bb2eec146109e1578063e4f2487a14610a01578063e58306f914610a2d578063e985e9c514610a4d578063f2fde38b14610a6d578063fcd1aac914610a8d57600080fd5b806301b9a397146102d257806301ffc9a7146102f4578063025e332e1461032957806306d254da1461034957806306fdde0314610369578063081812fc1461038b578063095ea7b3146103b85780630f4345e2146103d85780631581b600146103f857806318160ddd14610418578063235c19f91461043b57806323b872dd1461045b578063248a9ca31461047b5780632a55205a1461049b5780632bc0e377146104c95780632f2ff15d146104de578063303e74df146104fe57806331faafb41461051e57806332cb6b0c1461053e57806336568abe14610554578063396e8f53146105745780633ab1a494146105945780633c215c91146105b45780633ccfd60b146105d45780633cf40df3146105dc57806341f43434146105f657806342842e0e1461061857806346b7d755146106385780634f3db3461461065857806355c492381461066e5780635c975abb1461068e575b600080fd5b3480156102de57600080fd5b506102f26102ed366004612cda565b610aad565b005b34801561030057600080fd5b5061031461030f366004612d0d565b610ad9565b60405190151581526020015b60405180910390f35b34801561033557600080fd5b506102f2610344366004612cda565b610b13565b34801561035557600080fd5b506102f2610364366004612cda565b610b3f565b34801561037557600080fd5b5061037e610b92565b6040516103209190612d7a565b34801561039757600080fd5b506103ab6103a6366004612d8d565b610c24565b6040516103209190612da6565b3480156103c457600080fd5b506102f26103d3366004612dba565b610cb4565b3480156103e457600080fd5b506102f26103f3366004612d8d565b610da5565b34801561040457600080fd5b506000546103ab906001600160a01b031681565b34801561042457600080fd5b5061042d610db4565b604051908152602001610320565b34801561044757600080fd5b506102f2610456366004612dfa565b610dc3565b34801561046757600080fd5b506102f2610476366004612e16565b610df8565b34801561048757600080fd5b5061042d610496366004612d8d565b610e23565b3480156104a757600080fd5b506104bb6104b6366004612e57565b610e38565b604051610320929190612e79565b3480156104d557600080fd5b50610314610e7e565b3480156104ea57600080fd5b506102f26104f9366004612e92565b610f11565b34801561050a57600080fd5b506014546103ab906001600160a01b031681565b34801561052a57600080fd5b506102f2610539366004612ec2565b610f2d565b34801561054a57600080fd5b5061042d6105dc81565b34801561056057600080fd5b506102f261056f366004612e92565b610f8c565b34801561058057600080fd5b506001546103ab906001600160a01b031681565b3480156105a057600080fd5b506102f26105af366004612cda565b61100a565b3480156105c057600080fd5b506102f26105cf366004612eeb565b61105d565b6102f261107c565b3480156105e857600080fd5b506016546103149060ff1681565b34801561060257600080fd5b506103ab6daaeb6d7670e522a718067333cd4e81565b34801561062457600080fd5b506102f2610633366004612e16565b6110e9565b34801561064457600080fd5b506102f2610653366004612f25565b61110e565b34801561066457600080fd5b5061042d60025481565b34801561067a57600080fd5b506102f2610689366004612e57565b61112b565b34801561069a57600080fd5b506005546103149060ff1681565b3480156106b457600080fd5b506103ab6106c3366004612d8d565b611149565b3480156106d457600080fd5b506106e86106e3366004612d8d565b61115d565b60405161ffff9091168152602001610320565b34801561070757600080fd5b5061042d610716366004612cda565b61118b565b34801561072757600080fd5b506102f261121d565b34801561073c57600080fd5b506106e861074b366004612f42565b600360209081526000928352604080842090915290825290205461ffff1681565b34801561077857600080fd5b506102f2610787366004612f6e565b611231565b34801561079857600080fd5b506107ac6107a7366004612cda565b611264565b6040516103209190612f89565b3480156107c557600080fd5b506103ab61132a565b3480156107da57600080fd5b5061042d6107e9366004612d8d565b611339565b3480156107fa57600080fd5b50610314610809366004612e92565b611350565b34801561081a57600080fd5b5061037e61137b565b34801561082f57600080fd5b506102f261083e3660046130b2565b61138a565b6102f2610851366004612d8d565b611481565b34801561086257600080fd5b506007546103149060ff1681565b34801561087c57600080fd5b5061042d600081565b34801561089157600080fd5b506102f26108a0366004613185565b61178e565b3480156108b157600080fd5b506015546103ab906001600160a01b031681565b3480156108d157600080fd5b506102f26108e03660046131da565b611871565b3480156108f157600080fd5b5060155461090c90600160a01b90046001600160601b031681565b6040516103209190613283565b34801561092557600080fd5b506102f2610934366004612f25565b611897565b34801561094557600080fd5b5061037e610954366004612d8d565b6118b4565b34801561096557600080fd5b5061042d610974366004612d8d565b61198f565b34801561098557600080fd5b506103ab73b9bd747986c543ac94bcfdd0fa6edd711853d5c081565b3480156109ad57600080fd5b506102f26109bc366004612e92565b61199f565b3480156109cd57600080fd5b506106e86109dc366004612dba565b6119bb565b3480156109ed57600080fd5b5061042d6109fc366004612d8d565b6119f8565b348015610a0d57600080fd5b50600554610a2090610100900460ff1681565b60405161032091906132ad565b348015610a3957600080fd5b506102f2610a48366004612dba565b611a08565b348015610a5957600080fd5b50610314610a683660046132d5565b611a1c565b348015610a7957600080fd5b506102f2610a88366004612cda565b611a4a565b348015610a9957600080fd5b506102f2610aa8366004612f25565b611ac0565b610ab76000611c96565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b0319821663152a902d60e11b1480610afe5750610afe82611ca0565b80610b0d5750610b0d82611cd5565b92915050565b610b1d6000611c96565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b610b496000611c96565b6001600160a01b038116610b705760405163d92e233d60e01b815260040160405180910390fd5b601580546001600160a01b0319166001600160a01b0392909216919091179055565b6060601a8054610ba1906132f3565b80601f0160208091040260200160405190810160405280929190818152602001828054610bcd906132f3565b8015610c1a5780601f10610bef57610100808354040283529160200191610c1a565b820191906000526020600020905b815481529060010190602001808311610bfd57829003601f168201915b5050505050905090565b6000610c2f82611d15565b610c985760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152601e60205260409020546001600160a01b031690565b81610cbe81611d31565b6001600160a01b03831615610d965760165460ff1615610cf15760405163f30c72c560e01b815260040160405180910390fd5b6001546001600160a01b031615610d9657600154600254604051630f8350ed60e41b81526001600160a01b039092169163f8350ed091610d3691879190600401612e79565b602060405180830381865afa158015610d53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d77919061332d565b610d9657826040516338332a8160e11b8152600401610c8f9190612da6565b610da08383611de1565b505050565b610daf6000611c96565b600255565b6000610dbe611ef1565b905090565b610dcd6000611c96565b806008836003811115610de257610de2613297565b60048110610df257610df261334a565b01555050565b826001600160a01b0381163314610e1257610e1233611d31565b610e1d848484611f01565b50505050565b60009081526017602052604090206001015490565b60155460009081906001600160a01b0381169061271090610e6990600160a01b90046001600160601b031686613376565b610e73919061338d565b915091509250929050565b60055460009060ff1615610f0b5760075460ff16610e9c5750600090565b600554600090610100900460ff166003811115610ebb57610ebb613297565b9050600060088260048110610ed257610ed261334a565b01549050428111158015610f045750600c8260048110610ef457610ef461334a565b0154610f0090826133af565b4211155b9250505090565b50600190565b610f1a82610e23565b610f2381611c96565b610da08383611f32565b610f376000611c96565b612710816001600160601b031610610f6457806040516349d647ad60e01b8152600401610c8f9190613283565b601580546001600160601b03909216600160a01b026001600160a01b03909216919091179055565b6001600160a01b0381163314610ffc5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c8f565b6110068282611fb8565b5050565b6110146000611c96565b6001600160a01b03811661103b5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6110676000611c96565b816010826003811115610de257610de2613297565b6110866000611c96565b600080546040516001600160a01b039091169047908381818185875af1925050503d80600081146110d3576040519150601f19603f3d011682016040523d82523d6000602084013e6110d8565b606091505b50509050806110e657600080fd5b50565b826001600160a01b03811633146111035761110333611d31565b610e1d84848461201f565b6111186000611c96565b6007805460ff1916911515919091179055565b6111356000611c96565b80600c8360048110610df257610df261334a565b6000806111558361203a565b509392505050565b6006816004811061116d57600080fd5b60109182820401919006600202915054906101000a900461ffff1681565b60006001600160a01b0382166111f95760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610c8f565b506001600160a01b031660009081526020805260409020546001600160401b031690565b6112256120d1565b61122f6000612130565b565b61123b6000611c96565b6005805482919061ff00191661010083600381111561125c5761125c613297565b021790555050565b60606000806112728461118b565b90506000816001600160401b0381111561128e5761128e612fcd565b6040519080825280602002602001820160405280156112b7578160200160208202803683370190505b50905060005b828414611321576112cd81611d15565b1561131957856001600160a01b03166112e582611149565b6001600160a01b031603611319578082858060010196508151811061130c5761130c61334a565b6020026020010181815250505b6001016112bd565b50949350505050565b6018546001600160a01b031690565b6010816004811061134957600080fd5b0154905081565b60009182526017602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060601b8054610ba1906132f3565b6113946000611c96565b8151815181146113b75760405163ed882f7160e01b815260040160405180910390fd5b60005b8181101561147a578281815181106113d4576113d461334a565b6020026020010151600360008760038111156113f2576113f2613297565b600381111561140357611403613297565b815260200190815260200160002060008684815181106114255761142561334a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548161ffff021916908361ffff1602179055508080611472906133c2565b9150506113ba565b5050505050565b611489610e7e565b6114a657604051631c7324b560e21b815260040160405180910390fd5b3233146114c657604051631c4e317f60e11b815260040160405180910390fd5b6005548190600690610100900460ff1660038111156114e7576114e7613297565b600481106114f7576114f761334a565b601091828204019190066002029054906101000a900461ffff1661ffff16811115611535576040516315bf7c7b60e31b815260040160405180910390fd5b8060000361155657604051631e97cd6360e21b815260040160405180910390fd5b600554610100900460ff16600381600381111561157557611575613297565b146116a4576003600082600381111561159057611590613297565b60038111156115a1576115a1613297565b81526020808201929092526040908101600090812033825290925281205461ffff1690036115e257604051632527687b60e21b815260040160405180910390fd5b6000600360008360038111156115fa576115fa613297565b600381111561160b5761160b613297565b81526020808201929092526040908101600090812033825283528181205460049093522061ffff909116915082600381111561164957611649613297565b600481106116595761165961334a565b601091828204019190066002029054906101000a900461ffff1661ffff168361168291906133af565b8110156116a2576040516337cb51dd60e21b815260040160405180910390fd5b505b34836010600560019054906101000a900460ff1660038111156116c9576116c9613297565b600481106116d9576116d961334a565b01546116e59082613376565b8210156117055760405163356680b760e01b815260040160405180910390fd5b336000908152600460205260409020600554869190610100900460ff16600381111561173357611733613297565b600481106117435761174361334a565b601091828204019190066002028282829054906101000a900461ffff1661176a91906133db565b92506101000a81548161ffff021916908361ffff16021790555061147a3386612182565b8161179881611d31565b81156118675760165460ff16156117c25760405163f30c72c560e01b815260040160405180910390fd5b6001546001600160a01b03161561186757600154600254604051630f8350ed60e41b81526001600160a01b039092169163f8350ed09161180791879190600401612e79565b602060405180830381865afa158015611824573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611848919061332d565b61186757826040516338332a8160e11b8152600401610c8f9190612da6565b610da083836121c0565b836001600160a01b038116331461188b5761188b33611d31565b61147a85858585612283565b6118a16000611c96565b6005805460ff1916911515919091179055565b60606118bf82611d15565b61191e5760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610c8f565b60145460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa158015611967573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b0d91908101906133fd565b6008816004811061134957600080fd5b6119a882610e23565b6119b181611c96565b610da08383611fb8565b600460205281600052604060002081600481106119d757600080fd5b60109182820401919006600202915091509054906101000a900461ffff1681565b600c816004811061134957600080fd5b611a126000611c96565b6110068282612182565b6001600160a01b039182166000908152601f6020908152604080832093909416825291909152205460ff1690565b611a526120d1565b6001600160a01b038116611ab75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c8f565b6110e681612130565b611aca6000611c96565b6016805460ff1916911515919091179055565b6000611ae8601d5490565b905060008211611b485760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610c8f565b6001600160a01b038316611baa5760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c8f565b611bb760008483856122b5565b81601d6000828254611bc991906133af565b90915550506000818152601c6020526040902080546001600160a01b0319166001600160a01b038516179055611c00601982611c6a565b611c0d6000848385612309565b805b611c1983836133af565b811015610e1d5760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480611c62816133c2565b915050611c0f565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6110e68133612483565b60006001600160e01b03198216637965db0b60e01b1480610b0d57506301ffc9a760e01b6001600160e01b0319831614610b0d565b60006001600160e01b031982166380ac58cd60e01b1480611d0657506001600160e01b03198216635b5e139f60e01b145b80610b0d5750610b0d82611ca0565b6000611d20601d5490565b82108015610b0d5750600192915050565b6daaeb6d7670e522a718067333cd4e3b156110e657604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611d9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc2919061332d565b6110e65780604051633b79c77360e21b8152600401610c8f9190612da6565b6000611dec82611149565b9050806001600160a01b0316836001600160a01b031603611e5b5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610c8f565b336001600160a01b0382161480611e775750611e778133611a1c565b611ee75760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527a081bdddb995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b602a1b6064820152608401610c8f565b610da083836124dc565b600080601d54610dbe919061346a565b611f0b338261254a565b611f275760405162461bcd60e51b8152600401610c8f9061347d565b610da0838383612617565b611f3c8282611350565b6110065760008281526017602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611f743390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611fc28282611350565b156110065760008281526017602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610da083838360405180602001604052806000815250611871565b60008061204683611d15565b6120a75760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c8f565b6120b08361281e565b6000818152601c60205260409020546001600160a01b031694909350915050565b336120da61132a565b6001600160a01b03161461122f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c8f565b601880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6105dc61218d610db4565b61219790836133af565b11156121b657604051638a164f6360e01b815260040160405180910390fd5b6110068282611add565b336001600160a01b038316036122175760405162461bcd60e51b815260206004820152601c60248201527b22a9219b9918a839b49d1030b8383937bb32903a379031b0b63632b960211b6044820152606401610c8f565b336000818152601f602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61228d338361254a565b6122a95760405162461bcd60e51b8152600401610c8f9061347d565b610e1d8484848461282b565b60165460ff1680156122cf57506001600160a01b03841615155b80156122e657506001600160a01b03831661dead14155b156123045760405163f30c72c560e01b815260040160405180910390fd5b610e1d565b600160401b811061231957600080fd5b806001600160a01b03851615612382576001600160a01b0385166000908152602080526040812080548392906123599084906001600160401b03166134d1565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506123e1565b6001600160a01b0384166000908152602080526040902080548291906008906123bc908490600160401b90046001600160401b03166134f1565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b03841615612449576001600160a01b0384166000908152602080526040812080548392906124209084906001600160401b03166134f1565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555061147a565b6001600160a01b038516600090815260208052604090208054829190601090612420908490600160801b90046001600160401b03166134f1565b61248d8282611350565b6110065761249a81612860565b6124a5836020612872565b6040516020016124b6929190613511565b60408051601f198184030181529082905262461bcd60e51b8252610c8f91600401612d7a565b6000818152601e6020526040902080546001600160a01b0319166001600160a01b038416908117909155819061251182611149565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061255582611d15565b6125b95760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610c8f565b60006125c483611149565b9050806001600160a01b0316846001600160a01b031614806125ff5750836001600160a01b03166125f484610c24565b6001600160a01b0316145b8061260f575061260f8185611a1c565b949350505050565b6000806126238361203a565b91509150846001600160a01b0316826001600160a01b03161461269d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610c8f565b6001600160a01b0384166127035760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610c8f565b61271085858560016122b5565b61271b6000846124dc565b60006127288460016133af565b600881901c600090815260196020526040902054909150600160ff1b60ff83161c161580156127585750601d5481105b1561278f576000818152601c6020526040902080546001600160a01b0319166001600160a01b03881617905561278f601982611c6a565b6000848152601c6020526040902080546001600160a01b0319166001600160a01b0387161790558184146127c8576127c8601985611c6a565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46128168686866001612309565b505050505050565b6000610b0d601983612a14565b612836848484612617565b612844848484600185612b0c565b610e1d5760405162461bcd60e51b8152600401610c8f90613580565b6060610b0d6001600160a01b03831660145b60606000612881836002613376565b61288c9060026133af565b6001600160401b038111156128a3576128a3612fcd565b6040519080825280601f01601f1916602001820160405280156128cd576020820181803683370190505b509050600360fc1b816000815181106128e8576128e861334a565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106129175761291761334a565b60200101906001600160f81b031916908160001a905350600061293b846002613376565b6129469060016133af565b90505b60018111156129be576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061297a5761297a61334a565b1a60f81b8282815181106129905761299061334a565b60200101906001600160f81b031916908160001a90535060049490941c936129b7816135d5565b9050612949565b508315612a0d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c8f565b9392505050565b600881901c60008181526020849052604081205490919060ff808516919082181c8015612a5657612a4481612c43565b60ff168203600884901b179350612b03565b60008311612ac35760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610c8f565b506000199091016000818152602086905260409020549091908015612afe57612aeb81612c43565b60ff0360ff16600884901b179350612b03565b612a56565b50505092915050565b60006001600160a01b0385163b15612c3657506001835b612b2d84866133af565b811015612c3057604051630a85bd0160e11b81526001600160a01b0387169063150b7a0290612b669033908b90869089906004016135ec565b6020604051808303816000875af1925050508015612ba1575060408051601f3d908101601f19168201909252612b9e91810190613629565b60015b612bfe573d808015612bcf576040519150601f19603f3d011682016040523d82523d6000602084013e612bd4565b606091505b508051600003612bf65760405162461bcd60e51b8152600401610c8f90613580565b805181602001fd5b828015612c1b57506001600160e01b03198116630a85bd0160e11b145b92505080612c28816133c2565b915050612b23565b50612c3a565b5060015b95945050505050565b60006040518061012001604052806101008152602001613647610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612c8c85612cad565b02901c81518110612c9f57612c9f61334a565b016020015160f81c92915050565b6000808211612cbb57600080fd5b5060008190031690565b6001600160a01b03811681146110e657600080fd5b600060208284031215612cec57600080fd5b8135612a0d81612cc5565b6001600160e01b0319811681146110e657600080fd5b600060208284031215612d1f57600080fd5b8135612a0d81612cf7565b60005b83811015612d45578181015183820152602001612d2d565b50506000910152565b60008151808452612d66816020860160208601612d2a565b601f01601f19169290920160200192915050565b602081526000612a0d6020830184612d4e565b600060208284031215612d9f57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b60008060408385031215612dcd57600080fd5b8235612dd881612cc5565b946020939093013593505050565b803560048110612df557600080fd5b919050565b60008060408385031215612e0d57600080fd5b612dd883612de6565b600080600060608486031215612e2b57600080fd5b8335612e3681612cc5565b92506020840135612e4681612cc5565b929592945050506040919091013590565b60008060408385031215612e6a57600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060408385031215612ea557600080fd5b823591506020830135612eb781612cc5565b809150509250929050565b600060208284031215612ed457600080fd5b81356001600160601b0381168114612a0d57600080fd5b60008060408385031215612efe57600080fd5b82359150612f0e60208401612de6565b90509250929050565b80151581146110e657600080fd5b600060208284031215612f3757600080fd5b8135612a0d81612f17565b60008060408385031215612f5557600080fd5b612f5e83612de6565b91506020830135612eb781612cc5565b600060208284031215612f8057600080fd5b612a0d82612de6565b6020808252825182820181905260009190848201906040850190845b81811015612fc157835183529284019291840191600101612fa5565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561300b5761300b612fcd565b604052919050565b60006001600160401b0382111561302c5761302c612fcd565b5060051b60200190565b600082601f83011261304757600080fd5b8135602061305c61305783613013565b612fe3565b82815260059290921b8401810191818101908684111561307b57600080fd5b8286015b848110156130a757803561ffff8116811461309a5760008081fd5b835291830191830161307f565b509695505050505050565b6000806000606084860312156130c757600080fd5b6130d084612de6565b92506020808501356001600160401b03808211156130ed57600080fd5b818701915087601f83011261310157600080fd5b813561310f61305782613013565b81815260059190911b8301840190848101908a83111561312e57600080fd5b938501935b8285101561315557843561314681612cc5565b82529385019390850190613133565b96505050604087013592508083111561316d57600080fd5b505061317b86828701613036565b9150509250925092565b6000806040838503121561319857600080fd5b82356131a381612cc5565b91506020830135612eb781612f17565b60006001600160401b038211156131cc576131cc612fcd565b50601f01601f191660200190565b600080600080608085870312156131f057600080fd5b84356131fb81612cc5565b9350602085013561320b81612cc5565b92506040850135915060608501356001600160401b0381111561322d57600080fd5b8501601f8101871361323e57600080fd5b803561324c613057826131b3565b81815288602083850101111561326157600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6001600160601b0391909116815260200190565b634e487b7160e01b600052602160045260246000fd5b60208101600483106132cf57634e487b7160e01b600052602160045260246000fd5b91905290565b600080604083850312156132e857600080fd5b8235612f5e81612cc5565b600181811c9082168061330757607f821691505b60208210810361332757634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561333f57600080fd5b8151612a0d81612f17565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610b0d57610b0d613360565b6000826133aa57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610b0d57610b0d613360565b6000600182016133d4576133d4613360565b5060010190565b61ffff8181168382160190808211156133f6576133f6613360565b5092915050565b60006020828403121561340f57600080fd5b81516001600160401b0381111561342557600080fd5b8201601f8101841361343657600080fd5b8051613444613057826131b3565b81815285602083850101111561345957600080fd5b612c3a826020830160208601612d2a565b81810381811115610b0d57610b0d613360565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b6001600160401b038281168282160390808211156133f6576133f6613360565b6001600160401b038181168382160190808211156133f6576133f6613360565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613543816017850160208801612d2a565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613574816028840160208801612d2a565b01602801949350505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b6000816135e4576135e4613360565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061361f90830184612d4e565b9695505050505050565b60006020828403121561363b57600080fd5b8151612a0d81612cf756fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220f0c56b51fccf5c2c670244a8324732d2c43e9349e51563a0a76eaa12c923711c64736f6c63430008110033
Deployed Bytecode
0x6080604052600436106102cd5760003560e01c80636352211e116101775780636352211e146106a85780636f95423c146106c857806370a08231146106fb578063715018a61461071b5780637686f48b146107305780637ad594311461076c5780638462151c1461078c5780638da5cb5b146107b95780639097548d146107ce57806391d14854146107ee57806395d89b411461080e5780639c1d12fc14610823578063a0712d6814610843578063a18b1d4814610856578063a217fddf14610870578063a22cb46514610885578063ad2f852a146108a5578063b88d4fde146108c5578063b8997a97146108e5578063bedb86fb14610919578063c87b56dd14610939578063cf3d49c414610959578063cf99640a14610979578063d547741f146109a1578063df9cc7e3146109c1578063e3bb2eec146109e1578063e4f2487a14610a01578063e58306f914610a2d578063e985e9c514610a4d578063f2fde38b14610a6d578063fcd1aac914610a8d57600080fd5b806301b9a397146102d257806301ffc9a7146102f4578063025e332e1461032957806306d254da1461034957806306fdde0314610369578063081812fc1461038b578063095ea7b3146103b85780630f4345e2146103d85780631581b600146103f857806318160ddd14610418578063235c19f91461043b57806323b872dd1461045b578063248a9ca31461047b5780632a55205a1461049b5780632bc0e377146104c95780632f2ff15d146104de578063303e74df146104fe57806331faafb41461051e57806332cb6b0c1461053e57806336568abe14610554578063396e8f53146105745780633ab1a494146105945780633c215c91146105b45780633ccfd60b146105d45780633cf40df3146105dc57806341f43434146105f657806342842e0e1461061857806346b7d755146106385780634f3db3461461065857806355c492381461066e5780635c975abb1461068e575b600080fd5b3480156102de57600080fd5b506102f26102ed366004612cda565b610aad565b005b34801561030057600080fd5b5061031461030f366004612d0d565b610ad9565b60405190151581526020015b60405180910390f35b34801561033557600080fd5b506102f2610344366004612cda565b610b13565b34801561035557600080fd5b506102f2610364366004612cda565b610b3f565b34801561037557600080fd5b5061037e610b92565b6040516103209190612d7a565b34801561039757600080fd5b506103ab6103a6366004612d8d565b610c24565b6040516103209190612da6565b3480156103c457600080fd5b506102f26103d3366004612dba565b610cb4565b3480156103e457600080fd5b506102f26103f3366004612d8d565b610da5565b34801561040457600080fd5b506000546103ab906001600160a01b031681565b34801561042457600080fd5b5061042d610db4565b604051908152602001610320565b34801561044757600080fd5b506102f2610456366004612dfa565b610dc3565b34801561046757600080fd5b506102f2610476366004612e16565b610df8565b34801561048757600080fd5b5061042d610496366004612d8d565b610e23565b3480156104a757600080fd5b506104bb6104b6366004612e57565b610e38565b604051610320929190612e79565b3480156104d557600080fd5b50610314610e7e565b3480156104ea57600080fd5b506102f26104f9366004612e92565b610f11565b34801561050a57600080fd5b506014546103ab906001600160a01b031681565b34801561052a57600080fd5b506102f2610539366004612ec2565b610f2d565b34801561054a57600080fd5b5061042d6105dc81565b34801561056057600080fd5b506102f261056f366004612e92565b610f8c565b34801561058057600080fd5b506001546103ab906001600160a01b031681565b3480156105a057600080fd5b506102f26105af366004612cda565b61100a565b3480156105c057600080fd5b506102f26105cf366004612eeb565b61105d565b6102f261107c565b3480156105e857600080fd5b506016546103149060ff1681565b34801561060257600080fd5b506103ab6daaeb6d7670e522a718067333cd4e81565b34801561062457600080fd5b506102f2610633366004612e16565b6110e9565b34801561064457600080fd5b506102f2610653366004612f25565b61110e565b34801561066457600080fd5b5061042d60025481565b34801561067a57600080fd5b506102f2610689366004612e57565b61112b565b34801561069a57600080fd5b506005546103149060ff1681565b3480156106b457600080fd5b506103ab6106c3366004612d8d565b611149565b3480156106d457600080fd5b506106e86106e3366004612d8d565b61115d565b60405161ffff9091168152602001610320565b34801561070757600080fd5b5061042d610716366004612cda565b61118b565b34801561072757600080fd5b506102f261121d565b34801561073c57600080fd5b506106e861074b366004612f42565b600360209081526000928352604080842090915290825290205461ffff1681565b34801561077857600080fd5b506102f2610787366004612f6e565b611231565b34801561079857600080fd5b506107ac6107a7366004612cda565b611264565b6040516103209190612f89565b3480156107c557600080fd5b506103ab61132a565b3480156107da57600080fd5b5061042d6107e9366004612d8d565b611339565b3480156107fa57600080fd5b50610314610809366004612e92565b611350565b34801561081a57600080fd5b5061037e61137b565b34801561082f57600080fd5b506102f261083e3660046130b2565b61138a565b6102f2610851366004612d8d565b611481565b34801561086257600080fd5b506007546103149060ff1681565b34801561087c57600080fd5b5061042d600081565b34801561089157600080fd5b506102f26108a0366004613185565b61178e565b3480156108b157600080fd5b506015546103ab906001600160a01b031681565b3480156108d157600080fd5b506102f26108e03660046131da565b611871565b3480156108f157600080fd5b5060155461090c90600160a01b90046001600160601b031681565b6040516103209190613283565b34801561092557600080fd5b506102f2610934366004612f25565b611897565b34801561094557600080fd5b5061037e610954366004612d8d565b6118b4565b34801561096557600080fd5b5061042d610974366004612d8d565b61198f565b34801561098557600080fd5b506103ab73b9bd747986c543ac94bcfdd0fa6edd711853d5c081565b3480156109ad57600080fd5b506102f26109bc366004612e92565b61199f565b3480156109cd57600080fd5b506106e86109dc366004612dba565b6119bb565b3480156109ed57600080fd5b5061042d6109fc366004612d8d565b6119f8565b348015610a0d57600080fd5b50600554610a2090610100900460ff1681565b60405161032091906132ad565b348015610a3957600080fd5b506102f2610a48366004612dba565b611a08565b348015610a5957600080fd5b50610314610a683660046132d5565b611a1c565b348015610a7957600080fd5b506102f2610a88366004612cda565b611a4a565b348015610a9957600080fd5b506102f2610aa8366004612f25565b611ac0565b610ab76000611c96565b601480546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b0319821663152a902d60e11b1480610afe5750610afe82611ca0565b80610b0d5750610b0d82611cd5565b92915050565b610b1d6000611c96565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b610b496000611c96565b6001600160a01b038116610b705760405163d92e233d60e01b815260040160405180910390fd5b601580546001600160a01b0319166001600160a01b0392909216919091179055565b6060601a8054610ba1906132f3565b80601f0160208091040260200160405190810160405280929190818152602001828054610bcd906132f3565b8015610c1a5780601f10610bef57610100808354040283529160200191610c1a565b820191906000526020600020905b815481529060010190602001808311610bfd57829003601f168201915b5050505050905090565b6000610c2f82611d15565b610c985760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152601e60205260409020546001600160a01b031690565b81610cbe81611d31565b6001600160a01b03831615610d965760165460ff1615610cf15760405163f30c72c560e01b815260040160405180910390fd5b6001546001600160a01b031615610d9657600154600254604051630f8350ed60e41b81526001600160a01b039092169163f8350ed091610d3691879190600401612e79565b602060405180830381865afa158015610d53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d77919061332d565b610d9657826040516338332a8160e11b8152600401610c8f9190612da6565b610da08383611de1565b505050565b610daf6000611c96565b600255565b6000610dbe611ef1565b905090565b610dcd6000611c96565b806008836003811115610de257610de2613297565b60048110610df257610df261334a565b01555050565b826001600160a01b0381163314610e1257610e1233611d31565b610e1d848484611f01565b50505050565b60009081526017602052604090206001015490565b60155460009081906001600160a01b0381169061271090610e6990600160a01b90046001600160601b031686613376565b610e73919061338d565b915091509250929050565b60055460009060ff1615610f0b5760075460ff16610e9c5750600090565b600554600090610100900460ff166003811115610ebb57610ebb613297565b9050600060088260048110610ed257610ed261334a565b01549050428111158015610f045750600c8260048110610ef457610ef461334a565b0154610f0090826133af565b4211155b9250505090565b50600190565b610f1a82610e23565b610f2381611c96565b610da08383611f32565b610f376000611c96565b612710816001600160601b031610610f6457806040516349d647ad60e01b8152600401610c8f9190613283565b601580546001600160601b03909216600160a01b026001600160a01b03909216919091179055565b6001600160a01b0381163314610ffc5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c8f565b6110068282611fb8565b5050565b6110146000611c96565b6001600160a01b03811661103b5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6110676000611c96565b816010826003811115610de257610de2613297565b6110866000611c96565b600080546040516001600160a01b039091169047908381818185875af1925050503d80600081146110d3576040519150601f19603f3d011682016040523d82523d6000602084013e6110d8565b606091505b50509050806110e657600080fd5b50565b826001600160a01b03811633146111035761110333611d31565b610e1d84848461201f565b6111186000611c96565b6007805460ff1916911515919091179055565b6111356000611c96565b80600c8360048110610df257610df261334a565b6000806111558361203a565b509392505050565b6006816004811061116d57600080fd5b60109182820401919006600202915054906101000a900461ffff1681565b60006001600160a01b0382166111f95760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610c8f565b506001600160a01b031660009081526020805260409020546001600160401b031690565b6112256120d1565b61122f6000612130565b565b61123b6000611c96565b6005805482919061ff00191661010083600381111561125c5761125c613297565b021790555050565b60606000806112728461118b565b90506000816001600160401b0381111561128e5761128e612fcd565b6040519080825280602002602001820160405280156112b7578160200160208202803683370190505b50905060005b828414611321576112cd81611d15565b1561131957856001600160a01b03166112e582611149565b6001600160a01b031603611319578082858060010196508151811061130c5761130c61334a565b6020026020010181815250505b6001016112bd565b50949350505050565b6018546001600160a01b031690565b6010816004811061134957600080fd5b0154905081565b60009182526017602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060601b8054610ba1906132f3565b6113946000611c96565b8151815181146113b75760405163ed882f7160e01b815260040160405180910390fd5b60005b8181101561147a578281815181106113d4576113d461334a565b6020026020010151600360008760038111156113f2576113f2613297565b600381111561140357611403613297565b815260200190815260200160002060008684815181106114255761142561334a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548161ffff021916908361ffff1602179055508080611472906133c2565b9150506113ba565b5050505050565b611489610e7e565b6114a657604051631c7324b560e21b815260040160405180910390fd5b3233146114c657604051631c4e317f60e11b815260040160405180910390fd5b6005548190600690610100900460ff1660038111156114e7576114e7613297565b600481106114f7576114f761334a565b601091828204019190066002029054906101000a900461ffff1661ffff16811115611535576040516315bf7c7b60e31b815260040160405180910390fd5b8060000361155657604051631e97cd6360e21b815260040160405180910390fd5b600554610100900460ff16600381600381111561157557611575613297565b146116a4576003600082600381111561159057611590613297565b60038111156115a1576115a1613297565b81526020808201929092526040908101600090812033825290925281205461ffff1690036115e257604051632527687b60e21b815260040160405180910390fd5b6000600360008360038111156115fa576115fa613297565b600381111561160b5761160b613297565b81526020808201929092526040908101600090812033825283528181205460049093522061ffff909116915082600381111561164957611649613297565b600481106116595761165961334a565b601091828204019190066002029054906101000a900461ffff1661ffff168361168291906133af565b8110156116a2576040516337cb51dd60e21b815260040160405180910390fd5b505b34836010600560019054906101000a900460ff1660038111156116c9576116c9613297565b600481106116d9576116d961334a565b01546116e59082613376565b8210156117055760405163356680b760e01b815260040160405180910390fd5b336000908152600460205260409020600554869190610100900460ff16600381111561173357611733613297565b600481106117435761174361334a565b601091828204019190066002028282829054906101000a900461ffff1661176a91906133db565b92506101000a81548161ffff021916908361ffff16021790555061147a3386612182565b8161179881611d31565b81156118675760165460ff16156117c25760405163f30c72c560e01b815260040160405180910390fd5b6001546001600160a01b03161561186757600154600254604051630f8350ed60e41b81526001600160a01b039092169163f8350ed09161180791879190600401612e79565b602060405180830381865afa158015611824573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611848919061332d565b61186757826040516338332a8160e11b8152600401610c8f9190612da6565b610da083836121c0565b836001600160a01b038116331461188b5761188b33611d31565b61147a85858585612283565b6118a16000611c96565b6005805460ff1916911515919091179055565b60606118bf82611d15565b61191e5760405162461bcd60e51b815260206004820152602a60248201527f4552433732315073693a2055524920717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610c8f565b60145460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa158015611967573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b0d91908101906133fd565b6008816004811061134957600080fd5b6119a882610e23565b6119b181611c96565b610da08383611fb8565b600460205281600052604060002081600481106119d757600080fd5b60109182820401919006600202915091509054906101000a900461ffff1681565b600c816004811061134957600080fd5b611a126000611c96565b6110068282612182565b6001600160a01b039182166000908152601f6020908152604080832093909416825291909152205460ff1690565b611a526120d1565b6001600160a01b038116611ab75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c8f565b6110e681612130565b611aca6000611c96565b6016805460ff1916911515919091179055565b6000611ae8601d5490565b905060008211611b485760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610c8f565b6001600160a01b038316611baa5760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610c8f565b611bb760008483856122b5565b81601d6000828254611bc991906133af565b90915550506000818152601c6020526040902080546001600160a01b0319166001600160a01b038516179055611c00601982611c6a565b611c0d6000848385612309565b805b611c1983836133af565b811015610e1d5760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480611c62816133c2565b915050611c0f565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b6110e68133612483565b60006001600160e01b03198216637965db0b60e01b1480610b0d57506301ffc9a760e01b6001600160e01b0319831614610b0d565b60006001600160e01b031982166380ac58cd60e01b1480611d0657506001600160e01b03198216635b5e139f60e01b145b80610b0d5750610b0d82611ca0565b6000611d20601d5490565b82108015610b0d5750600192915050565b6daaeb6d7670e522a718067333cd4e3b156110e657604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611d9e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc2919061332d565b6110e65780604051633b79c77360e21b8152600401610c8f9190612da6565b6000611dec82611149565b9050806001600160a01b0316836001600160a01b031603611e5b5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610c8f565b336001600160a01b0382161480611e775750611e778133611a1c565b611ee75760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527a081bdddb995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b602a1b6064820152608401610c8f565b610da083836124dc565b600080601d54610dbe919061346a565b611f0b338261254a565b611f275760405162461bcd60e51b8152600401610c8f9061347d565b610da0838383612617565b611f3c8282611350565b6110065760008281526017602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611f743390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611fc28282611350565b156110065760008281526017602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610da083838360405180602001604052806000815250611871565b60008061204683611d15565b6120a75760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c8f565b6120b08361281e565b6000818152601c60205260409020546001600160a01b031694909350915050565b336120da61132a565b6001600160a01b03161461122f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c8f565b601880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6105dc61218d610db4565b61219790836133af565b11156121b657604051638a164f6360e01b815260040160405180910390fd5b6110068282611add565b336001600160a01b038316036122175760405162461bcd60e51b815260206004820152601c60248201527b22a9219b9918a839b49d1030b8383937bb32903a379031b0b63632b960211b6044820152606401610c8f565b336000818152601f602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61228d338361254a565b6122a95760405162461bcd60e51b8152600401610c8f9061347d565b610e1d8484848461282b565b60165460ff1680156122cf57506001600160a01b03841615155b80156122e657506001600160a01b03831661dead14155b156123045760405163f30c72c560e01b815260040160405180910390fd5b610e1d565b600160401b811061231957600080fd5b806001600160a01b03851615612382576001600160a01b0385166000908152602080526040812080548392906123599084906001600160401b03166134d1565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506123e1565b6001600160a01b0384166000908152602080526040902080548291906008906123bc908490600160401b90046001600160401b03166134f1565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b03841615612449576001600160a01b0384166000908152602080526040812080548392906124209084906001600160401b03166134f1565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555061147a565b6001600160a01b038516600090815260208052604090208054829190601090612420908490600160801b90046001600160401b03166134f1565b61248d8282611350565b6110065761249a81612860565b6124a5836020612872565b6040516020016124b6929190613511565b60408051601f198184030181529082905262461bcd60e51b8252610c8f91600401612d7a565b6000818152601e6020526040902080546001600160a01b0319166001600160a01b038416908117909155819061251182611149565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061255582611d15565b6125b95760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610c8f565b60006125c483611149565b9050806001600160a01b0316846001600160a01b031614806125ff5750836001600160a01b03166125f484610c24565b6001600160a01b0316145b8061260f575061260f8185611a1c565b949350505050565b6000806126238361203a565b91509150846001600160a01b0316826001600160a01b03161461269d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610c8f565b6001600160a01b0384166127035760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610c8f565b61271085858560016122b5565b61271b6000846124dc565b60006127288460016133af565b600881901c600090815260196020526040902054909150600160ff1b60ff83161c161580156127585750601d5481105b1561278f576000818152601c6020526040902080546001600160a01b0319166001600160a01b03881617905561278f601982611c6a565b6000848152601c6020526040902080546001600160a01b0319166001600160a01b0387161790558184146127c8576127c8601985611c6a565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46128168686866001612309565b505050505050565b6000610b0d601983612a14565b612836848484612617565b612844848484600185612b0c565b610e1d5760405162461bcd60e51b8152600401610c8f90613580565b6060610b0d6001600160a01b03831660145b60606000612881836002613376565b61288c9060026133af565b6001600160401b038111156128a3576128a3612fcd565b6040519080825280601f01601f1916602001820160405280156128cd576020820181803683370190505b509050600360fc1b816000815181106128e8576128e861334a565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106129175761291761334a565b60200101906001600160f81b031916908160001a905350600061293b846002613376565b6129469060016133af565b90505b60018111156129be576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061297a5761297a61334a565b1a60f81b8282815181106129905761299061334a565b60200101906001600160f81b031916908160001a90535060049490941c936129b7816135d5565b9050612949565b508315612a0d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c8f565b9392505050565b600881901c60008181526020849052604081205490919060ff808516919082181c8015612a5657612a4481612c43565b60ff168203600884901b179350612b03565b60008311612ac35760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610c8f565b506000199091016000818152602086905260409020549091908015612afe57612aeb81612c43565b60ff0360ff16600884901b179350612b03565b612a56565b50505092915050565b60006001600160a01b0385163b15612c3657506001835b612b2d84866133af565b811015612c3057604051630a85bd0160e11b81526001600160a01b0387169063150b7a0290612b669033908b90869089906004016135ec565b6020604051808303816000875af1925050508015612ba1575060408051601f3d908101601f19168201909252612b9e91810190613629565b60015b612bfe573d808015612bcf576040519150601f19603f3d011682016040523d82523d6000602084013e612bd4565b606091505b508051600003612bf65760405162461bcd60e51b8152600401610c8f90613580565b805181602001fd5b828015612c1b57506001600160e01b03198116630a85bd0160e11b145b92505080612c28816133c2565b915050612b23565b50612c3a565b5060015b95945050505050565b60006040518061012001604052806101008152602001613647610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612c8c85612cad565b02901c81518110612c9f57612c9f61334a565b016020015160f81c92915050565b6000808211612cbb57600080fd5b5060008190031690565b6001600160a01b03811681146110e657600080fd5b600060208284031215612cec57600080fd5b8135612a0d81612cc5565b6001600160e01b0319811681146110e657600080fd5b600060208284031215612d1f57600080fd5b8135612a0d81612cf7565b60005b83811015612d45578181015183820152602001612d2d565b50506000910152565b60008151808452612d66816020860160208601612d2a565b601f01601f19169290920160200192915050565b602081526000612a0d6020830184612d4e565b600060208284031215612d9f57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b60008060408385031215612dcd57600080fd5b8235612dd881612cc5565b946020939093013593505050565b803560048110612df557600080fd5b919050565b60008060408385031215612e0d57600080fd5b612dd883612de6565b600080600060608486031215612e2b57600080fd5b8335612e3681612cc5565b92506020840135612e4681612cc5565b929592945050506040919091013590565b60008060408385031215612e6a57600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060408385031215612ea557600080fd5b823591506020830135612eb781612cc5565b809150509250929050565b600060208284031215612ed457600080fd5b81356001600160601b0381168114612a0d57600080fd5b60008060408385031215612efe57600080fd5b82359150612f0e60208401612de6565b90509250929050565b80151581146110e657600080fd5b600060208284031215612f3757600080fd5b8135612a0d81612f17565b60008060408385031215612f5557600080fd5b612f5e83612de6565b91506020830135612eb781612cc5565b600060208284031215612f8057600080fd5b612a0d82612de6565b6020808252825182820181905260009190848201906040850190845b81811015612fc157835183529284019291840191600101612fa5565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561300b5761300b612fcd565b604052919050565b60006001600160401b0382111561302c5761302c612fcd565b5060051b60200190565b600082601f83011261304757600080fd5b8135602061305c61305783613013565b612fe3565b82815260059290921b8401810191818101908684111561307b57600080fd5b8286015b848110156130a757803561ffff8116811461309a5760008081fd5b835291830191830161307f565b509695505050505050565b6000806000606084860312156130c757600080fd5b6130d084612de6565b92506020808501356001600160401b03808211156130ed57600080fd5b818701915087601f83011261310157600080fd5b813561310f61305782613013565b81815260059190911b8301840190848101908a83111561312e57600080fd5b938501935b8285101561315557843561314681612cc5565b82529385019390850190613133565b96505050604087013592508083111561316d57600080fd5b505061317b86828701613036565b9150509250925092565b6000806040838503121561319857600080fd5b82356131a381612cc5565b91506020830135612eb781612f17565b60006001600160401b038211156131cc576131cc612fcd565b50601f01601f191660200190565b600080600080608085870312156131f057600080fd5b84356131fb81612cc5565b9350602085013561320b81612cc5565b92506040850135915060608501356001600160401b0381111561322d57600080fd5b8501601f8101871361323e57600080fd5b803561324c613057826131b3565b81815288602083850101111561326157600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6001600160601b0391909116815260200190565b634e487b7160e01b600052602160045260246000fd5b60208101600483106132cf57634e487b7160e01b600052602160045260246000fd5b91905290565b600080604083850312156132e857600080fd5b8235612f5e81612cc5565b600181811c9082168061330757607f821691505b60208210810361332757634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561333f57600080fd5b8151612a0d81612f17565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610b0d57610b0d613360565b6000826133aa57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610b0d57610b0d613360565b6000600182016133d4576133d4613360565b5060010190565b61ffff8181168382160190808211156133f6576133f6613360565b5092915050565b60006020828403121561340f57600080fd5b81516001600160401b0381111561342557600080fd5b8201601f8101841361343657600080fd5b8051613444613057826131b3565b81815285602083850101111561345957600080fd5b612c3a826020830160208601612d2a565b81810381811115610b0d57610b0d613360565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b6001600160401b038281168282160390808211156133f6576133f6613360565b6001600160401b038181168382160190808211156133f6576133f6613360565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613543816017850160208801612d2a565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613574816028840160208801612d2a565b01602801949350505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b6000816135e4576135e4613360565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061361f90830184612d4e565b9695505050505050565b60006020828403121561363b57600080fd5b8151612a0d81612cf756fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a2646970667358221220f0c56b51fccf5c2c670244a8324732d2c43e9349e51563a0a76eaa12c923711c64736f6c63430008110033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.