ETH Price: $2,486.66 (-0.51%)

Token

CryptoNinja Children (CNC)
 

Overview

Max Total Supply

11,111 CNC

Holders

2,855

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
2 CNC
0xe6219ec732f029bd8d890586577324dbc0adc54e
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
CryptoNinjaChildren

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 44 : CryptoNinjaChildren.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

import "./defualt-contract/TokenUriSupplier.sol";
import "contract-allow-list/contracts/ERC721AntiScam/ERC721AntiScam.sol";
import "erc721-multi-sales/contracts/single-wallet/merkletree/ERC721MultiSaleByMerkle.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "operator-filter-registry/src/RevokableDefaultOperatorFilterer.sol";
import "operator-filter-registry/src/UpdatableOperatorFilterer.sol";

contract CryptoNinjaChildren is
    AccessControl,
    Ownable,
    RevokableDefaultOperatorFilterer,
    ERC721MultiSaleByMerkle,
    ERC2981,
    TokenUriSupplier,
    ERC721AntiScam
{
    using Strings for uint256;
    // ==================================================================
    // Constants
    // ==================================================================
    bytes32 public constant ADMIN = "ADMIN";

    // ==================================================================
    // Variables
    // ==================================================================
    // == For Creator fee ==
    uint96 public royaltyFee = 1000;

    // == For time lock ==
    // tokenId -> unlock time
    mapping(uint256 => uint256) unlockTokenTimestamp;
    // wallet -> unlock time
    mapping(address => uint256) unlockWalletTimestamp;
    uint256 public unlockLeadTime = 3 hours;

    // ==================================================================
    // Constractor
    // ==================================================================
    constructor() ERC721Psi("CryptoNinja Children", "CNC") {
        grantRole(ADMIN, msg.sender);
    }

    // ==================================================================
    // Queriable
    // ==================================================================
    function tokensOfOwnerIn(
        address _owner,
        uint256 start,
        uint256 stop
    ) external view virtual returns (uint256[] memory) {
        unchecked {
            require(start < stop, "start must be greater than stop.");
            uint256 tokenIdsIdx;
            uint256 stopLimit = _nextTokenId();
            // Set `start = max(start, _startTokenId())`.
            if (start < _startTokenId()) {
                start = _startTokenId();
            }
            // Set `stop = min(stop, stopLimit)`.
            if (stop > stopLimit) {
                stop = stopLimit;
            }

            uint256 tokenIdsMaxLength = balanceOf(_owner);
            // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`,
            // to cater for cases where `balanceOf(owner)` is too big.
            if (start < stop) {
                uint256 rangeLength = stop - start;
                if (rangeLength < tokenIdsMaxLength) {
                    tokenIdsMaxLength = rangeLength;
                }
            } else {
                tokenIdsMaxLength = 0;
            }

            uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength);
            if (tokenIdsMaxLength == 0) {
                return tokenIds;
            }

            for (
                uint256 i = start;
                i != stop && tokenIdsIdx != tokenIdsMaxLength;
                ++i
            ) {
                if (_exists(i)) {
                    if (ownerOf(i) == _owner) {
                        tokenIds[tokenIdsIdx++] = i;
                    }
                }
            }
            // Downsize the array to fit.
            assembly {
                mstore(tokenIds, tokenIdsIdx)
            }
            return tokenIds;
        }
    }

    // ==================================================================
    // overrive ERC721Psi for operator-filter-registry
    // ==================================================================
    function setApprovalForAll(address operator, bool approved)
        public
        override
        onlyAllowedOperatorApproval(operator)
    {
        super.setApprovalForAll(operator, approved);
    }

    function approve(address operator, uint256 tokenId)
        public
        override
        onlyAllowedOperatorApproval(operator)
    {
        super.approve(operator, tokenId);
    }

    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 owner()
        public
        view
        virtual
        override(Ownable, UpdatableOperatorFilterer)
        returns (address)
    {
        return Ownable.owner();
    }

    // ==================================================================
    // override ERC721
    // ==================================================================
    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override(ERC721Psi, TokenUriSupplier)
        returns (string memory)
    {
        return TokenUriSupplier.tokenURI(tokenId);
    }

    function _defaultTokenUri(uint256 tokenId)
        internal
        view
        override
        returns (string memory)
    {
        return
            string(
                abi.encodePacked(
                    baseURI,
                    tokenId.toString(),
                    isLocked(tokenId) ? "_lock" : "",
                    baseExtension
                )
            );
    }

    function setBaseURI(string memory _value)
        external
        override
        onlyRole(ADMIN)
    {
        baseURI = _value;
    }

    function setBaseExtension(string memory _value)
        external
        override
        onlyRole(ADMIN)
    {
        baseExtension = _value;
    }

    function setExternalSupplier(address _value)
        external
        override
        onlyRole(ADMIN)
    {
        externalSupplier = ITokenUriSupplier(_value);
    }

    function exists(uint256 tokenId) external view returns (bool) {
        return _exists(tokenId);
    }

    // ==================================================================
    // override ERC721RestrictApprove
    // ==================================================================
    function addLocalContractAllowList(address transferer)
        external
        onlyRole(ADMIN)
    {
        _addLocalContractAllowList(transferer);
    }

    function removeLocalContractAllowList(address transferer)
        external
        onlyRole(ADMIN)
    {
        _removeLocalContractAllowList(transferer);
    }

    function getLocalContractAllowList()
        external
        view
        returns (address[] memory)
    {
        return _getLocalContractAllowList();
    }

    function setCAL(address calAddress) external onlyRole(ADMIN) {
        _setCAL(calAddress);
    }

    function setCALLevel(uint256 level) external onlyRole(ADMIN) {
        CALLevel = level;
    }

    function setEnableRestrict(bool value) external onlyRole(ADMIN) {
        enableRestrict = value;
    }

    // ==================================================================
    // override ERC721Loclable
    // ==================================================================
    function setContractLock(LockStatus lockStatus) external onlyRole(ADMIN) {
        _setContractLock(lockStatus);
    }

    function setWalletLock(address to, LockStatus lockStatus) external {
        require(msg.sender == to, "only yourself.");

        if (
            walletLock[to] == LockStatus.Lock && lockStatus != LockStatus.Lock
        ) {
            unlockWalletTimestamp[to] = block.timestamp;
        }

        _setWalletLock(to, lockStatus);
    }

    function _isTokenLockToUnlock(uint256 tokenId, LockStatus newLockStatus)
        private
        view
        returns (bool)
    {
        if (newLockStatus == LockStatus.UnLock) {
            LockStatus currentWalletLock = walletLock[msg.sender];
            bool isWalletLock_TokenLockOrUnset = (currentWalletLock ==
                LockStatus.Lock &&
                tokenLock[tokenId] != LockStatus.UnLock);
            bool isWalletUnlockOrUnset_TokenLock = (currentWalletLock !=
                LockStatus.Lock &&
                tokenLock[tokenId] == LockStatus.Lock);

            return
                isWalletLock_TokenLockOrUnset ||
                isWalletUnlockOrUnset_TokenLock;
        } else if (newLockStatus == LockStatus.UnSet) {
            LockStatus currentWalletLock = walletLock[msg.sender];
            bool isNotWalletLock = currentWalletLock != LockStatus.Lock;
            bool isTokenLock = tokenLock[tokenId] == LockStatus.Lock;

            return isNotWalletLock && isTokenLock;
        } else {
            return false;
        }
    }

    function setTokenLock(uint256[] calldata tokenIds, LockStatus newLockStatus)
        external
    {
        require(tokenIds.length > 0, "tokenIds must be greater than 0.");

        for (uint256 i = 0; i < tokenIds.length; i++) {
            require(msg.sender == ownerOf(tokenIds[i]), "not owner.");
        }

        for (uint256 i = 0; i < tokenIds.length; i++) {
            if (_isTokenLockToUnlock(tokenIds[i], newLockStatus)) {
                unlockTokenTimestamp[tokenIds[i]] = block.timestamp;
            }
        }
        _setTokenLock(tokenIds, newLockStatus);
    }

    function setEnableLock(bool value) external onlyRole(ADMIN) {
        enableLock = value;
    }

    function _isTokenTimeLock(uint256 tokenId) private view returns (bool) {
        return unlockTokenTimestamp[tokenId] + unlockLeadTime > block.timestamp;
    }

    function _isWalletTimeLock(uint256 tokenId) private view returns (bool) {
        return
            unlockWalletTimestamp[ownerOf(tokenId)] + unlockLeadTime >
            block.timestamp;
    }

    function isLocked(uint256 tokenId)
        public
        view
        override(IERC721Lockable, ERC721Lockable)
        returns (bool)
    {
        return
            ERC721Lockable.isLocked(tokenId) ||
            _isTokenTimeLock(tokenId) ||
            _isWalletTimeLock(tokenId);
    }

    function setUnlockLeadTime(uint256 value) external onlyRole(ADMIN) {
        unlockLeadTime = value;
    }

    // ==================================================================
    // operations
    // ==================================================================
    function grantRole(bytes32 role, address account)
        public
        override
        onlyOwner
    {
        _grantRole(role, account);
    }

    function revokeRole(bytes32 role, address account)
        public
        override
        onlyOwner
    {
        _revokeRole(role, account);
    }

    // ==================================================================
    // interface
    // ==================================================================
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(AccessControl, ERC721AntiScam, ERC2981)
        returns (bool)
    {
        return
            ERC721Psi.supportsInterface(interfaceId) ||
            ERC2981.supportsInterface(interfaceId) ||
            ERC721AntiScam.supportsInterface(interfaceId) ||
            AccessControl.supportsInterface(interfaceId);
    }

    // ==================================================================
    // override ERC721MultiSaleByMerkle
    // ==================================================================
    function adminMint(address[] calldata to, uint256[] calldata amount)
        external
        onlyRole(ADMIN)
    {
        require(to.length == amount.length);
        for (uint256 i = 0; i < to.length; i++) {
            require(
                amount[i] + _totalSupply() <= maxSupply,
                "claim is over the max supply."
            );
            _safeMint(to[i], amount[i]);
        }
    }

    // == For sale ==
    function claim(
        uint248 amount,
        uint248 allowedAmount,
        bytes32[] calldata merkleProof
    ) external payable override enoughEth(amount) {
        _claim(amount, allowedAmount, merkleProof);
        _safeMint(msg.sender, amount);
    }

    function exchange(
        uint256[] calldata burnTokenIds,
        uint248 allowedAmount,
        bytes32[] calldata merkleProof
    ) external payable override enoughEth(burnTokenIds.length) {
        _exchange(burnTokenIds, allowedAmount, merkleProof);

        for (uint256 i = 0; i < burnTokenIds.length; i++) {
            _burn(burnTokenIds[i]);
        }
        _safeMint(msg.sender, burnTokenIds.length);
    }

    function setCurrentSale(Sale calldata sale, bytes32 merkleRoot)
        external
        onlyRole(ADMIN)
    {
        _setCurrentSale(sale);
        _merkleRoot = merkleRoot;
    }

    // ==================================================================
    // override BasicSale
    // ==================================================================
    function pause() external onlyRole(ADMIN) {
        _pause();
    }

    function unpause() external onlyRole(ADMIN) {
        _unpause();
    }

    function withdraw() external payable onlyRole(ADMIN) {
        _withdraw();
    }

    function setWithdrawAddress(address payable value)
        external
        onlyRole(ADMIN)
    {
        withdrawAddress = value;
        _setDefaultRoyalty(withdrawAddress, royaltyFee);
    }

    function setMaxSupply(uint256 value) external onlyRole(ADMIN) {
        maxSupply = value;
    }

    function _totalSupply() internal view override returns (uint256) {
        return totalSupply();
    }

    // ==================================================================
    // Override Ownerble for fail safe
    // ==================================================================
    function renounceOwnership() public view override onlyOwner {
        revert("Can not renounceOwnership. In the absence of the Owner, the system will not be operational.");
    }

    // ==================================================================
    // For IERC2981 NFT Royalty Standard
    // ==================================================================
    function setRoyaltyFee(uint96 value) external onlyRole(ADMIN) {
        royaltyFee = value;
        _setDefaultRoyalty(withdrawAddress, royaltyFee);
    }

    // ==================================================================
    // ERC721PsiAddressData
    // ==================================================================
    // 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 (uint256)
    {
        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 _afterTokenTransfersForAddressData(
        address from,
        address to,
        uint256, /*startTokenId*/
        uint256 quantity
    ) internal 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;
        }
    }

    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal override {
        _afterTokenTransfersForAddressData(from, to, startTokenId, quantity);
        super._afterTokenTransfers(from, to, startTokenId, quantity);
    }
}

File 2 of 44 : AccessControl.sol
// 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());
        }
    }
}

File 3 of 44 : IAccessControl.sol
// 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;
}

File 4 of 44 : Ownable.sol
// 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);
    }
}

File 5 of 44 : IERC2981.sol
// 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);
}

File 6 of 44 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 7 of 44 : ERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

File 8 of 44 : IERC721Metadata.sol
// 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);
}

File 9 of 44 : IERC721.sol
// 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);
}

File 10 of 44 : IERC721Receiver.sol
// 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);
}

File 11 of 44 : Address.sol
// 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);
        }
    }
}

File 12 of 44 : Context.sol
// 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;
    }
}

File 13 of 44 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     *
     * _Available since v4.7._
     */
    function verifyCalldata(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     *
     * _Available since v4.7._
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 14 of 44 : ERC165.sol
// 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;
    }
}

File 15 of 44 : IERC165.sol
// 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);
}

File 16 of 44 : Math.sol
// 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);
        }
    }
}

File 17 of 44 : StorageSlot.sol
// 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
        }
    }
}

File 18 of 44 : Strings.sol
// 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);
    }
}

File 19 of 44 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 20 of 44 : ERC721AntiScam.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import "./IERC721AntiScam.sol";
import "./lockable/ERC721Lockable.sol";
import "./restrictApprove/ERC721RestrictApprove.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

/// @title AntiScam機能付きERC721A
/// @dev Readmeを見てください。

abstract contract ERC721AntiScam is
    IERC721AntiScam,
    ERC721Lockable,
    ERC721RestrictApprove,
    Ownable
{

    /*///////////////////////////////////////////////////////////////
                              OVERRIDES
    //////////////////////////////////////////////////////////////*/

    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        override(ERC721Lockable, ERC721RestrictApprove)
        returns (bool)
    {
        if (isLocked(owner) || !_isAllowed(owner, operator)) {
            return false;
        }
        return super.isApprovedForAll(owner, operator);
    }

    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override(ERC721Lockable, ERC721RestrictApprove)
    {
        require(
            isLocked(msg.sender) == false || approved == false,
            "Can not approve locked token"
        );
        require(
            _isAllowed(operator) || approved == false,
            "RestrictApprove: Can not approve locked token"
        );
        super.setApprovalForAll(operator, approved);
    }

    function _beforeApprove(address to, uint256 tokenId)
        internal
        virtual
        override(ERC721Lockable, ERC721RestrictApprove)
    {
        ERC721Lockable._beforeApprove(to, tokenId);
        ERC721RestrictApprove._beforeApprove(to, tokenId);
    }

    function approve(address to, uint256 tokenId)
        public
        virtual
        override(ERC721Lockable, ERC721RestrictApprove)
    {
        _beforeApprove(to, tokenId);
        ERC721Psi.approve(to, tokenId);
    }

    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual override(ERC721Psi, ERC721Lockable) {
        ERC721Lockable._beforeTokenTransfers(from, to, startTokenId, quantity);
    }

    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual override(ERC721Lockable, ERC721RestrictApprove) {
        ERC721Lockable._afterTokenTransfers(from, to, startTokenId, quantity);
        ERC721RestrictApprove._afterTokenTransfers(from, to, startTokenId, quantity);
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC721Lockable, ERC721RestrictApprove)
        returns (bool)
    {
        return
            ERC721Psi.supportsInterface(interfaceId) ||
            ERC721Lockable.supportsInterface(interfaceId) ||
            ERC721RestrictApprove.supportsInterface(interfaceId) ||
            interfaceId == type(IERC721AntiScam).interfaceId;
    }
}

File 21 of 44 : IERC721AntiScam.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import "./lockable/IERC721Lockable.sol";
import "./restrictApprove/IERC721RestrictApprove.sol";

/// @title IERC721AntiScam
/// @dev 詐欺防止機能付きコントラクトのインターフェース
/// @author hayatti.eth

interface IERC721AntiScam is IERC721Lockable, IERC721RestrictApprove {
}

File 22 of 44 : ERC721Lockable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import "./IERC721Lockable.sol";
import "erc721psi/contracts/extension/ERC721PsiBurnable.sol";

/// @title トークンのtransfer抑止機能付きコントラクト
/// @dev Readmeを見てください。

abstract contract ERC721Lockable is ERC721PsiBurnable, IERC721Lockable {
    /*//////////////////////////////////////////////////////////////
    ロック変数。トークンごとに個別ロック設定を行う
    //////////////////////////////////////////////////////////////*/
    bool public enableLock = true;
    LockStatus public contractLockStatus = LockStatus.UnLock;

    // token lock
    mapping(uint256 => LockStatus) public tokenLock;

    // wallet lock
    mapping(address => LockStatus) public walletLock;

    /*//////////////////////////////////////////////////////////////
    modifier
    //////////////////////////////////////////////////////////////*/
    modifier existToken(uint256 tokenId) {
        require(
            _exists(tokenId),
            "Lockable: locking query for nonexistent token"
        );
        _;
    }

    /*///////////////////////////////////////////////////////////////
    ロック機能ロジック
    //////////////////////////////////////////////////////////////*/

    // function getLockStatus(uint256 tokenId) external view returns (LockStatus) existToken(tokenId) {
    //     return _getLockStatus(ownerOf(tokenId), tokenId);
    // }

    function isLocked(uint256 tokenId)
        public
        view
        virtual
        existToken(tokenId)
        returns (bool)
    {
        if (!enableLock) {
            return false;
        }

        if (
            tokenLock[tokenId] == LockStatus.Lock ||
            (tokenLock[tokenId] == LockStatus.UnSet &&
                isLocked(ownerOf(tokenId)))
        ) {
            return true;
        }

        return false;
    }

    function isLocked(address holder) public view virtual returns (bool) {
        if (!enableLock) {
            return false;
        }

        if (
            walletLock[holder] == LockStatus.Lock ||
            (walletLock[holder] == LockStatus.UnSet &&
                contractLockStatus == LockStatus.Lock)
        ) {
            return true;
        }

        return false;
    }

    function getTokensUnderLock()
        public
        view
        virtual
        returns (uint256[] memory)
    {
        uint256 start = _startTokenId();
        uint256 end = _nextTokenId();

        return getTokensUnderLock(start, end);
    }

    function getTokensUnderLock(uint256 start, uint256 end)
        public
        view
        virtual
        returns (uint256[] memory)
    {
        bool[] memory lockList = new bool[](end - start + 1);
        uint256 i = 0;
        uint256 lockCount = 0;
        for (uint256 tokenId = start; tokenId <= end; tokenId++) {
            if (_exists(tokenId) && isLocked(tokenId)) {
                lockList[i] = true;
                lockCount++;
            } else {
                lockList[i] = false;
            }

            i++;
        }

        uint256[] memory tokensUnderLock = new uint256[](lockCount);

        i = 0;
        uint256 j = 0;
        for (uint256 tokenId = start; tokenId <= end; tokenId++) {
            if (lockList[i]) {
                tokensUnderLock[j] = tokenId;
                j++;
            }

            i++;
        }

        return tokensUnderLock;
    }

    function _deleteTokenLock(uint256 tokenId) internal virtual {
        delete tokenLock[tokenId];
    }

    function _setTokenLock(uint256[] calldata tokenIds, LockStatus lockStatus)
        internal
        virtual
    {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            tokenLock[tokenIds[i]] = lockStatus;
            emit TokenLock(
                ownerOf(tokenIds[i]),
                msg.sender,
                lockStatus,
                tokenIds[i]
            );
        }
    }

    function _setWalletLock(address to, LockStatus lockStatus)
        internal
        virtual
    {
        walletLock[to] = lockStatus;
        emit WalletLock(to, msg.sender, lockStatus);
    }

    function _setContractLock(LockStatus lockStatus) internal virtual {
        contractLockStatus = lockStatus;
    }

    /*///////////////////////////////////////////////////////////////
                              OVERRIDES
    //////////////////////////////////////////////////////////////*/

    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        override
        returns (bool)
    {
        if (isLocked(owner)) {
            return false;
        }
        return super.isApprovedForAll(owner, operator);
    }

    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
    {
        require(
            isLocked(msg.sender) == false || approved == false,
            "Can not approve locked token"
        );
        super.setApprovalForAll(operator, approved);
    }

    function _beforeApprove(
        address, /**to**/
        uint256 tokenId
    ) internal virtual {
        require(
            isLocked(tokenId) == false,
            "Lockable: Can not approve locked token"
        );
    }

    function approve(address to, uint256 tokenId) public virtual override {
        _beforeApprove(to, tokenId);
        super.approve(to, tokenId);
    }

    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 /*quantity*/
    ) internal virtual override {
        // 転送やバーンにおいては、常にstartTokenIdは TokenIDそのものとなります。
        if (from != address(0) && to != address(0)) {
            // トークンがロックされている場合、転送を許可しない
            require(
                isLocked(startTokenId) == false,
                "Lockable: Can not transfer locked token"
            );
        }
    }

    function _afterTokenTransfers(
        address from,
        address, /*to*/
        uint256 startTokenId,
        uint256 /*quantity*/
    ) internal virtual override {
        // 転送やバーンにおいては、常にstartTokenIdは TokenIDそのものとなります。
        if (from != address(0)) {
            // ロックをデフォルトに戻す。
            _deleteTokenLock(startTokenId);
        }
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            interfaceId == type(IERC721Lockable).interfaceId ||
            super.supportsInterface(interfaceId);
    }
}

File 23 of 44 : IERC721Lockable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/**
 * @title IERC721Lockable
 * @dev トークンのtransfer抑止機能付きコントラクトのインターフェース
 * @author Lavulite
 */
interface IERC721Lockable {

   enum LockStatus {
      UnSet,
      UnLock,
      Lock
   }

    /**
     * @dev 個別ロックが指定された場合のイベント
     */
    event TokenLock(address indexed holder, address indexed operator, LockStatus lockStatus, uint256 indexed tokenId);
    
    /**
     * @dev ウォレットロックが指定された場合のイベント
     */
    event WalletLock(address indexed holder, address indexed operator, LockStatus lockStatus);

    /**
     * @dev 該当トークンIDのロックステータスを変更する。
     */
    function setTokenLock(uint256[] calldata tokenIds, LockStatus lockStatus) external;

    /**
     * @dev 該当ウォレットのロックステータスを変更する。
     */
    function setWalletLock(address to, LockStatus lockStatus) external;

    /**
     * @dev コントラクトのロックステータスを変更する。
     */
    function setContractLock(LockStatus lockStatus) external;

    /**
     * @dev 該当トークンIDがロックされているかを返す
     */
    function isLocked(uint256 tokenId) external view returns (bool);
    
    /**
     * @dev ウォレットロックを行っているかを返す
     */
    function isLocked(address holder) external view returns (bool);

    /**
     * @dev 転送が拒否されているトークンを全て返す
     */
    function getTokensUnderLock() external view returns (uint256[] memory);

    /**
     * @dev 転送が拒否されているstartからstopまでのトークンIDを返す
     */
    function getTokensUnderLock(uint256 start, uint256 end) external view returns (uint256[] memory);

}

File 24 of 44 : ERC721RestrictApprove.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import "erc721psi/contracts/extension/ERC721PsiBurnable.sol";
import "./IERC721RestrictApprove.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "../../proxy/interface/IContractAllowListProxy.sol";

/// @title AntiScam機能付きERC721A
/// @dev Readmeを見てください。

abstract contract ERC721RestrictApprove is ERC721PsiBurnable, IERC721RestrictApprove {
    using EnumerableSet for EnumerableSet.AddressSet;

    IContractAllowListProxy public CAL;
    EnumerableSet.AddressSet localAllowedAddresses;

    modifier onlyHolder(uint256 tokenId) {
        require(
            msg.sender == ownerOf(tokenId),
            "RestrictApprove: operation is only holder."
        );
        _;
    }

    /*//////////////////////////////////////////////////////////////
    変数
    //////////////////////////////////////////////////////////////*/
    bool public enableRestrict = true;

    // token lock
    mapping(uint256 => uint256) public tokenCALLevel;

    // wallet lock
    mapping(address => uint256) public walletCALLevel;

    // contract lock
    uint256 public CALLevel = 1;

    /*///////////////////////////////////////////////////////////////
    Approve抑制機能ロジック
    //////////////////////////////////////////////////////////////*/
    function _addLocalContractAllowList(address transferer)
        internal
        virtual
    {
        localAllowedAddresses.add(transferer);
        emit LocalCalAdded(msg.sender, transferer);
    }

    function _removeLocalContractAllowList(address transferer)
        internal
        virtual
    {
        localAllowedAddresses.remove(transferer);
        emit LocalCalRemoved(msg.sender, transferer);
    }

    function _getLocalContractAllowList()
        internal
        virtual
        view
        returns(address[] memory)
    {
        return localAllowedAddresses.values();
    }

    function _isLocalAllowed(address transferer)
        internal
        view
        virtual
        returns (bool)
    {
        return localAllowedAddresses.contains(transferer);
    }

    function _isAllowed(address transferer)
        internal
        view
        virtual
        returns (bool)
    {
        return _isAllowed(msg.sender, transferer);
    }

    function _isAllowed(uint256 tokenId, address transferer)
        internal
        view
        virtual
        returns (bool)
    {
        uint256 level = _getCALLevel(msg.sender, tokenId);
        return _isAllowed(transferer, level);
    }

    function _isAllowed(address holder, address transferer)
        internal
        view
        virtual
        returns (bool)
    {
        uint256 level = _getCALLevel(holder);
        return _isAllowed(transferer, level);
    }

    function _isAllowed(address transferer, uint256 level)
        internal
        view
        virtual
        returns (bool)
    {
        if (!enableRestrict) {
            return true;
        }

        return _isLocalAllowed(transferer) || CAL.isAllowed(transferer, level);
    }

    function _getCALLevel(address holder, uint256 tokenId)
        internal
        view
        virtual
        returns (uint256)
    {
        if (tokenCALLevel[tokenId] > 0) {
            return tokenCALLevel[tokenId];
        }

        return _getCALLevel(holder);
    }

    function _getCALLevel(address holder)
        internal
        view
        virtual
        returns (uint256)
    {
        if (walletCALLevel[holder] > 0) {
            return walletCALLevel[holder];
        }

        return CALLevel;
    }

    function _setCAL(address _cal) internal virtual {
        CAL = IContractAllowListProxy(_cal);
    }

    function _deleteTokenCALLevel(uint256 tokenId) internal virtual {
        delete tokenCALLevel[tokenId];
    }

    function setTokenCALLevel(uint256 tokenId, uint256 level)
        external
        virtual
        onlyHolder(tokenId)
    {
        tokenCALLevel[tokenId] = level;
    }

    function setWalletCALLevel(uint256 level)
        external
        virtual
    {
        walletCALLevel[msg.sender] = level;
    }

    /*///////////////////////////////////////////////////////////////
                              OVERRIDES
    //////////////////////////////////////////////////////////////*/

    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        override
        returns (bool)
    {
        if (_isAllowed(owner, operator) == false) {
            return false;
        }
        return super.isApprovedForAll(owner, operator);
    }

    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
    {
        require(
            _isAllowed(operator) || approved == false,
            "RestrictApprove: Can not approve locked token"
        );
        super.setApprovalForAll(operator, approved);
    }

    function _beforeApprove(address to, uint256 tokenId)
        internal
        virtual
    {
        if (to != address(0)) {
            require(_isAllowed(tokenId, to), "RestrictApprove: The contract is not allowed.");
        }
    }

    function approve(address to, uint256 tokenId)
        public
        virtual
        override
    {
        _beforeApprove(to, tokenId);
        super.approve(to, tokenId);
    }

    function _afterTokenTransfers(
        address from,
        address, /*to*/
        uint256 startTokenId,
        uint256 /*quantity*/
    ) internal virtual override {
        // 転送やバーンにおいては、常にstartTokenIdは TokenIDそのものとなります。
        if (from != address(0)) {
            // CALレベルをデフォルトに戻す。
            _deleteTokenCALLevel(startTokenId);
        }
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override
        returns (bool)
    {
        return
            interfaceId == type(IERC721RestrictApprove).interfaceId ||
            super.supportsInterface(interfaceId);
    }
}

File 25 of 44 : IERC721RestrictApprove.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/// @title IERC721RestrictApprove
/// @dev Approve抑制機能付きコントラクトのインターフェース
/// @author Lavulite

interface IERC721RestrictApprove {
    /**
     * @dev CALレベルが変更された場合のイベント
     */
    event CalLevelChanged(address indexed operator, uint256 indexed level);
    
    /**
     * @dev LocalContractAllowListnに追加された場合のイベント
     */
    event LocalCalAdded(address indexed operator, address indexed transferer);

    /**
     * @dev LocalContractAllowListnに削除された場合のイベント
     */
    event LocalCalRemoved(address indexed operator, address indexed transferer);

    /**
     * @dev CALを利用する場合のCALのレベルを設定する。レベルが高いほど、許可されるコントラクトの範囲が狭い。
     */
    function setCALLevel(uint256 level) external;

    /**
     * @dev CALのアドレスをセットする。
     */
    function setCAL(address calAddress) external;

    /**
     * @dev CALのリストに無い独自の許可アドレスを追加する場合、こちらにアドレスを記載する。
     */
    function addLocalContractAllowList(address transferer) external;

    /**
     * @dev CALのリストにある独自の許可アドレスを削除する場合、こちらにアドレスを記載する。
     */
    function removeLocalContractAllowList(address transferer) external;

    /**
     * @dev CALのリストにある独自の許可アドレスの一覧を取得する。
     */
    function getLocalContractAllowList() external view returns(address[] memory);

}

File 26 of 44 : IContractAllowListProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;

interface IContractAllowListProxy {
    function isAllowed(address _transferer, uint256 _level)
        external
        view
        returns (bool);
}

File 27 of 44 : ITokenUriSupplier.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

interface ITokenUriSupplier {
    function tokenURI(uint256 tokenId)
        external
        view
        returns (string memory);
}

File 28 of 44 : TokenUriSupplier.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0 <0.9.0;

import "./ITokenUriSupplier.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

abstract contract TokenUriSupplier is ITokenUriSupplier {
    using Strings for uint256;

    // ==================================================================
    // Variables
    // ==================================================================
    ITokenUriSupplier public externalSupplier;

    string public baseURI = "";
    string public baseExtension = ".json";

    // ==================================================================
    // Functions
    // ==================================================================
    function tokenURI(uint256 tokenId) public virtual view returns (string memory) {
        return
            address(externalSupplier) != address(0)
                ? externalSupplier.tokenURI(tokenId)
                : _defaultTokenUri(tokenId);
    }

    function _defaultTokenUri(uint256 tokenId)
        internal
        view
        virtual
        returns (string memory)
    {
        return
            string(
                abi.encodePacked(baseURI, tokenId.toString(), baseExtension)
            );
    }

    function setBaseURI(string memory _value) external virtual;

    function setBaseExtension(string memory _value) external virtual;

    function setExternalSupplier(address value) external virtual;
}

File 29 of 44 : BasicSale.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;

import "./Sale.sol";
import "./IBasicSale.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

abstract contract BasicSale is IBasicSale, Pausable {
    using Address for address payable;
    // ==================================================================
    // Event
    // ==================================================================
    event ChangeSale(uint8 oldId, uint8 newId);

    // ==================================================================
    // Variables
    // ==================================================================
    address payable public withdrawAddress;
    uint256 public maxSupply;
    Sale internal _currentSale;
    uint256 internal _soldCount = 0;

    // ==================================================================
    // Modifier
    // ==================================================================
    modifier isNotOverMaxSaleSupply(uint256 amount) {
        require(
            amount + _soldCount <= _currentSale.maxSupply,
            "claim is over the max sale supply."
        );
        _;
    }
    
    modifier isNotOverMaxSupply(uint256 amount) {
        require(
            amount + _totalSupply() <= maxSupply,
            "claim is over the max supply."
        );
        _;
    }

    modifier enoughEth(uint256 amount) {
        require(msg.value >= _currentSale.mintCost * amount, "not enough eth.");
        _;
    }

    modifier whenClaimSale() {
        require(_currentSale.saleType == SaleType.CLAIM, "not claim sale now.");
        _;
    }

    modifier whenExcahngeSale() {
        require(
            _currentSale.saleType == SaleType.EXCHANGE,
            "not exchange sale now."
        );
        _;
    }

    // ==================================================================
    // Functions
    // ==================================================================
    function getCurrentSale()
        external
        view
        virtual
        returns (
            uint8,
            SaleType,
            uint256,
            uint256
        )
    {
        return (
            _currentSale.id,
            _currentSale.saleType,
            _currentSale.mintCost,
            _currentSale.maxSupply
        );
    }

    function _withdraw() internal virtual {
        require(
            withdrawAddress != address(0),
            "withdraw address is 0 address."
        );
        withdrawAddress.sendValue(address(this).balance);
    }

    function _setCurrentSale(Sale calldata sale) internal virtual {
        uint8 oldId = _currentSale.id;
        _currentSale = sale;
        _soldCount = 0;

        emit ChangeSale(oldId, sale.id);
    }

    function _totalSupply() internal view virtual returns (uint256);
}

File 30 of 44 : IBasicSale.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;

import "./Sale.sol";

interface IBasicSale {
    function getCurrentSale()
        external
        view
        returns (
            uint8,
            SaleType,
            uint256,
            uint256
        );

    function setCurrentSale(Sale calldata sale) external;

    // payable for testability
    function withdraw() external payable;

    function setWithdrawAddress(address payable value) external;

    function setMaxSupply(uint256 value) external;

    function pause() external;

    function unpause() external;
}

File 31 of 44 : Sale.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;

enum SaleType {
  CLAIM,
  EXCHANGE
}

struct Sale {
    uint8 id;
    uint248 mintCost;
    uint248 maxSupply;
    SaleType saleType;
}

File 32 of 44 : SalesRecord.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;

struct SalesRecord {
    uint8 id;
    uint248 amount;
}

File 33 of 44 : ERC721MultiSale.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;

import "./IERC721MultiSale.sol";
import "../BasicSale.sol";
import "../SalesRecord.sol";

abstract contract ERC721MultiSale is IERC721MultiSale, BasicSale {
    // ==================================================================
    // Modifier
    // ==================================================================
    mapping(address => SalesRecord) internal _salesRecordByBuyer;

    // ==================================================================
    // Modifier
    // ==================================================================
    modifier isNotOverAllowedAmount(uint248 amount, uint248 allowedAmount) {
        require(
            getBuyCount() + amount <= allowedAmount,
            "claim is over allowed amount."
        );
        _;
    }

    // ==================================================================
    // Function
    // ==================================================================
    // ------------------------------------------------------------------
    // external & public
    // ------------------------------------------------------------------
    function getBuyCount() public view returns (uint256) {
        SalesRecord storage record = _salesRecordByBuyer[msg.sender];

        if (record.id == _currentSale.id) {
            return record.amount;
        } else {
            return 0;
        }
    }

    // ------------------------------------------------------------------
    // internal & private
    // ------------------------------------------------------------------
    function _claim(uint248 amount, uint248 allowedAmount)
        internal
        virtual
        whenNotPaused
        isNotOverMaxSupply(amount)
        isNotOverMaxSaleSupply(amount)
        isNotOverAllowedAmount(amount, allowedAmount)
        whenClaimSale
    {
        _record(amount);
    }

    function _exchange(uint256[] calldata burnTokenIds, uint248 allowedAmount)
        internal
        virtual
        whenNotPaused
        isNotOverMaxSaleSupply(burnTokenIds.length)
        isNotOverAllowedAmount(uint248(burnTokenIds.length), allowedAmount)
        whenExcahngeSale
    {
        _record(uint248(burnTokenIds.length));
    }

    function _record(uint248 amount) private {
        SalesRecord storage record = _salesRecordByBuyer[msg.sender];

        if (record.id == _currentSale.id) {
            record.amount += amount;
        } else {
            record.id = _currentSale.id;
            record.amount = amount;
        }

        _soldCount += amount;
    }
}

File 34 of 44 : IERC721MultiSale.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;

interface IERC721MultiSale {    
    function getBuyCount() external view returns(uint256);
}

File 35 of 44 : ERC721MultiSaleByMerkle.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;

import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./IERC721MultiSaleByMerkle.sol";
import "../ERC721MultiSale.sol";

abstract contract ERC721MultiSaleByMerkle is
    IERC721MultiSaleByMerkle,
    ERC721MultiSale
{
    bytes32 internal _merkleRoot;

    // ==================================================================
    // Modifier
    // ==================================================================
    modifier hasRight(
        uint248 amount,
        uint248 allowedAmount,
        bytes32[] calldata merkleProof
    ) {
        bytes32 node = keccak256(abi.encodePacked(msg.sender, allowedAmount));
        require(
            MerkleProof.verifyCalldata(merkleProof, _merkleRoot, node),
            "invalid proof."
        );
        _;
    }

    // ==================================================================
    // Function
    // ==================================================================
    function _claim(
        uint248 amount,
        uint248 allowedAmount,
        bytes32[] calldata merkleProof
    ) internal virtual hasRight(amount, allowedAmount, merkleProof) {
        _claim(amount, allowedAmount);
    }

    function _exchange(
        uint256[] calldata burnTokenIds,
        uint248 allowedAmount,
        bytes32[] calldata merkleProof
    )
        internal
        virtual
        hasRight(uint248(burnTokenIds.length), allowedAmount, merkleProof)
    {
        _exchange(burnTokenIds, allowedAmount);
    }

    function _setCurrentSale(Sale calldata sale, bytes32 merkleRoot) internal {
        _merkleRoot = merkleRoot;
        _setCurrentSale(sale);
    }

    // ------------------------------------------------------------------
    // unused super function
    // ------------------------------------------------------------------
    function setCurrentSale(
        Sale calldata /** sale */
    ) external pure virtual {
        revert("no use.");
    }
}

File 36 of 44 : IERC721MultiSaleByMerkle.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.9 <0.9.0;

import "../../Sale.sol";

interface IERC721MultiSaleByMerkle {

  function claim(uint248 amount, uint248 allowedAmount, bytes32[] calldata merkleProof) external payable;
  
  function exchange(uint256[] calldata burnTokenIds, uint248 allowedAmount, bytes32[] calldata merkleProof) external payable;

  function setCurrentSale(Sale calldata sale, bytes32 merkleRoot) external;
}

File 37 of 44 : ERC721Psi.sol
// 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 {}
}

File 38 of 44 : ERC721PsiBurnable.sol
// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _ 
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/ 
 | |____| | \ \| |____  / /   / /_ | |  | |   
 |______|_|  \_\\_____|/_/   |____||_|  |_|   
                                              
                                            
 */
pragma solidity ^0.8.0;

import "solidity-bits/contracts/BitMaps.sol";
import "../ERC721Psi.sol";


abstract contract ERC721PsiBurnable is ERC721Psi {
    using BitMaps for BitMaps.BitMap;
    BitMaps.BitMap private _burnedToken;

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address from = ownerOf(tokenId);
        _beforeTokenTransfers(from, address(0), tokenId, 1);
        _burnedToken.set(tokenId);
        
        emit Transfer(from, address(0), tokenId);

        _afterTokenTransfers(from, address(0), tokenId, 1);
    }

    /**
     * @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`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view override virtual returns (bool){
        if(_burnedToken.get(tokenId)) {
            return false;
        } 
        return super._exists(tokenId);
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalMinted() - _burned();
    }

    /**
     * @dev Returns number of token burned.
     */
    function _burned() internal view returns (uint256 burned){
        uint256 startBucket = _startTokenId() >> 8;
        uint256 lastBucket = (_nextTokenId() >> 8) + 1;

        for(uint256 i=startBucket; i < lastBucket; i++) {
            uint256 bucket = _burnedToken.getBucket(i);
            burned += _popcount(bucket);
        }
    }

    /**
     * @dev Returns number of set bits.
     */
    function _popcount(uint256 x) private pure returns (uint256 count) {
        unchecked{
            for (count=0; x!=0; count++)
                x &= x - 1;
        }
    }
}

File 39 of 44 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);
    function register(address registrant) external;
    function registerAndSubscribe(address registrant, address subscription) external;
    function registerAndCopyEntries(address registrant, address registrantToCopy) external;
    function unregister(address addr) external;
    function updateOperator(address registrant, address operator, bool filtered) external;
    function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
    function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
    function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
    function subscribe(address registrant, address registrantToSubscribe) external;
    function unsubscribe(address registrant, bool copyExistingEntries) external;
    function subscriptionOf(address addr) external returns (address registrant);
    function subscribers(address registrant) external returns (address[] memory);
    function subscriberAt(address registrant, uint256 index) external returns (address);
    function copyEntriesOf(address registrant, address registrantToCopy) external;
    function isOperatorFiltered(address registrant, address operator) external returns (bool);
    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
    function filteredOperators(address addr) external returns (address[] memory);
    function filteredCodeHashes(address addr) external returns (bytes32[] memory);
    function filteredOperatorAt(address registrant, uint256 index) external returns (address);
    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
    function isRegistered(address addr) external returns (bool);
    function codeHashOf(address addr) external returns (bytes32);
}

File 40 of 44 : RevokableDefaultOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {RevokableOperatorFilterer} from "./RevokableOperatorFilterer.sol";

/**
 * @title  RevokableDefaultOperatorFilterer
 * @notice Inherits from RevokableOperatorFilterer and automatically subscribes to the default OpenSea subscription.
 *         Note that OpenSea will disable creator fee enforcement if filtered operators begin fulfilling orders
 *         on-chain, eg, if the registry is revoked or bypassed.
 */
abstract contract RevokableDefaultOperatorFilterer is RevokableOperatorFilterer {
    address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);

    constructor() RevokableOperatorFilterer(0x000000000000AAeB6D7670E522A718067333cd4E, DEFAULT_SUBSCRIPTION, true) {}
}

File 41 of 44 : RevokableOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {UpdatableOperatorFilterer} from "./UpdatableOperatorFilterer.sol";
import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";

/**
 * @title  RevokableOperatorFilterer
 * @notice This contract is meant to allow contracts to permanently skip OperatorFilterRegistry checks if desired. The
 *         Registry itself has an "unregister" function, but if the contract is ownable, the owner can re-register at
 *         any point. As implemented, this abstract contract allows the contract owner to permanently skip the
 *         OperatorFilterRegistry checks by calling revokeOperatorFilterRegistry. Once done, the registry
 *         address cannot be further updated.
 *         Note that OpenSea will still disable creator fee enforcement if filtered operators begin fulfilling orders
 *         on-chain, eg, if the registry is revoked or bypassed.
 */
abstract contract RevokableOperatorFilterer is UpdatableOperatorFilterer {
    error RegistryHasBeenRevoked();
    error InitialRegistryAddressCannotBeZeroAddress();

    bool public isOperatorFilterRegistryRevoked;

    constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe)
        UpdatableOperatorFilterer(_registry, subscriptionOrRegistrantToCopy, subscribe)
    {
        // don't allow creating a contract with a permanently revoked registry
        if (_registry == address(0)) {
            revert InitialRegistryAddressCannotBeZeroAddress();
        }
    }

    function _checkFilterOperator(address operator) internal view virtual override {
        if (address(operatorFilterRegistry) != address(0)) {
            super._checkFilterOperator(operator);
        }
    }

    /**
     * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
     *         address, checks will be permanently bypassed, and the address cannot be updated again. OnlyOwner.
     */
    function updateOperatorFilterRegistryAddress(address newRegistry) public override {
        if (msg.sender != owner()) {
            revert OnlyOwner();
        }
        // if registry has been revoked, do not allow further updates
        if (isOperatorFilterRegistryRevoked) {
            revert RegistryHasBeenRevoked();
        }

        operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
    }

    /**
     * @notice Revoke the OperatorFilterRegistry address, permanently bypassing checks. OnlyOwner.
     */
    function revokeOperatorFilterRegistry() public {
        if (msg.sender != owner()) {
            revert OnlyOwner();
        }
        // if registry has been revoked, do not allow further updates
        if (isOperatorFilterRegistryRevoked) {
            revert RegistryHasBeenRevoked();
        }

        // set to zero address to bypass checks
        operatorFilterRegistry = IOperatorFilterRegistry(address(0));
        isOperatorFilterRegistryRevoked = true;
    }
}

File 42 of 44 : UpdatableOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";

/**
 * @title  UpdatableOperatorFilterer
 * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
 *         registrant's entries in the OperatorFilterRegistry. This contract allows the Owner to update the
 *         OperatorFilterRegistry address via updateOperatorFilterRegistryAddress, including to the zero address,
 *         which will bypass registry checks.
 *         Note that OpenSea will still disable creator fee enforcement if filtered operators begin fulfilling orders
 *         on-chain, eg, if the registry is revoked or bypassed.
 * @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.
 */
abstract contract UpdatableOperatorFilterer {
    error OperatorNotAllowed(address operator);
    error OnlyOwner();

    IOperatorFilterRegistry public operatorFilterRegistry;

    constructor(address _registry, address subscriptionOrRegistrantToCopy, bool subscribe) {
        IOperatorFilterRegistry registry = IOperatorFilterRegistry(_registry);
        operatorFilterRegistry = registry;
        // 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(registry).code.length > 0) {
            if (subscribe) {
                registry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    registry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
                } else {
                    registry.register(address(this));
                }
            }
        }
    }

    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);
        }
        _;
    }

    modifier onlyAllowedOperatorApproval(address operator) virtual {
        _checkFilterOperator(operator);
        _;
    }

    /**
     * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
     *         address, checks will be bypassed. OnlyOwner.
     */
    function updateOperatorFilterRegistryAddress(address newRegistry) public virtual {
        if (msg.sender != owner()) {
            revert OnlyOwner();
        }
        operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
    }

    /**
     * @dev assume the contract has an owner, but leave specific Ownable implementation up to inheriting contract
     */
    function owner() public view virtual returns (address);

    function _checkFilterOperator(address operator) internal view virtual {
        IOperatorFilterRegistry registry = operatorFilterRegistry;
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(registry) != address(0) && address(registry).code.length > 0) {
            if (!registry.isOperatorAllowed(address(this), operator)) {
                revert OperatorNotAllowed(operator);
            }
        }
    }
}

File 43 of 44 : BitMaps.sol
// 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];
    }
}

File 44 of 44 : BitScan.sol
// 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]);
        } 
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 100
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InitialRegistryAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"RegistryHasBeenRevoked","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":"operator","type":"address"},{"indexed":true,"internalType":"uint256","name":"level","type":"uint256"}],"name":"CalLevelChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"oldId","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"newId","type":"uint8"}],"name":"ChangeSale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"transferer","type":"address"}],"name":"LocalCalAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"transferer","type":"address"}],"name":"LocalCalRemoved","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","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":"holder","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenLock","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"WalletLock","type":"event"},{"inputs":[],"name":"ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"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":[{"internalType":"address","name":"transferer","type":"address"}],"name":"addLocalContractAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"uint256[]","name":"amount","type":"uint256[]"}],"name":"adminMint","outputs":[],"stateMutability":"nonpayable","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":[],"name":"baseExtension","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint248","name":"amount","type":"uint248"},{"internalType":"uint248","name":"allowedAmount","type":"uint248"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"contractLockStatus","outputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableLock","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableRestrict","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"burnTokenIds","type":"uint256[]"},{"internalType":"uint248","name":"allowedAmount","type":"uint248"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"exchange","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"externalSupplier","outputs":[{"internalType":"contract ITokenUriSupplier","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":[],"name":"getBuyCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentSale","outputs":[{"internalType":"uint8","name":"","type":"uint8"},{"internalType":"enum SaleType","name":"","type":"uint8"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLocalContractAllowList","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":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"getTokensUnderLock","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokensUnderLock","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOperatorFilterRegistryRevoked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilterRegistry","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"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":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"transferer","type":"address"}],"name":"removeLocalContractAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revokeOperatorFilterRegistry","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":"royaltyFee","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","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":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_value","type":"string"}],"name":"setBaseExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_value","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"calAddress","type":"address"}],"name":"setCAL","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"level","type":"uint256"}],"name":"setCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"setContractLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"uint248","name":"mintCost","type":"uint248"},{"internalType":"uint248","name":"maxSupply","type":"uint248"},{"internalType":"enum SaleType","name":"saleType","type":"uint8"}],"internalType":"struct Sale","name":"sale","type":"tuple"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"setCurrentSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"uint248","name":"mintCost","type":"uint248"},{"internalType":"uint248","name":"maxSupply","type":"uint248"},{"internalType":"enum SaleType","name":"saleType","type":"uint8"}],"internalType":"struct Sale","name":"","type":"tuple"}],"name":"setCurrentSale","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setEnableLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setEnableRestrict","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_value","type":"address"}],"name":"setExternalSupplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"value","type":"uint96"}],"name":"setRoyaltyFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"level","type":"uint256"}],"name":"setTokenCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"enum IERC721Lockable.LockStatus","name":"newLockStatus","type":"uint8"}],"name":"setTokenLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setUnlockLeadTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"level","type":"uint256"}],"name":"setWalletCALLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"enum IERC721Lockable.LockStatus","name":"lockStatus","type":"uint8"}],"name":"setWalletLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"value","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":"tokenCALLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenLock","outputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"","type":"uint8"}],"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":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","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":"unlockLeadTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRegistry","type":"address"}],"name":"updateOperatorFilterRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"walletCALLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"walletLock","outputs":[{"internalType":"enum IERC721Lockable.LockStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdrawAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

600a805461ffff19166101011790556010805460ff191660019081179091556013556000601981905560a06040526080908152601f906200004190826200050e565b5060405180604001604052806005815260200164173539b7b760d91b815250602090816200007091906200050e565b50602180546001600160601b0319166103e8179055612a306024553480156200009857600080fd5b50604080518082018252601481527f43727970746f4e696e6a61204368696c6472656e00000000000000000000000060208083019190915282518084019093526003835262434e4360e81b90830152600180546001600160a01b0319166daaeb6d7670e522a718067333cd4e908117825591929190733cc6cdda760b79bafa08df41ecfa224f810dceb69082828282803b1562000241578115620001a057604051633e9f1edf60e11b81523060048201526001600160a01b038481166024830152821690637d3e3dbe906044015b600060405180830381600087803b1580156200018157600080fd5b505af115801562000196573d6000803e3d6000fd5b5050505062000241565b6001600160a01b03831615620001e55760405163a0af290360e01b81523060048201526001600160a01b03848116602483015282169063a0af29039060440162000166565b604051632210724360e11b81523060048201526001600160a01b03821690634420e48690602401600060405180830381600087803b1580156200022757600080fd5b505af11580156200023c573d6000803e3d6000fd5b505050505b5050506001600160a01b03841690506200026e5760405163c49d17ad60e01b815260040160405180910390fd5b506003915062000281905083826200050e565b5060046200029082826200050e565b5050600060065550620002a333620002ca565b6014805460ff60a01b19169055620002c46420a226a4a760d91b336200031c565b620005da565b601480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6200032662000336565b6200033282826200039e565b5050565b33620003416200043e565b6001600160a01b0316146200039c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000332576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620003fa3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620004556200045a60201b620022c61760201c565b905090565b6014546001600160a01b031690565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200049457607f821691505b602082108103620004b557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200050957600081815260208120601f850160051c81016020861015620004e45750805b601f850160051c820191505b818110156200050557828155600101620004f0565b5050505b505050565b81516001600160401b038111156200052a576200052a62000469565b62000542816200053b84546200047f565b84620004bb565b602080601f8311600181146200057a5760008415620005615750858301515b600019600386901b1c1916600185901b17855562000505565b600085815260208120601f198616915b82811015620005ab578886015182559484019460019091019084016200058a565b5085821015620005ca5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b615ceb80620005ea6000396000f3fe6080604052600436106104885760003560e01c80636f8b44b011610255578063a49340cc11610144578063d547741f116100c1578063ecba222a11610085578063ecba222a14610e24578063f263fb6514610e45578063f2fde38b14610e65578063f3b3059e14610e85578063f6aacfb114610ea5578063ff76821214610ec557600080fd5b8063d547741f14610d99578063d5abeb0114610db9578063da3ef23f14610dcf578063e985e9c514610def578063eb05629714610e0f57600080fd5b8063b8997a9711610108578063b8997a9714610cf6578063b8d1e53214610d2e578063c668286214610d4e578063c87b56dd14610d63578063ca6932d514610d8357600080fd5b8063a49340cc14610c56578063af1b45cc14610c76578063b0ccc31e14610c89578063b31391cb14610ca9578063b88d4fde14610cd657600080fd5b80638da5cb5b116101d2578063a059b16411610196578063a059b16414610bb4578063a217fddf14610bd4578063a22cb46514610be9578063a35c23ad14610c09578063a41216ac14610c3657600080fd5b80638da5cb5b14610b355780638f10fd4514610b4a57806391d1485414610b5f57806395d89b4114610b7f57806399a2557a14610b9457600080fd5b80637c3dc173116102195780637c3dc17314610aa057806380f801cb14610ac05780638456cb5914610ae05780638462151c14610af5578063874a8b0214610b1557600080fd5b80636f8b44b0146109fb57806370a0823114610a1b578063715018a614610a3b57806372b44d7114610a505780637988426914610a7057600080fd5b806331faafb41161037c5780634f3db346116102f95780635abd58d5116102bd5780635abd58d5146109445780635c64bb72146109575780635c975abb1461099c5780635ef9432a146109b15780636352211e146109c65780636c0360eb146109e657600080fd5b80634f3db346146108ae5780634f558e79146108c45780634fdaf052146108e457806352fc0c6b1461090457806355f804b31461092457600080fd5b80633ccfd60b116103405780633ccfd60b146108245780633f4ba83a1461082c57806342842e0e146108415780634a4fbeec146108615780634b81d8bd1461088157600080fd5b806331faafb41461078a57806336568abe146107aa578063374032a1146107ca578063396e8f53146107e45780633ab1a4941461080457600080fd5b80631581b6001161040a578063248a9ca3116103ce578063248a9ca3146106bf57806325752d18146106ef5780632a0acc6a1461070f5780632a55205a1461072b5780632f2ff15d1461076a57600080fd5b80631581b6001461060f57806315ba03521461062f57806318160ddd1461064f5780632398f8431461067257806323b872dd1461069f57600080fd5b8063081812fc11610451578063081812fc14610546578063095ea7b3146105735780630f4345e21461059357806310c395bf146105b357806313c52826146105df57600080fd5b80623f332f1461048d57806301ffc9a7146104b8578063025e332e146104e857806306fdde031461050a578063072653891461052c575b600080fd5b34801561049957600080fd5b506104a2610ee5565b6040516104af9190614c88565b60405180910390f35b3480156104c457600080fd5b506104d86104d3366004614ceb565b610ef4565b60405190151581526020016104af565b3480156104f457600080fd5b50610508610503366004614d1d565b610f32565b005b34801561051657600080fd5b5061051f610f67565b6040516104af9190614d8a565b34801561053857600080fd5b506010546104d89060ff1681565b34801561055257600080fd5b50610566610561366004614d9d565b610ff9565b6040516104af9190614db6565b34801561057f57600080fd5b5061050861058e366004614dca565b611089565b34801561059f57600080fd5b506105086105ae366004614d9d565b6110a2565b3480156105bf57600080fd5b50600a546105d290610100900460ff1681565b6040516104af9190614e0c565b3480156105eb57600080fd5b506105d26105fa366004614d1d565b600c6020526000908152604090205460ff1681565b34801561061b57600080fd5b50601554610566906001600160a01b031681565b34801561063b57600080fd5b5061050861064a366004614d9d565b6110ba565b34801561065b57600080fd5b506106646110d2565b6040519081526020016104af565b34801561067e57600080fd5b5061066461068d366004614d1d565b60126020526000908152604090205481565b3480156106ab57600080fd5b506105086106ba366004614e26565b6110ee565b3480156106cb57600080fd5b506106646106da366004614d9d565b60009081526020819052604090206001015490565b3480156106fb57600080fd5b5061050861070a366004614d1d565b611119565b34801561071b57600080fd5b506106646420a226a4a760d91b81565b34801561073757600080fd5b5061074b610746366004614e67565b61114e565b604080516001600160a01b0390931683526020830191909152016104af565b34801561077657600080fd5b50610508610785366004614e89565b6111fc565b34801561079657600080fd5b506105086107a5366004614eb9565b61120e565b3480156107b657600080fd5b506105086107c5366004614e89565b611256565b3480156107d657600080fd5b50600a546104d89060ff1681565b3480156107f057600080fd5b50600d54610566906001600160a01b031681565b34801561081057600080fd5b5061050861081f366004614d1d565b6112d0565b610508611316565b34801561083857600080fd5b50610508611333565b34801561084d57600080fd5b5061050861085c366004614e26565b61134d565b34801561086d57600080fd5b506104d861087c366004614d1d565b611372565b34801561088d57600080fd5b506108a161089c366004614e67565b611427565b6040516104af9190614ee2565b3480156108ba57600080fd5b5061066460135481565b3480156108d057600080fd5b506104d86108df366004614d9d565b6115f5565b3480156108f057600080fd5b506105086108ff366004614f29565b611600565b34801561091057600080fd5b5061050861091f366004614f56565b61161b565b34801561093057600080fd5b5061050861093f36600461502c565b61163d565b6105086109523660046150cd565b61165b565b34801561096357600080fd5b506017546018546040516104af9260ff80821693600160f81b8104909116926101009092046001600160f81b0390811692911690615131565b3480156109a857600080fd5b506104d86116c0565b3480156109bd57600080fd5b506105086116d0565b3480156109d257600080fd5b506105666109e1366004614d9d565b61174c565b3480156109f257600080fd5b5061051f611760565b348015610a0757600080fd5b50610508610a16366004614d9d565b6117ee565b348015610a2757600080fd5b50610664610a36366004614d1d565b611806565b348015610a4757600080fd5b50610508611899565b348015610a5c57600080fd5b50610508610a6b366004614d1d565b611935565b348015610a7c57600080fd5b506105d2610a8b366004614d9d565b600b6020526000908152604090205460ff1681565b348015610aac57600080fd5b50610508610abb366004614e67565b611950565b348015610acc57600080fd5b50601e54610566906001600160a01b031681565b348015610aec57600080fd5b506105086119e0565b348015610b0157600080fd5b506108a1610b10366004614d1d565b6119fa565b348015610b2157600080fd5b50610508610b30366004615166565b611ac0565b348015610b4157600080fd5b50610566611b82565b348015610b5657600080fd5b50610664611b8c565b348015610b6b57600080fd5b506104d8610b7a366004614e89565b611bc8565b348015610b8b57600080fd5b5061051f611bf1565b348015610ba057600080fd5b506108a1610baf36600461519b565b611c00565b348015610bc057600080fd5b50610508610bcf3660046151de565b611d77565b348015610be057600080fd5b50610664600081565b348015610bf557600080fd5b50610508610c043660046151fb565b611d9d565b348015610c1557600080fd5b50610508610c24366004614d9d565b33600090815260126020526040902055565b348015610c4257600080fd5b50610508610c513660046151de565b611db1565b348015610c6257600080fd5b50610508610c71366004615229565b611dd7565b610508610c84366004615288565b611eae565b348015610c9557600080fd5b50600154610566906001600160a01b031681565b348015610cb557600080fd5b50610664610cc4366004614d9d565b60116020526000908152604090205481565b348015610ce257600080fd5b50610508610cf136600461530c565b611f41565b348015610d0257600080fd5b50602154610d16906001600160601b031681565b6040516001600160601b0390911681526020016104af565b348015610d3a57600080fd5b50610508610d49366004614d1d565b611f67565b348015610d5a57600080fd5b5061051f611fed565b348015610d6f57600080fd5b5061051f610d7e366004614d9d565b611ffa565b348015610d8f57600080fd5b5061066460245481565b348015610da557600080fd5b50610508610db4366004614e89565b612005565b348015610dc557600080fd5b5061066460165481565b348015610ddb57600080fd5b50610508610dea36600461502c565b61200d565b348015610dfb57600080fd5b506104d8610e0a36600461538b565b61202b565b348015610e1b57600080fd5b506108a161205f565b348015610e3057600080fd5b506001546104d890600160a01b900460ff1681565b348015610e5157600080fd5b50610508610e603660046153b9565b612080565b348015610e7157600080fd5b50610508610e80366004614d1d565b6120b2565b348015610e9157600080fd5b50610508610ea03660046153d5565b612128565b348015610eb157600080fd5b506104d8610ec0366004614d9d565b612282565b348015610ed157600080fd5b50610508610ee0366004614d1d565b6122ab565b6060610eef6122d5565b905090565b6000610eff826122e1565b80610f0e5750610f0e82612320565b80610f1d5750610f1d82612345565b80610f2c5750610f2c82612383565b92915050565b6420a226a4a760d91b610f44816123b8565b600d80546001600160a01b0319166001600160a01b0384161790555050565b5050565b606060038054610f7690615428565b80601f0160208091040260200160405190810160405280929190818152602001828054610fa290615428565b8015610fef5780601f10610fc457610100808354040283529160200191610fef565b820191906000526020600020905b815481529060010190602001808311610fd257829003601f168201915b5050505050905090565b6000611004826123c2565b61106d5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600760205260409020546001600160a01b031690565b81611093816123e5565b61109d83836123ff565b505050565b6420a226a4a760d91b6110b4816123b8565b50601355565b6420a226a4a760d91b6110cc816123b8565b50602455565b60006110dc612413565b6110e4612475565b610eef9190615472565b826001600160a01b038116331461110857611108336123e5565b611113848484612485565b50505050565b6420a226a4a760d91b61112b816123b8565b50601e80546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152601d602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916111c3575060408051808201909152601c546001600160a01b0381168252600160a01b90046001600160601b031660208201525b6020810151600090612710906111e2906001600160601b031687615485565b6111ec919061549c565b91519350909150505b9250929050565b6112046124b6565b610f638282612517565b6420a226a4a760d91b611220816123b8565b602180546001600160601b0319166001600160601b038416908117909155601554610f63916001600160a01b039091169061259b565b6001600160a01b03811633146112c65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401611064565b610f638282612694565b6420a226a4a760d91b6112e2816123b8565b601580546001600160a01b0319166001600160a01b038416908117909155602154610f6391906001600160601b031661259b565b6420a226a4a760d91b611328816123b8565b6113306126f9565b50565b6420a226a4a760d91b611345816123b8565b611330612767565b826001600160a01b038116331461136757611367336123e5565b6111138484846127b6565b600a5460009060ff1661138757506000919050565b60026001600160a01b0383166000908152600c602052604090205460ff1660028111156113b6576113b6614df6565b148061141257506001600160a01b0382166000908152600c602052604081205460ff1660028111156113ea576113ea614df6565b14801561141257506002600a54610100900460ff16600281111561141057611410614df6565b145b1561141f57506001919050565b506000919050565b606060006114358484615472565b6114409060016154be565b6001600160401b0381111561145757611457614f81565b604051908082528060200260200182016040528015611480578160200160208202803683370190505b509050600080855b85811161152857611498816123c2565b80156114a857506114a881612282565b156114e35760018484815181106114c1576114c16154d1565b91151560209283029190910190910152816114db816154e7565b925050611508565b60008484815181106114f7576114f76154d1565b911515602092830291909101909101525b82611512816154e7565b9350508080611520906154e7565b915050611488565b506000816001600160401b0381111561154357611543614f81565b60405190808252806020026020018201604052801561156c578160200160208202803683370190505b5060009350905082875b8781116115e85785858151811061158f5761158f6154d1565b6020026020010151156115c857808383815181106115af576115af6154d1565b6020908102919091010152816115c4816154e7565b9250505b846115d2816154e7565b95505080806115e0906154e7565b915050611576565b5090979650505050505050565b6000610f2c826123c2565b6420a226a4a760d91b611612816123b8565b610f63826127d1565b6420a226a4a760d91b61162d816123b8565b611636836127fa565b50601b5550565b6420a226a4a760d91b61164f816123b8565b601f61109d8382615546565b6017546001600160f81b038086169161167b918391610100900416615485565b34101561169a5760405162461bcd60e51b815260040161106490615605565b6116a685858585612865565b6116b933866001600160f81b03166128d5565b5050505050565b601454600160a01b900460ff1690565b6116d8611b82565b6001600160a01b0316336001600160a01b03161461170957604051635fc483c560e01b815260040160405180910390fd5b600154600160a01b900460ff161561173457604051631551a48f60e11b815260040160405180910390fd5b600180546001600160a81b031916600160a01b179055565b600080611758836128ef565b509392505050565b601f805461176d90615428565b80601f016020809104026020016040519081016040528092919081815260200182805461179990615428565b80156117e65780601f106117bb576101008083540402835291602001916117e6565b820191906000526020600020905b8154815290600101906020018083116117c957829003601f168201915b505050505081565b6420a226a4a760d91b611800816123b8565b50601655565b60006001600160a01b0382166118745760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401611064565b506001600160a01b03166000908152602560205260409020546001600160401b031690565b6118a16124b6565b60405162461bcd60e51b815260206004820152605b60248201527f43616e206e6f742072656e6f756e63654f776e6572736869702e20496e20746860448201527f6520616273656e6365206f6620746865204f776e65722c20746865207379737460648201527f656d2077696c6c206e6f74206265206f7065726174696f6e616c2e0000000000608482015260a401611064565b6420a226a4a760d91b611947816123b8565b610f6382612986565b8161195a8161174c565b6001600160a01b0316336001600160a01b0316146119cd5760405162461bcd60e51b815260206004820152602a60248201527f5265737472696374417070726f76653a206f7065726174696f6e206973206f6e604482015269363c903437b63232b91760b11b6064820152608401611064565b5060009182526011602052604090912055565b6420a226a4a760d91b6119f2816123b8565b6113306129cb565b6060600080611a0884611806565b90506000816001600160401b03811115611a2457611a24614f81565b604051908082528060200260200182016040528015611a4d578160200160208202803683370190505b50905060005b828414611ab757611a63816123c2565b15611aaf57856001600160a01b0316611a7b8261174c565b6001600160a01b031603611aaf5780828580600101965081518110611aa257611aa26154d1565b6020026020010181815250505b600101611a53565b50949350505050565b336001600160a01b03831614611b095760405162461bcd60e51b815260206004820152600e60248201526d37b7363c903cb7bab939b2b6331760911b6044820152606401611064565b60026001600160a01b0383166000908152600c602052604090205460ff166002811115611b3857611b38614df6565b148015611b5757506002816002811115611b5457611b54614df6565b14155b15611b78576001600160a01b03821660009081526023602052604090204290555b610f638282612a0e565b6000610eef6122c6565b336000908152601a60205260408120601754815460ff918216911603611bc0575461010090046001600160f81b0316919050565b600091505090565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610f7690615428565b6060818310611c515760405162461bcd60e51b815260206004820181905260248201527f7374617274206d7573742062652067726561746572207468616e2073746f702e6044820152606401611064565b600080611c5d60065490565b905080841115611c6b578093505b6000611c7687611806565b905084861015611c955785850381811015611c8f578091505b50611c99565b5060005b6000816001600160401b03811115611cb357611cb3614f81565b604051908082528060200260200182016040528015611cdc578160200160208202803683370190505b50905081600003611cf2579350611d7092505050565b865b868114158015611d045750828514155b15611d6657611d12816123c2565b15611d5e57886001600160a01b0316611d2a8261174c565b6001600160a01b031603611d5e5780828680600101975081518110611d5157611d516154d1565b6020026020010181815250505b600101611cf4565b5092835250909150505b9392505050565b6420a226a4a760d91b611d89816123b8565b506010805460ff1916911515919091179055565b81611da7816123e5565b61109d8383612a97565b6420a226a4a760d91b611dc3816123b8565b50600a805460ff1916911515919091179055565b6420a226a4a760d91b611de9816123b8565b838214611df557600080fd5b60005b84811015611ea657601654611e0b612afe565b858584818110611e1d57611e1d6154d1565b90506020020135611e2e91906154be565b1115611e4c5760405162461bcd60e51b81526004016110649061562e565b611e94868683818110611e6157611e616154d1565b9050602002016020810190611e769190614d1d565b858584818110611e8857611e886154d1565b905060200201356128d5565b80611e9e816154e7565b915050611df8565b505050505050565b6017548490611ecc90829061010090046001600160f81b0316615485565b341015611eeb5760405162461bcd60e51b815260040161106490615605565b611ef88686868686612b08565b60005b85811015611f3657611f24878783818110611f1857611f186154d1565b90506020020135612b7d565b80611f2e816154e7565b915050611efb565b50611ea633866128d5565b836001600160a01b0381163314611f5b57611f5b336123e5565b6116b985858585612bd7565b611f6f611b82565b6001600160a01b0316336001600160a01b031614611fa057604051635fc483c560e01b815260040160405180910390fd5b600154600160a01b900460ff1615611fcb57604051631551a48f60e11b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6020805461176d90615428565b6060610f2c82612c09565b6112c66124b6565b6420a226a4a760d91b61201f816123b8565b602061109d8382615546565b600061203683611372565b8061204857506120468383612c9b565b155b1561205557506000610f2c565b611d708383612cbb565b606060008061206d60065490565b90506120798282611427565b9250505090565b60405162461bcd60e51b81526020600482015260076024820152663737903ab9b29760c91b6044820152606401611064565b6120ba6124b6565b6001600160a01b03811661211f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611064565b61133081612ce2565b816121755760405162461bcd60e51b815260206004820181905260248201527f746f6b656e496473206d7573742062652067726561746572207468616e20302e6044820152606401611064565b60005b82811015612200576121a1848483818110612195576121956154d1565b9050602002013561174c565b6001600160a01b0316336001600160a01b0316146121ee5760405162461bcd60e51b815260206004820152600a6024820152693737ba1037bbb732b91760b11b6044820152606401611064565b806121f8816154e7565b915050612178565b5060005b828110156122765761222e848483818110612221576122216154d1565b9050602002013583612d34565b1561226457426022600086868581811061224a5761224a6154d1565b905060200201358152602001908152602001600020819055505b8061226e816154e7565b915050612204565b5061109d838383612e8d565b600061228d82612f71565b8061229c575061229c8261306e565b80610f2c5750610f2c82613095565b6420a226a4a760d91b6122bd816123b8565b610f63826130d3565b6014546001600160a01b031690565b6060610eef600e613118565b60006001600160e01b031982166380ac58cd60e01b1480610f1d57506001600160e01b03198216635b5e139f60e01b1480610f2c5750610f2c82612383565b60006001600160e01b0319821663152a902d60e11b1480610f2c5750610f2c82613125565b6000612350826122e1565b8061235f575061235f82613146565b8061236e575061236e82613125565b80610f2c5750506001600160e01b0319161590565b60006001600160e01b03198216637965db0b60e01b1480610f2c57506301ffc9a760e01b6001600160e01b0319831614610f2c565b611330813361316b565b60006123cf6009836131c4565b156123dc57506000919050565b610f2c826131eb565b6001546001600160a01b0316156113305761133081613207565b61240982826132c0565b610f6382826132d4565b6006546000908190819061242b9060081c60016154be565b9050815b8181101561246f5760008181526009602052604090205461244f816133e6565b61245990866154be565b9450508080612467906154e7565b91505061242f565b50505090565b600080600654610eef9190615472565b61248f3382613405565b6124ab5760405162461bcd60e51b815260040161106490615665565b61109d8383836134ca565b336124bf611b82565b6001600160a01b0316146125155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611064565b565b6125218282611bc8565b610f63576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556125573390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6127106001600160601b03821611156126095760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401611064565b6001600160a01b03821661265b5760405162461bcd60e51b815260206004820152601960248201527822a921991c9c189d1034b73b30b634b2103932b1b2b4bb32b960391b6044820152606401611064565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601c55565b61269e8282611bc8565b15610f63576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6015546001600160a01b03166127515760405162461bcd60e51b815260206004820152601e60248201527f77697468647261772061646472657373206973203020616464726573732e00006044820152606401611064565b601554612515906001600160a01b0316476136a2565b61276f6137bb565b6014805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516127ac9190614db6565b60405180910390a1565b61109d83838360405180602001604052806000815250611f41565b600a805482919061ff0019166101008360028111156127f2576127f2614df6565b021790555050565b6017805460ff1690829061280e82826156c8565b505060006019557f75e3689da7799229d232f2c15fc530f1a386e47a961aea8ccc86ed74cfb4bd4f816128446020850185615740565b6040805160ff93841681529290911660208301520160405180910390a15050565b838383836000338460405160200161287e92919061575d565b6040516020818303038152906040528051906020012090506128a48383601b5484613806565b6128c05760405162461bcd60e51b815260040161106490615781565b6128ca898961381e565b505050505050505050565b610f63828260405180602001604052806000815250613951565b6000806128fb836123c2565b61295c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401611064565b61296583613992565b6000818152600560205260409020546001600160a01b031694909350915050565b612991600e8261399f565b506040516001600160a01b0382169033907f3b01c97343869ca2757fcc37cdb8f71683b0a7aed858e3755f4529a1db85729290600090a350565b6129d36139b4565b6014805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861279f3390565b6001600160a01b0382166000908152600c60205260409020805482919060ff19166001836002811115612a4357612a43614df6565b0217905550336001600160a01b0316826001600160a01b03167f9fdb14457e6a7bd3753c649831b026de987c06e52d16459a928540738c2ea34b83604051612a8b9190614e0c565b60405180910390a35050565b612aa033611372565b1580612aaa575080155b612ac65760405162461bcd60e51b8152600401611064906157a9565b612acf826139fc565b80612ad8575080155b612af45760405162461bcd60e51b8152600401611064906157e0565b610f638282613a08565b6000610eef6110d2565b8484905083838360003384604051602001612b2492919061575d565b604051602081830303815290604052805190602001209050612b4a8383601b5484613806565b612b665760405162461bcd60e51b815260040161106490615781565b612b718a8a8a613a40565b50505050505050505050565b6000612b888261174c565b9050612b98816000846001613b31565b612ba3600983613b3d565b60405182906000906001600160a01b03841690600080516020615b96833981519152908390a4610f63816000846001613b69565b612be13383613405565b612bfd5760405162461bcd60e51b815260040161106490615665565b61111384848484613b81565b601e546060906001600160a01b0316612c2a57612c2582613b9a565b610f2c565b601e5460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa158015612c73573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f2c919081019061582d565b600080612ca784613c13565b9050612cb38382613c55565b949350505050565b6000612cc78383612c9b565b1515600003612cd857506000610f2c565b611d708383613cee565b601480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001826002811115612d4a57612d4a614df6565b03612e0457336000908152600c602052604081205460ff16906002826002811115612d7757612d77614df6565b148015612da7575060016000868152600b602052604090205460ff166002811115612da457612da4614df6565b14155b905060006002836002811115612dbf57612dbf614df6565b14158015612def575060026000878152600b602052604090205460ff166002811115612ded57612ded614df6565b145b90508180612dfa5750805b9350505050610f2c565b6000826002811115612e1857612e18614df6565b03612e8557336000908152600c602052604081205460ff16906002826002811115612e4557612e45614df6565b14159050600060026000878152600b602052604090205460ff166002811115612e7057612e70614df6565b149050818015612dfa57509250610f2c915050565b506000610f2c565b60005b828110156111135781600b6000868685818110612eaf57612eaf6154d1565b60209081029290920135835250810191909152604001600020805460ff19166001836002811115612ee257612ee2614df6565b0217905550838382818110612ef957612ef96154d1565b90506020020135336001600160a01b0316612f1f868685818110612195576121956154d1565b6001600160a01b03167f80a668baf7ac68b329075f26c37b4428d4aa272c3bd4c9611b25f5fb1c473f7c85604051612f579190614e0c565b60405180910390a480612f69816154e7565b915050612e90565b600081612f7d816123c2565b612fdf5760405162461bcd60e51b815260206004820152602d60248201527f4c6f636b61626c653a206c6f636b696e6720717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b6064820152608401611064565b600a5460ff16612ff25760009150613068565b60026000848152600b602052604090205460ff16600281111561301757613017614df6565b148061305557506000838152600b602052604081205460ff16600281111561304157613041614df6565b148015613055575061305561087c8461174c565b156130635760019150613068565b600091505b50919050565b6024546000828152602260205260408120549091429161308e91906154be565b1192915050565b600042602454602360006130a88661174c565b6001600160a01b03166001600160a01b031681526020019081526020016000205461308e91906154be565b6130de600e82613d34565b506040516001600160a01b0382169033907fbd0af1fe0a2c1c7bb340c17a284a291138979c8eeb797e176dbd1c415199af3c90600090a350565b60606000611d7083613d49565b60006001600160e01b03198216630101c11560e71b1480610f2c5750610f2c825b60006001600160e01b03198216632742b5b960e01b1480610f2c5750610f2c826122e1565b6131758282611bc8565b610f635761318281613da5565b61318d836020613db7565b60405160200161319e92919061589a565b60408051601f198184030181529082905262461bcd60e51b825261106491600401614d8a565b600881901c600090815260208390526040902054600160ff1b60ff83161c16151592915050565b60006131f660065490565b82108015610f2c5750600192915050565b6001546001600160a01b0316801580159061322c57506000816001600160a01b03163b115b15610f6357604051633185c44d60e21b81523060048201526001600160a01b03838116602483015282169063c617113490604401602060405180830381865afa15801561327d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132a19190615909565b610f635781604051633b79c77360e21b81526004016110649190614db6565b6132ca8282613f52565b610f638282613fb7565b60006132df8261174c565b9050806001600160a01b0316836001600160a01b03160361334e5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401611064565b336001600160a01b038216148061336a575061336a813361202b565b6133dc5760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401611064565b61109d8383614032565b60005b8115613400576000198201909116906001016133e9565b919050565b6000613410826123c2565b6134745760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401611064565b600061347f8361174c565b9050806001600160a01b0316846001600160a01b031614806134ba5750836001600160a01b03166134af84610ff9565b6001600160a01b0316145b80612cb35750612cb3818561202b565b6000806134d6836128ef565b91509150846001600160a01b0316826001600160a01b0316146135505760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401611064565b6001600160a01b0384166135b65760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401611064565b6135c38585856001613b31565b6135ce600084614032565b60006135db8460016154be565b90506135e86002826131c4565b1580156135f6575060065481105b1561362d57600081815260056020526040902080546001600160a01b0319166001600160a01b03881617905561362d600282613b3d565b600084815260056020526040902080546001600160a01b0319166001600160a01b03871617905581841461366657613666600285613b3d565b83856001600160a01b0316876001600160a01b0316600080516020615b9683398151915260405160405180910390a4611ea68686866001613b69565b804710156136f25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401611064565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461373f576040519150601f19603f3d011682016040523d82523d6000602084013e613744565b606091505b505090508061109d5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401611064565b6137c36116c0565b6125155760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611064565b6000826138148686856140a0565b1495945050505050565b6138266139b4565b816001600160f81b031660165461383b612afe565b61384590836154be565b11156138635760405162461bcd60e51b81526004016110649061562e565b6018546019546001600160f81b0380861692169061388190836154be565b111561389f5760405162461bcd60e51b815260040161106490615926565b8383806001600160f81b0316826001600160f81b03166138bd611b8c565b6138c791906154be565b11156138e55760405162461bcd60e51b815260040161106490615968565b6000601854600160f81b900460ff16600181111561390557613905614df6565b146139485760405162461bcd60e51b81526020600482015260136024820152723737ba1031b630b4b69039b0b632903737bb9760691b6044820152606401611064565b611ea6866140e3565b600061395c60065490565b9050613968848461418a565b613976600085838686614305565b6111135760405162461bcd60e51b81526004016110649061599f565b6000610f2c60028361443c565b6000611d70836001600160a01b038416614534565b6139bc6116c0565b156125155760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611064565b6000610f2c3383612c9b565b613a11826139fc565b80613a1a575080155b613a365760405162461bcd60e51b8152600401611064906157e0565b610f63828261462e565b613a486139b4565b60185460195483916001600160f81b031690613a6490836154be565b1115613a825760405162461bcd60e51b815260040161106490615926565b82826001600160f81b03808216908316613a9a611b8c565b613aa491906154be565b1115613ac25760405162461bcd60e51b815260040161106490615968565b6001601854600160f81b900460ff166001811115613ae257613ae2614df6565b14613b285760405162461bcd60e51b81526020600482015260166024820152753737ba1032bc31b430b733b29039b0b632903737bb9760511b6044820152606401611064565b611ea6856140e3565b61111384848484614667565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b613b75848484846146f2565b6111138484848461489b565b613b8c8484846134ca565b613976848484600185614305565b6060601f613ba7836148b3565b613bb084612282565b613bc95760405180602001604052806000815250613be8565b604051806040016040528060058152602001645f6c6f636b60d81b8152505b6020604051602001613bfd9493929190615a67565b6040516020818303038152906040529050919050565b6001600160a01b03811660009081526012602052604081205415613c4d57506001600160a01b031660009081526012602052604090205490565b505060135490565b60105460009060ff16613c6a57506001610f2c565b613c7383614945565b80611d705750600d54604051630f8350ed60e41b81526001600160a01b038581166004830152602482018590529091169063f8350ed090604401602060405180830381865afa158015613cca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d709190615909565b6000613cf983611372565b15613d0657506000610f2c565b6001600160a01b0380841660009081526008602090815260408083209386168352929052205460ff16611d70565b6000611d70836001600160a01b03841661496f565b606081600001805480602002602001604051908101604052809291908181526020018280548015613d9957602002820191906000526020600020905b815481526020019060010190808311613d85575b50505050509050919050565b6060610f2c6001600160a01b03831660145b60606000613dc6836002615485565b613dd19060026154be565b6001600160401b03811115613de857613de8614f81565b6040519080825280601f01601f191660200182016040528015613e12576020820181803683370190505b509050600360fc1b81600081518110613e2d57613e2d6154d1565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613e5c57613e5c6154d1565b60200101906001600160f81b031916908160001a9053506000613e80846002615485565b613e8b9060016154be565b90505b6001811115613f03576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613ebf57613ebf6154d1565b1a60f81b828281518110613ed557613ed56154d1565b60200101906001600160f81b031916908160001a90535060049490941c93613efc81615aae565b9050613e8e565b508315611d705760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611064565b613f5b81612282565b15610f635760405162461bcd60e51b815260206004820152602660248201527f4c6f636b61626c653a2043616e206e6f7420617070726f7665206c6f636b6564604482015265103a37b5b2b760d11b6064820152608401611064565b6001600160a01b03821615610f6357613fd081836149b6565b610f635760405162461bcd60e51b815260206004820152602d60248201527f5265737472696374417070726f76653a2054686520636f6e747261637420697360448201526c103737ba1030b63637bbb2b21760991b6064820152608401611064565b600081815260076020526040902080546001600160a01b0319166001600160a01b03841690811790915581906140678261174c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600081815b84811015611ab7576140cf828787848181106140c3576140c36154d1565b905060200201356149c3565b9150806140db816154e7565b9150506140a5565b336000908152601a60205260409020601754815460ff91821691160361414e5780548290829060019061412590849061010090046001600160f81b0316615ac5565b92506101000a8154816001600160f81b0302191690836001600160f81b03160217905550614166565b60175460ff166101006001600160f81b038416021781555b816001600160f81b03166019600082825461418191906154be565b90915550505050565b600061419560065490565b9050600082116141f55760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401611064565b6001600160a01b0383166142575760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611064565b6142646000848385613b31565b816006600082825461427691906154be565b9091555050600081815260056020526040902080546001600160a01b0319166001600160a01b0385161790556142ad600282613b3d565b6142ba6000848385613b69565b805b6142c683836154be565b8110156111135760405181906001600160a01b03861690600090600080516020615b96833981519152908290a4806142fd816154e7565b9150506142bc565b60006001600160a01b0385163b1561442f57506001835b61432684866154be565b81101561442957604051630a85bd0160e11b81526001600160a01b0387169063150b7a029061435f9033908b9086908990600401615ae5565b6020604051808303816000875af192505050801561439a575060408051601f3d908101601f1916820190925261439791810190615b22565b60015b6143f7573d8080156143c8576040519150601f19603f3d011682016040523d82523d6000602084013e6143cd565b606091505b5080516000036143ef5760405162461bcd60e51b81526004016110649061599f565b805181602001fd5b82801561441457506001600160e01b03198116630a85bd0160e11b145b92505080614421816154e7565b91505061431c565b50614433565b5060015b95945050505050565b600881901c60008181526020849052604081205490919060ff808516919082181c801561447e5761446c816149f2565b60ff168203600884901b17935061452b565b600083116144eb5760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401611064565b50600019909101600081815260208690526040902054909190801561452657614513816149f2565b60ff0360ff16600884901b17935061452b565b61447e565b50505092915050565b6000818152600183016020526040812054801561461d576000614558600183615472565b855490915060009061456c90600190615472565b90508181146145d157600086600001828154811061458c5761458c6154d1565b90600052602060002001549050808760000184815481106145af576145af6154d1565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806145e2576145e2615b3f565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610f2c565b6000915050610f2c565b5092915050565b61463733611372565b1580614641575080155b61465d5760405162461bcd60e51b8152600401611064906157a9565b610f638282614a5c565b6001600160a01b0384161580159061468757506001600160a01b03831615155b156111135761469582612282565b156111135760405162461bcd60e51b815260206004820152602760248201527f4c6f636b61626c653a2043616e206e6f74207472616e73666572206c6f636b6560448201526632103a37b5b2b760c91b6064820152608401611064565b600160401b811061470257600080fd5b806001600160a01b0385161561476c576001600160a01b038516600090815260256020526040812080548392906147439084906001600160401b0316615b55565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506147cc565b6001600160a01b038416600090815260256020526040902080548291906008906147a7908490600160401b90046001600160401b0316615b75565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b03841615614835576001600160a01b0384166000908152602560205260408120805483929061480c9084906001600160401b0316615b75565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506116b9565b6001600160a01b03851660009081526025602052604090208054829190601090614870908490600160801b90046001600160401b0316615b75565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505050505050565b6148a784848484614b19565b61111384848484614b43565b606060006148c083614b66565b60010190506000816001600160401b038111156148df576148df614f81565b6040519080825280601f01601f191660200182016040528015614909576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461491357509392505050565b6000610f2c600e836001600160a01b03811660009081526001830160205260408120541515611d70565b6000818152600183016020526040812054612e8557508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610f2c565b600080612ca73385614c3e565b60008183106149df576000828152602084905260409020611d70565b6000838152602083905260409020611d70565b60006040518061012001604052806101008152602001615bb6610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff614a3b85614c70565b02901c81518110614a4e57614a4e6154d1565b016020015160f81c92915050565b336001600160a01b03831603614ab45760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401611064565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101612a8b565b6001600160a01b03841615611113576000828152600b60205260409020805460ff19169055611113565b6001600160a01b0384161561111357600082815260116020526040812055611113565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310614ba55772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310614bd1576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310614bef57662386f26fc10000830492506010015b6305f5e1008310614c07576305f5e100830492506008015b6127108310614c1b57612710830492506004015b60648310614c2d576064830492506002015b600a8310610f2c5760010192915050565b60008181526011602052604081205415614c675750600081815260116020526040902054610f2c565b611d7083613c13565b6000808211614c7e57600080fd5b5060008190031690565b6020808252825182820181905260009190848201906040850190845b81811015614cc95783516001600160a01b031683529284019291840191600101614ca4565b50909695505050505050565b6001600160e01b03198116811461133057600080fd5b600060208284031215614cfd57600080fd5b8135611d7081614cd5565b6001600160a01b038116811461133057600080fd5b600060208284031215614d2f57600080fd5b8135611d7081614d08565b60005b83811015614d55578181015183820152602001614d3d565b50506000910152565b60008151808452614d76816020860160208601614d3a565b601f01601f19169290920160200192915050565b602081526000611d706020830184614d5e565b600060208284031215614daf57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b60008060408385031215614ddd57600080fd5b8235614de881614d08565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310614e2057614e20614df6565b91905290565b600080600060608486031215614e3b57600080fd5b8335614e4681614d08565b92506020840135614e5681614d08565b929592945050506040919091013590565b60008060408385031215614e7a57600080fd5b50508035926020909101359150565b60008060408385031215614e9c57600080fd5b823591506020830135614eae81614d08565b809150509250929050565b600060208284031215614ecb57600080fd5b81356001600160601b0381168114611d7057600080fd5b6020808252825182820181905260009190848201906040850190845b81811015614cc957835183529284019291840191600101614efe565b80356003811061340057600080fd5b600060208284031215614f3b57600080fd5b611d7082614f1a565b60006080828403121561306857600080fd5b60008060a08385031215614f6957600080fd5b614f738484614f44565b946080939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614fbf57614fbf614f81565b604052919050565b60006001600160401b03821115614fe057614fe0614f81565b50601f01601f191660200190565b6000615001614ffc84614fc7565b614f97565b905082815283838301111561501557600080fd5b828260208301376000602084830101529392505050565b60006020828403121561503e57600080fd5b81356001600160401b0381111561505457600080fd5b8201601f8101841361506557600080fd5b612cb384823560208401614fee565b6001600160f81b038116811461133057600080fd5b60008083601f84011261509b57600080fd5b5081356001600160401b038111156150b257600080fd5b6020830191508360208260051b85010111156111f557600080fd5b600080600080606085870312156150e357600080fd5b84356150ee81615074565b935060208501356150fe81615074565b925060408501356001600160401b0381111561511957600080fd5b61512587828801615089565b95989497509550505050565b60ff85168152608081016002851061514b5761514b614df6565b84602083015283604083015282606083015295945050505050565b6000806040838503121561517957600080fd5b823561518481614d08565b915061519260208401614f1a565b90509250929050565b6000806000606084860312156151b057600080fd5b83356151bb81614d08565b95602085013595506040909401359392505050565b801515811461133057600080fd5b6000602082840312156151f057600080fd5b8135611d70816151d0565b6000806040838503121561520e57600080fd5b823561521981614d08565b91506020830135614eae816151d0565b6000806000806040858703121561523f57600080fd5b84356001600160401b038082111561525657600080fd5b61526288838901615089565b9096509450602087013591508082111561527b57600080fd5b5061512587828801615089565b6000806000806000606086880312156152a057600080fd5b85356001600160401b03808211156152b757600080fd5b6152c389838a01615089565b9097509550602088013591506152d882615074565b909350604087013590808211156152ee57600080fd5b506152fb88828901615089565b969995985093965092949392505050565b6000806000806080858703121561532257600080fd5b843561532d81614d08565b9350602085013561533d81614d08565b92506040850135915060608501356001600160401b0381111561535f57600080fd5b8501601f8101871361537057600080fd5b61537f87823560208401614fee565b91505092959194509250565b6000806040838503121561539e57600080fd5b82356153a981614d08565b91506020830135614eae81614d08565b6000608082840312156153cb57600080fd5b611d708383614f44565b6000806000604084860312156153ea57600080fd5b83356001600160401b0381111561540057600080fd5b61540c86828701615089565b909450925061541f905060208501614f1a565b90509250925092565b600181811c9082168061543c57607f821691505b60208210810361306857634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610f2c57610f2c61545c565b8082028115828204841417610f2c57610f2c61545c565b6000826154b957634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610f2c57610f2c61545c565b634e487b7160e01b600052603260045260246000fd5b6000600182016154f9576154f961545c565b5060010190565b601f82111561109d57600081815260208120601f850160051c810160208610156155275750805b601f850160051c820191505b81811015611ea657828155600101615533565b81516001600160401b0381111561555f5761555f614f81565b6155738161556d8454615428565b84615500565b602080601f8311600181146155a857600084156155905750858301515b600019600386901b1c1916600185901b178555611ea6565b600085815260208120601f198616915b828110156155d7578886015182559484019460019091019084016155b8565b50858210156155f55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020808252600f908201526e3737ba1032b737bab3b41032ba341760891b604082015260600190565b6020808252601d908201527f636c61696d206973206f76657220746865206d617820737570706c792e000000604082015260600190565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b60ff8116811461133057600080fd5b81356156d3816156b9565b60ff8116905060ff19818184541617835560208401356156f281615074565b60081b16178155604082013561570781615074565b60608301356002811061571957600080fd5b6001600160f81b039190911660f89190911b6001600160f81b031916176001919091015550565b60006020828403121561575257600080fd5b8135611d70816156b9565b60609290921b6001600160601b031916825260081b60ff1916601482015260330190565b6020808252600e908201526d34b73b30b634b210383937b7b31760911b604082015260600190565b6020808252601c908201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e00000000604082015260600190565b6020808252602d908201527f5265737472696374417070726f76653a2043616e206e6f7420617070726f766560408201526c103637b1b5b2b2103a37b5b2b760991b606082015260800190565b60006020828403121561583f57600080fd5b81516001600160401b0381111561585557600080fd5b8201601f8101841361586657600080fd5b8051615874614ffc82614fc7565b81815285602083850101111561588957600080fd5b614433826020830160208601614d3a565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516158cc816017850160208801614d3a565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516158fd816028840160208801614d3a565b01602801949350505050565b60006020828403121561591b57600080fd5b8151611d70816151d0565b60208082526022908201527f636c61696d206973206f76657220746865206d61782073616c6520737570706c6040820152613c9760f11b606082015260800190565b6020808252601d908201527f636c61696d206973206f76657220616c6c6f77656420616d6f756e742e000000604082015260600190565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b60008154615a0181615428565b60018281168015615a195760018114615a2e57615a5d565b60ff1984168752821515830287019450615a5d565b8560005260208060002060005b85811015615a545781548a820152908401908201615a3b565b50505082870194505b5050505092915050565b6000615a7382876159f4565b8551615a83818360208a01614d3a565b8551910190615a96818360208901614d3a565b615aa2818301866159f4565b98975050505050505050565b600081615abd57615abd61545c565b506000190190565b6001600160f81b038181168382160190808211156146275761462761545c565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615b1890830184614d5e565b9695505050505050565b600060208284031215615b3457600080fd5b8151611d7081614cd5565b634e487b7160e01b600052603160045260246000fd5b6001600160401b038281168282160390808211156146275761462761545c565b6001600160401b038181168382160190808211156146275761462761545c56feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a264697066735822122019ac440e785e2fce352cb3937970336da9981c76282f9fabd138d5709c8e414464736f6c63430008110033

Deployed Bytecode

0x6080604052600436106104885760003560e01c80636f8b44b011610255578063a49340cc11610144578063d547741f116100c1578063ecba222a11610085578063ecba222a14610e24578063f263fb6514610e45578063f2fde38b14610e65578063f3b3059e14610e85578063f6aacfb114610ea5578063ff76821214610ec557600080fd5b8063d547741f14610d99578063d5abeb0114610db9578063da3ef23f14610dcf578063e985e9c514610def578063eb05629714610e0f57600080fd5b8063b8997a9711610108578063b8997a9714610cf6578063b8d1e53214610d2e578063c668286214610d4e578063c87b56dd14610d63578063ca6932d514610d8357600080fd5b8063a49340cc14610c56578063af1b45cc14610c76578063b0ccc31e14610c89578063b31391cb14610ca9578063b88d4fde14610cd657600080fd5b80638da5cb5b116101d2578063a059b16411610196578063a059b16414610bb4578063a217fddf14610bd4578063a22cb46514610be9578063a35c23ad14610c09578063a41216ac14610c3657600080fd5b80638da5cb5b14610b355780638f10fd4514610b4a57806391d1485414610b5f57806395d89b4114610b7f57806399a2557a14610b9457600080fd5b80637c3dc173116102195780637c3dc17314610aa057806380f801cb14610ac05780638456cb5914610ae05780638462151c14610af5578063874a8b0214610b1557600080fd5b80636f8b44b0146109fb57806370a0823114610a1b578063715018a614610a3b57806372b44d7114610a505780637988426914610a7057600080fd5b806331faafb41161037c5780634f3db346116102f95780635abd58d5116102bd5780635abd58d5146109445780635c64bb72146109575780635c975abb1461099c5780635ef9432a146109b15780636352211e146109c65780636c0360eb146109e657600080fd5b80634f3db346146108ae5780634f558e79146108c45780634fdaf052146108e457806352fc0c6b1461090457806355f804b31461092457600080fd5b80633ccfd60b116103405780633ccfd60b146108245780633f4ba83a1461082c57806342842e0e146108415780634a4fbeec146108615780634b81d8bd1461088157600080fd5b806331faafb41461078a57806336568abe146107aa578063374032a1146107ca578063396e8f53146107e45780633ab1a4941461080457600080fd5b80631581b6001161040a578063248a9ca3116103ce578063248a9ca3146106bf57806325752d18146106ef5780632a0acc6a1461070f5780632a55205a1461072b5780632f2ff15d1461076a57600080fd5b80631581b6001461060f57806315ba03521461062f57806318160ddd1461064f5780632398f8431461067257806323b872dd1461069f57600080fd5b8063081812fc11610451578063081812fc14610546578063095ea7b3146105735780630f4345e21461059357806310c395bf146105b357806313c52826146105df57600080fd5b80623f332f1461048d57806301ffc9a7146104b8578063025e332e146104e857806306fdde031461050a578063072653891461052c575b600080fd5b34801561049957600080fd5b506104a2610ee5565b6040516104af9190614c88565b60405180910390f35b3480156104c457600080fd5b506104d86104d3366004614ceb565b610ef4565b60405190151581526020016104af565b3480156104f457600080fd5b50610508610503366004614d1d565b610f32565b005b34801561051657600080fd5b5061051f610f67565b6040516104af9190614d8a565b34801561053857600080fd5b506010546104d89060ff1681565b34801561055257600080fd5b50610566610561366004614d9d565b610ff9565b6040516104af9190614db6565b34801561057f57600080fd5b5061050861058e366004614dca565b611089565b34801561059f57600080fd5b506105086105ae366004614d9d565b6110a2565b3480156105bf57600080fd5b50600a546105d290610100900460ff1681565b6040516104af9190614e0c565b3480156105eb57600080fd5b506105d26105fa366004614d1d565b600c6020526000908152604090205460ff1681565b34801561061b57600080fd5b50601554610566906001600160a01b031681565b34801561063b57600080fd5b5061050861064a366004614d9d565b6110ba565b34801561065b57600080fd5b506106646110d2565b6040519081526020016104af565b34801561067e57600080fd5b5061066461068d366004614d1d565b60126020526000908152604090205481565b3480156106ab57600080fd5b506105086106ba366004614e26565b6110ee565b3480156106cb57600080fd5b506106646106da366004614d9d565b60009081526020819052604090206001015490565b3480156106fb57600080fd5b5061050861070a366004614d1d565b611119565b34801561071b57600080fd5b506106646420a226a4a760d91b81565b34801561073757600080fd5b5061074b610746366004614e67565b61114e565b604080516001600160a01b0390931683526020830191909152016104af565b34801561077657600080fd5b50610508610785366004614e89565b6111fc565b34801561079657600080fd5b506105086107a5366004614eb9565b61120e565b3480156107b657600080fd5b506105086107c5366004614e89565b611256565b3480156107d657600080fd5b50600a546104d89060ff1681565b3480156107f057600080fd5b50600d54610566906001600160a01b031681565b34801561081057600080fd5b5061050861081f366004614d1d565b6112d0565b610508611316565b34801561083857600080fd5b50610508611333565b34801561084d57600080fd5b5061050861085c366004614e26565b61134d565b34801561086d57600080fd5b506104d861087c366004614d1d565b611372565b34801561088d57600080fd5b506108a161089c366004614e67565b611427565b6040516104af9190614ee2565b3480156108ba57600080fd5b5061066460135481565b3480156108d057600080fd5b506104d86108df366004614d9d565b6115f5565b3480156108f057600080fd5b506105086108ff366004614f29565b611600565b34801561091057600080fd5b5061050861091f366004614f56565b61161b565b34801561093057600080fd5b5061050861093f36600461502c565b61163d565b6105086109523660046150cd565b61165b565b34801561096357600080fd5b506017546018546040516104af9260ff80821693600160f81b8104909116926101009092046001600160f81b0390811692911690615131565b3480156109a857600080fd5b506104d86116c0565b3480156109bd57600080fd5b506105086116d0565b3480156109d257600080fd5b506105666109e1366004614d9d565b61174c565b3480156109f257600080fd5b5061051f611760565b348015610a0757600080fd5b50610508610a16366004614d9d565b6117ee565b348015610a2757600080fd5b50610664610a36366004614d1d565b611806565b348015610a4757600080fd5b50610508611899565b348015610a5c57600080fd5b50610508610a6b366004614d1d565b611935565b348015610a7c57600080fd5b506105d2610a8b366004614d9d565b600b6020526000908152604090205460ff1681565b348015610aac57600080fd5b50610508610abb366004614e67565b611950565b348015610acc57600080fd5b50601e54610566906001600160a01b031681565b348015610aec57600080fd5b506105086119e0565b348015610b0157600080fd5b506108a1610b10366004614d1d565b6119fa565b348015610b2157600080fd5b50610508610b30366004615166565b611ac0565b348015610b4157600080fd5b50610566611b82565b348015610b5657600080fd5b50610664611b8c565b348015610b6b57600080fd5b506104d8610b7a366004614e89565b611bc8565b348015610b8b57600080fd5b5061051f611bf1565b348015610ba057600080fd5b506108a1610baf36600461519b565b611c00565b348015610bc057600080fd5b50610508610bcf3660046151de565b611d77565b348015610be057600080fd5b50610664600081565b348015610bf557600080fd5b50610508610c043660046151fb565b611d9d565b348015610c1557600080fd5b50610508610c24366004614d9d565b33600090815260126020526040902055565b348015610c4257600080fd5b50610508610c513660046151de565b611db1565b348015610c6257600080fd5b50610508610c71366004615229565b611dd7565b610508610c84366004615288565b611eae565b348015610c9557600080fd5b50600154610566906001600160a01b031681565b348015610cb557600080fd5b50610664610cc4366004614d9d565b60116020526000908152604090205481565b348015610ce257600080fd5b50610508610cf136600461530c565b611f41565b348015610d0257600080fd5b50602154610d16906001600160601b031681565b6040516001600160601b0390911681526020016104af565b348015610d3a57600080fd5b50610508610d49366004614d1d565b611f67565b348015610d5a57600080fd5b5061051f611fed565b348015610d6f57600080fd5b5061051f610d7e366004614d9d565b611ffa565b348015610d8f57600080fd5b5061066460245481565b348015610da557600080fd5b50610508610db4366004614e89565b612005565b348015610dc557600080fd5b5061066460165481565b348015610ddb57600080fd5b50610508610dea36600461502c565b61200d565b348015610dfb57600080fd5b506104d8610e0a36600461538b565b61202b565b348015610e1b57600080fd5b506108a161205f565b348015610e3057600080fd5b506001546104d890600160a01b900460ff1681565b348015610e5157600080fd5b50610508610e603660046153b9565b612080565b348015610e7157600080fd5b50610508610e80366004614d1d565b6120b2565b348015610e9157600080fd5b50610508610ea03660046153d5565b612128565b348015610eb157600080fd5b506104d8610ec0366004614d9d565b612282565b348015610ed157600080fd5b50610508610ee0366004614d1d565b6122ab565b6060610eef6122d5565b905090565b6000610eff826122e1565b80610f0e5750610f0e82612320565b80610f1d5750610f1d82612345565b80610f2c5750610f2c82612383565b92915050565b6420a226a4a760d91b610f44816123b8565b600d80546001600160a01b0319166001600160a01b0384161790555050565b5050565b606060038054610f7690615428565b80601f0160208091040260200160405190810160405280929190818152602001828054610fa290615428565b8015610fef5780601f10610fc457610100808354040283529160200191610fef565b820191906000526020600020905b815481529060010190602001808311610fd257829003601f168201915b5050505050905090565b6000611004826123c2565b61106d5760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600760205260409020546001600160a01b031690565b81611093816123e5565b61109d83836123ff565b505050565b6420a226a4a760d91b6110b4816123b8565b50601355565b6420a226a4a760d91b6110cc816123b8565b50602455565b60006110dc612413565b6110e4612475565b610eef9190615472565b826001600160a01b038116331461110857611108336123e5565b611113848484612485565b50505050565b6420a226a4a760d91b61112b816123b8565b50601e80546001600160a01b0319166001600160a01b0392909216919091179055565b6000828152601d602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916111c3575060408051808201909152601c546001600160a01b0381168252600160a01b90046001600160601b031660208201525b6020810151600090612710906111e2906001600160601b031687615485565b6111ec919061549c565b91519350909150505b9250929050565b6112046124b6565b610f638282612517565b6420a226a4a760d91b611220816123b8565b602180546001600160601b0319166001600160601b038416908117909155601554610f63916001600160a01b039091169061259b565b6001600160a01b03811633146112c65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401611064565b610f638282612694565b6420a226a4a760d91b6112e2816123b8565b601580546001600160a01b0319166001600160a01b038416908117909155602154610f6391906001600160601b031661259b565b6420a226a4a760d91b611328816123b8565b6113306126f9565b50565b6420a226a4a760d91b611345816123b8565b611330612767565b826001600160a01b038116331461136757611367336123e5565b6111138484846127b6565b600a5460009060ff1661138757506000919050565b60026001600160a01b0383166000908152600c602052604090205460ff1660028111156113b6576113b6614df6565b148061141257506001600160a01b0382166000908152600c602052604081205460ff1660028111156113ea576113ea614df6565b14801561141257506002600a54610100900460ff16600281111561141057611410614df6565b145b1561141f57506001919050565b506000919050565b606060006114358484615472565b6114409060016154be565b6001600160401b0381111561145757611457614f81565b604051908082528060200260200182016040528015611480578160200160208202803683370190505b509050600080855b85811161152857611498816123c2565b80156114a857506114a881612282565b156114e35760018484815181106114c1576114c16154d1565b91151560209283029190910190910152816114db816154e7565b925050611508565b60008484815181106114f7576114f76154d1565b911515602092830291909101909101525b82611512816154e7565b9350508080611520906154e7565b915050611488565b506000816001600160401b0381111561154357611543614f81565b60405190808252806020026020018201604052801561156c578160200160208202803683370190505b5060009350905082875b8781116115e85785858151811061158f5761158f6154d1565b6020026020010151156115c857808383815181106115af576115af6154d1565b6020908102919091010152816115c4816154e7565b9250505b846115d2816154e7565b95505080806115e0906154e7565b915050611576565b5090979650505050505050565b6000610f2c826123c2565b6420a226a4a760d91b611612816123b8565b610f63826127d1565b6420a226a4a760d91b61162d816123b8565b611636836127fa565b50601b5550565b6420a226a4a760d91b61164f816123b8565b601f61109d8382615546565b6017546001600160f81b038086169161167b918391610100900416615485565b34101561169a5760405162461bcd60e51b815260040161106490615605565b6116a685858585612865565b6116b933866001600160f81b03166128d5565b5050505050565b601454600160a01b900460ff1690565b6116d8611b82565b6001600160a01b0316336001600160a01b03161461170957604051635fc483c560e01b815260040160405180910390fd5b600154600160a01b900460ff161561173457604051631551a48f60e11b815260040160405180910390fd5b600180546001600160a81b031916600160a01b179055565b600080611758836128ef565b509392505050565b601f805461176d90615428565b80601f016020809104026020016040519081016040528092919081815260200182805461179990615428565b80156117e65780601f106117bb576101008083540402835291602001916117e6565b820191906000526020600020905b8154815290600101906020018083116117c957829003601f168201915b505050505081565b6420a226a4a760d91b611800816123b8565b50601655565b60006001600160a01b0382166118745760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401611064565b506001600160a01b03166000908152602560205260409020546001600160401b031690565b6118a16124b6565b60405162461bcd60e51b815260206004820152605b60248201527f43616e206e6f742072656e6f756e63654f776e6572736869702e20496e20746860448201527f6520616273656e6365206f6620746865204f776e65722c20746865207379737460648201527f656d2077696c6c206e6f74206265206f7065726174696f6e616c2e0000000000608482015260a401611064565b6420a226a4a760d91b611947816123b8565b610f6382612986565b8161195a8161174c565b6001600160a01b0316336001600160a01b0316146119cd5760405162461bcd60e51b815260206004820152602a60248201527f5265737472696374417070726f76653a206f7065726174696f6e206973206f6e604482015269363c903437b63232b91760b11b6064820152608401611064565b5060009182526011602052604090912055565b6420a226a4a760d91b6119f2816123b8565b6113306129cb565b6060600080611a0884611806565b90506000816001600160401b03811115611a2457611a24614f81565b604051908082528060200260200182016040528015611a4d578160200160208202803683370190505b50905060005b828414611ab757611a63816123c2565b15611aaf57856001600160a01b0316611a7b8261174c565b6001600160a01b031603611aaf5780828580600101965081518110611aa257611aa26154d1565b6020026020010181815250505b600101611a53565b50949350505050565b336001600160a01b03831614611b095760405162461bcd60e51b815260206004820152600e60248201526d37b7363c903cb7bab939b2b6331760911b6044820152606401611064565b60026001600160a01b0383166000908152600c602052604090205460ff166002811115611b3857611b38614df6565b148015611b5757506002816002811115611b5457611b54614df6565b14155b15611b78576001600160a01b03821660009081526023602052604090204290555b610f638282612a0e565b6000610eef6122c6565b336000908152601a60205260408120601754815460ff918216911603611bc0575461010090046001600160f81b0316919050565b600091505090565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b606060048054610f7690615428565b6060818310611c515760405162461bcd60e51b815260206004820181905260248201527f7374617274206d7573742062652067726561746572207468616e2073746f702e6044820152606401611064565b600080611c5d60065490565b905080841115611c6b578093505b6000611c7687611806565b905084861015611c955785850381811015611c8f578091505b50611c99565b5060005b6000816001600160401b03811115611cb357611cb3614f81565b604051908082528060200260200182016040528015611cdc578160200160208202803683370190505b50905081600003611cf2579350611d7092505050565b865b868114158015611d045750828514155b15611d6657611d12816123c2565b15611d5e57886001600160a01b0316611d2a8261174c565b6001600160a01b031603611d5e5780828680600101975081518110611d5157611d516154d1565b6020026020010181815250505b600101611cf4565b5092835250909150505b9392505050565b6420a226a4a760d91b611d89816123b8565b506010805460ff1916911515919091179055565b81611da7816123e5565b61109d8383612a97565b6420a226a4a760d91b611dc3816123b8565b50600a805460ff1916911515919091179055565b6420a226a4a760d91b611de9816123b8565b838214611df557600080fd5b60005b84811015611ea657601654611e0b612afe565b858584818110611e1d57611e1d6154d1565b90506020020135611e2e91906154be565b1115611e4c5760405162461bcd60e51b81526004016110649061562e565b611e94868683818110611e6157611e616154d1565b9050602002016020810190611e769190614d1d565b858584818110611e8857611e886154d1565b905060200201356128d5565b80611e9e816154e7565b915050611df8565b505050505050565b6017548490611ecc90829061010090046001600160f81b0316615485565b341015611eeb5760405162461bcd60e51b815260040161106490615605565b611ef88686868686612b08565b60005b85811015611f3657611f24878783818110611f1857611f186154d1565b90506020020135612b7d565b80611f2e816154e7565b915050611efb565b50611ea633866128d5565b836001600160a01b0381163314611f5b57611f5b336123e5565b6116b985858585612bd7565b611f6f611b82565b6001600160a01b0316336001600160a01b031614611fa057604051635fc483c560e01b815260040160405180910390fd5b600154600160a01b900460ff1615611fcb57604051631551a48f60e11b815260040160405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6020805461176d90615428565b6060610f2c82612c09565b6112c66124b6565b6420a226a4a760d91b61201f816123b8565b602061109d8382615546565b600061203683611372565b8061204857506120468383612c9b565b155b1561205557506000610f2c565b611d708383612cbb565b606060008061206d60065490565b90506120798282611427565b9250505090565b60405162461bcd60e51b81526020600482015260076024820152663737903ab9b29760c91b6044820152606401611064565b6120ba6124b6565b6001600160a01b03811661211f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611064565b61133081612ce2565b816121755760405162461bcd60e51b815260206004820181905260248201527f746f6b656e496473206d7573742062652067726561746572207468616e20302e6044820152606401611064565b60005b82811015612200576121a1848483818110612195576121956154d1565b9050602002013561174c565b6001600160a01b0316336001600160a01b0316146121ee5760405162461bcd60e51b815260206004820152600a6024820152693737ba1037bbb732b91760b11b6044820152606401611064565b806121f8816154e7565b915050612178565b5060005b828110156122765761222e848483818110612221576122216154d1565b9050602002013583612d34565b1561226457426022600086868581811061224a5761224a6154d1565b905060200201358152602001908152602001600020819055505b8061226e816154e7565b915050612204565b5061109d838383612e8d565b600061228d82612f71565b8061229c575061229c8261306e565b80610f2c5750610f2c82613095565b6420a226a4a760d91b6122bd816123b8565b610f63826130d3565b6014546001600160a01b031690565b6060610eef600e613118565b60006001600160e01b031982166380ac58cd60e01b1480610f1d57506001600160e01b03198216635b5e139f60e01b1480610f2c5750610f2c82612383565b60006001600160e01b0319821663152a902d60e11b1480610f2c5750610f2c82613125565b6000612350826122e1565b8061235f575061235f82613146565b8061236e575061236e82613125565b80610f2c5750506001600160e01b0319161590565b60006001600160e01b03198216637965db0b60e01b1480610f2c57506301ffc9a760e01b6001600160e01b0319831614610f2c565b611330813361316b565b60006123cf6009836131c4565b156123dc57506000919050565b610f2c826131eb565b6001546001600160a01b0316156113305761133081613207565b61240982826132c0565b610f6382826132d4565b6006546000908190819061242b9060081c60016154be565b9050815b8181101561246f5760008181526009602052604090205461244f816133e6565b61245990866154be565b9450508080612467906154e7565b91505061242f565b50505090565b600080600654610eef9190615472565b61248f3382613405565b6124ab5760405162461bcd60e51b815260040161106490615665565b61109d8383836134ca565b336124bf611b82565b6001600160a01b0316146125155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611064565b565b6125218282611bc8565b610f63576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556125573390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6127106001600160601b03821611156126095760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401611064565b6001600160a01b03821661265b5760405162461bcd60e51b815260206004820152601960248201527822a921991c9c189d1034b73b30b634b2103932b1b2b4bb32b960391b6044820152606401611064565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601c55565b61269e8282611bc8565b15610f63576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6015546001600160a01b03166127515760405162461bcd60e51b815260206004820152601e60248201527f77697468647261772061646472657373206973203020616464726573732e00006044820152606401611064565b601554612515906001600160a01b0316476136a2565b61276f6137bb565b6014805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516127ac9190614db6565b60405180910390a1565b61109d83838360405180602001604052806000815250611f41565b600a805482919061ff0019166101008360028111156127f2576127f2614df6565b021790555050565b6017805460ff1690829061280e82826156c8565b505060006019557f75e3689da7799229d232f2c15fc530f1a386e47a961aea8ccc86ed74cfb4bd4f816128446020850185615740565b6040805160ff93841681529290911660208301520160405180910390a15050565b838383836000338460405160200161287e92919061575d565b6040516020818303038152906040528051906020012090506128a48383601b5484613806565b6128c05760405162461bcd60e51b815260040161106490615781565b6128ca898961381e565b505050505050505050565b610f63828260405180602001604052806000815250613951565b6000806128fb836123c2565b61295c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401611064565b61296583613992565b6000818152600560205260409020546001600160a01b031694909350915050565b612991600e8261399f565b506040516001600160a01b0382169033907f3b01c97343869ca2757fcc37cdb8f71683b0a7aed858e3755f4529a1db85729290600090a350565b6129d36139b4565b6014805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861279f3390565b6001600160a01b0382166000908152600c60205260409020805482919060ff19166001836002811115612a4357612a43614df6565b0217905550336001600160a01b0316826001600160a01b03167f9fdb14457e6a7bd3753c649831b026de987c06e52d16459a928540738c2ea34b83604051612a8b9190614e0c565b60405180910390a35050565b612aa033611372565b1580612aaa575080155b612ac65760405162461bcd60e51b8152600401611064906157a9565b612acf826139fc565b80612ad8575080155b612af45760405162461bcd60e51b8152600401611064906157e0565b610f638282613a08565b6000610eef6110d2565b8484905083838360003384604051602001612b2492919061575d565b604051602081830303815290604052805190602001209050612b4a8383601b5484613806565b612b665760405162461bcd60e51b815260040161106490615781565b612b718a8a8a613a40565b50505050505050505050565b6000612b888261174c565b9050612b98816000846001613b31565b612ba3600983613b3d565b60405182906000906001600160a01b03841690600080516020615b96833981519152908390a4610f63816000846001613b69565b612be13383613405565b612bfd5760405162461bcd60e51b815260040161106490615665565b61111384848484613b81565b601e546060906001600160a01b0316612c2a57612c2582613b9a565b610f2c565b601e5460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa158015612c73573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f2c919081019061582d565b600080612ca784613c13565b9050612cb38382613c55565b949350505050565b6000612cc78383612c9b565b1515600003612cd857506000610f2c565b611d708383613cee565b601480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001826002811115612d4a57612d4a614df6565b03612e0457336000908152600c602052604081205460ff16906002826002811115612d7757612d77614df6565b148015612da7575060016000868152600b602052604090205460ff166002811115612da457612da4614df6565b14155b905060006002836002811115612dbf57612dbf614df6565b14158015612def575060026000878152600b602052604090205460ff166002811115612ded57612ded614df6565b145b90508180612dfa5750805b9350505050610f2c565b6000826002811115612e1857612e18614df6565b03612e8557336000908152600c602052604081205460ff16906002826002811115612e4557612e45614df6565b14159050600060026000878152600b602052604090205460ff166002811115612e7057612e70614df6565b149050818015612dfa57509250610f2c915050565b506000610f2c565b60005b828110156111135781600b6000868685818110612eaf57612eaf6154d1565b60209081029290920135835250810191909152604001600020805460ff19166001836002811115612ee257612ee2614df6565b0217905550838382818110612ef957612ef96154d1565b90506020020135336001600160a01b0316612f1f868685818110612195576121956154d1565b6001600160a01b03167f80a668baf7ac68b329075f26c37b4428d4aa272c3bd4c9611b25f5fb1c473f7c85604051612f579190614e0c565b60405180910390a480612f69816154e7565b915050612e90565b600081612f7d816123c2565b612fdf5760405162461bcd60e51b815260206004820152602d60248201527f4c6f636b61626c653a206c6f636b696e6720717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b6064820152608401611064565b600a5460ff16612ff25760009150613068565b60026000848152600b602052604090205460ff16600281111561301757613017614df6565b148061305557506000838152600b602052604081205460ff16600281111561304157613041614df6565b148015613055575061305561087c8461174c565b156130635760019150613068565b600091505b50919050565b6024546000828152602260205260408120549091429161308e91906154be565b1192915050565b600042602454602360006130a88661174c565b6001600160a01b03166001600160a01b031681526020019081526020016000205461308e91906154be565b6130de600e82613d34565b506040516001600160a01b0382169033907fbd0af1fe0a2c1c7bb340c17a284a291138979c8eeb797e176dbd1c415199af3c90600090a350565b60606000611d7083613d49565b60006001600160e01b03198216630101c11560e71b1480610f2c5750610f2c825b60006001600160e01b03198216632742b5b960e01b1480610f2c5750610f2c826122e1565b6131758282611bc8565b610f635761318281613da5565b61318d836020613db7565b60405160200161319e92919061589a565b60408051601f198184030181529082905262461bcd60e51b825261106491600401614d8a565b600881901c600090815260208390526040902054600160ff1b60ff83161c16151592915050565b60006131f660065490565b82108015610f2c5750600192915050565b6001546001600160a01b0316801580159061322c57506000816001600160a01b03163b115b15610f6357604051633185c44d60e21b81523060048201526001600160a01b03838116602483015282169063c617113490604401602060405180830381865afa15801561327d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132a19190615909565b610f635781604051633b79c77360e21b81526004016110649190614db6565b6132ca8282613f52565b610f638282613fb7565b60006132df8261174c565b9050806001600160a01b0316836001600160a01b03160361334e5760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401611064565b336001600160a01b038216148061336a575061336a813361202b565b6133dc5760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401611064565b61109d8383614032565b60005b8115613400576000198201909116906001016133e9565b919050565b6000613410826123c2565b6134745760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401611064565b600061347f8361174c565b9050806001600160a01b0316846001600160a01b031614806134ba5750836001600160a01b03166134af84610ff9565b6001600160a01b0316145b80612cb35750612cb3818561202b565b6000806134d6836128ef565b91509150846001600160a01b0316826001600160a01b0316146135505760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401611064565b6001600160a01b0384166135b65760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401611064565b6135c38585856001613b31565b6135ce600084614032565b60006135db8460016154be565b90506135e86002826131c4565b1580156135f6575060065481105b1561362d57600081815260056020526040902080546001600160a01b0319166001600160a01b03881617905561362d600282613b3d565b600084815260056020526040902080546001600160a01b0319166001600160a01b03871617905581841461366657613666600285613b3d565b83856001600160a01b0316876001600160a01b0316600080516020615b9683398151915260405160405180910390a4611ea68686866001613b69565b804710156136f25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401611064565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461373f576040519150601f19603f3d011682016040523d82523d6000602084013e613744565b606091505b505090508061109d5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401611064565b6137c36116c0565b6125155760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611064565b6000826138148686856140a0565b1495945050505050565b6138266139b4565b816001600160f81b031660165461383b612afe565b61384590836154be565b11156138635760405162461bcd60e51b81526004016110649061562e565b6018546019546001600160f81b0380861692169061388190836154be565b111561389f5760405162461bcd60e51b815260040161106490615926565b8383806001600160f81b0316826001600160f81b03166138bd611b8c565b6138c791906154be565b11156138e55760405162461bcd60e51b815260040161106490615968565b6000601854600160f81b900460ff16600181111561390557613905614df6565b146139485760405162461bcd60e51b81526020600482015260136024820152723737ba1031b630b4b69039b0b632903737bb9760691b6044820152606401611064565b611ea6866140e3565b600061395c60065490565b9050613968848461418a565b613976600085838686614305565b6111135760405162461bcd60e51b81526004016110649061599f565b6000610f2c60028361443c565b6000611d70836001600160a01b038416614534565b6139bc6116c0565b156125155760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611064565b6000610f2c3383612c9b565b613a11826139fc565b80613a1a575080155b613a365760405162461bcd60e51b8152600401611064906157e0565b610f63828261462e565b613a486139b4565b60185460195483916001600160f81b031690613a6490836154be565b1115613a825760405162461bcd60e51b815260040161106490615926565b82826001600160f81b03808216908316613a9a611b8c565b613aa491906154be565b1115613ac25760405162461bcd60e51b815260040161106490615968565b6001601854600160f81b900460ff166001811115613ae257613ae2614df6565b14613b285760405162461bcd60e51b81526020600482015260166024820152753737ba1032bc31b430b733b29039b0b632903737bb9760511b6044820152606401611064565b611ea6856140e3565b61111384848484614667565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b613b75848484846146f2565b6111138484848461489b565b613b8c8484846134ca565b613976848484600185614305565b6060601f613ba7836148b3565b613bb084612282565b613bc95760405180602001604052806000815250613be8565b604051806040016040528060058152602001645f6c6f636b60d81b8152505b6020604051602001613bfd9493929190615a67565b6040516020818303038152906040529050919050565b6001600160a01b03811660009081526012602052604081205415613c4d57506001600160a01b031660009081526012602052604090205490565b505060135490565b60105460009060ff16613c6a57506001610f2c565b613c7383614945565b80611d705750600d54604051630f8350ed60e41b81526001600160a01b038581166004830152602482018590529091169063f8350ed090604401602060405180830381865afa158015613cca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d709190615909565b6000613cf983611372565b15613d0657506000610f2c565b6001600160a01b0380841660009081526008602090815260408083209386168352929052205460ff16611d70565b6000611d70836001600160a01b03841661496f565b606081600001805480602002602001604051908101604052809291908181526020018280548015613d9957602002820191906000526020600020905b815481526020019060010190808311613d85575b50505050509050919050565b6060610f2c6001600160a01b03831660145b60606000613dc6836002615485565b613dd19060026154be565b6001600160401b03811115613de857613de8614f81565b6040519080825280601f01601f191660200182016040528015613e12576020820181803683370190505b509050600360fc1b81600081518110613e2d57613e2d6154d1565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613e5c57613e5c6154d1565b60200101906001600160f81b031916908160001a9053506000613e80846002615485565b613e8b9060016154be565b90505b6001811115613f03576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613ebf57613ebf6154d1565b1a60f81b828281518110613ed557613ed56154d1565b60200101906001600160f81b031916908160001a90535060049490941c93613efc81615aae565b9050613e8e565b508315611d705760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611064565b613f5b81612282565b15610f635760405162461bcd60e51b815260206004820152602660248201527f4c6f636b61626c653a2043616e206e6f7420617070726f7665206c6f636b6564604482015265103a37b5b2b760d11b6064820152608401611064565b6001600160a01b03821615610f6357613fd081836149b6565b610f635760405162461bcd60e51b815260206004820152602d60248201527f5265737472696374417070726f76653a2054686520636f6e747261637420697360448201526c103737ba1030b63637bbb2b21760991b6064820152608401611064565b600081815260076020526040902080546001600160a01b0319166001600160a01b03841690811790915581906140678261174c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600081815b84811015611ab7576140cf828787848181106140c3576140c36154d1565b905060200201356149c3565b9150806140db816154e7565b9150506140a5565b336000908152601a60205260409020601754815460ff91821691160361414e5780548290829060019061412590849061010090046001600160f81b0316615ac5565b92506101000a8154816001600160f81b0302191690836001600160f81b03160217905550614166565b60175460ff166101006001600160f81b038416021781555b816001600160f81b03166019600082825461418191906154be565b90915550505050565b600061419560065490565b9050600082116141f55760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401611064565b6001600160a01b0383166142575760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611064565b6142646000848385613b31565b816006600082825461427691906154be565b9091555050600081815260056020526040902080546001600160a01b0319166001600160a01b0385161790556142ad600282613b3d565b6142ba6000848385613b69565b805b6142c683836154be565b8110156111135760405181906001600160a01b03861690600090600080516020615b96833981519152908290a4806142fd816154e7565b9150506142bc565b60006001600160a01b0385163b1561442f57506001835b61432684866154be565b81101561442957604051630a85bd0160e11b81526001600160a01b0387169063150b7a029061435f9033908b9086908990600401615ae5565b6020604051808303816000875af192505050801561439a575060408051601f3d908101601f1916820190925261439791810190615b22565b60015b6143f7573d8080156143c8576040519150601f19603f3d011682016040523d82523d6000602084013e6143cd565b606091505b5080516000036143ef5760405162461bcd60e51b81526004016110649061599f565b805181602001fd5b82801561441457506001600160e01b03198116630a85bd0160e11b145b92505080614421816154e7565b91505061431c565b50614433565b5060015b95945050505050565b600881901c60008181526020849052604081205490919060ff808516919082181c801561447e5761446c816149f2565b60ff168203600884901b17935061452b565b600083116144eb5760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401611064565b50600019909101600081815260208690526040902054909190801561452657614513816149f2565b60ff0360ff16600884901b17935061452b565b61447e565b50505092915050565b6000818152600183016020526040812054801561461d576000614558600183615472565b855490915060009061456c90600190615472565b90508181146145d157600086600001828154811061458c5761458c6154d1565b90600052602060002001549050808760000184815481106145af576145af6154d1565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806145e2576145e2615b3f565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610f2c565b6000915050610f2c565b5092915050565b61463733611372565b1580614641575080155b61465d5760405162461bcd60e51b8152600401611064906157a9565b610f638282614a5c565b6001600160a01b0384161580159061468757506001600160a01b03831615155b156111135761469582612282565b156111135760405162461bcd60e51b815260206004820152602760248201527f4c6f636b61626c653a2043616e206e6f74207472616e73666572206c6f636b6560448201526632103a37b5b2b760c91b6064820152608401611064565b600160401b811061470257600080fd5b806001600160a01b0385161561476c576001600160a01b038516600090815260256020526040812080548392906147439084906001600160401b0316615b55565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506147cc565b6001600160a01b038416600090815260256020526040902080548291906008906147a7908490600160401b90046001600160401b0316615b75565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b03841615614835576001600160a01b0384166000908152602560205260408120805483929061480c9084906001600160401b0316615b75565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506116b9565b6001600160a01b03851660009081526025602052604090208054829190601090614870908490600160801b90046001600160401b0316615b75565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505050505050565b6148a784848484614b19565b61111384848484614b43565b606060006148c083614b66565b60010190506000816001600160401b038111156148df576148df614f81565b6040519080825280601f01601f191660200182016040528015614909576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461491357509392505050565b6000610f2c600e836001600160a01b03811660009081526001830160205260408120541515611d70565b6000818152600183016020526040812054612e8557508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610f2c565b600080612ca73385614c3e565b60008183106149df576000828152602084905260409020611d70565b6000838152602083905260409020611d70565b60006040518061012001604052806101008152602001615bb6610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff614a3b85614c70565b02901c81518110614a4e57614a4e6154d1565b016020015160f81c92915050565b336001600160a01b03831603614ab45760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401611064565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101612a8b565b6001600160a01b03841615611113576000828152600b60205260409020805460ff19169055611113565b6001600160a01b0384161561111357600082815260116020526040812055611113565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310614ba55772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310614bd1576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310614bef57662386f26fc10000830492506010015b6305f5e1008310614c07576305f5e100830492506008015b6127108310614c1b57612710830492506004015b60648310614c2d576064830492506002015b600a8310610f2c5760010192915050565b60008181526011602052604081205415614c675750600081815260116020526040902054610f2c565b611d7083613c13565b6000808211614c7e57600080fd5b5060008190031690565b6020808252825182820181905260009190848201906040850190845b81811015614cc95783516001600160a01b031683529284019291840191600101614ca4565b50909695505050505050565b6001600160e01b03198116811461133057600080fd5b600060208284031215614cfd57600080fd5b8135611d7081614cd5565b6001600160a01b038116811461133057600080fd5b600060208284031215614d2f57600080fd5b8135611d7081614d08565b60005b83811015614d55578181015183820152602001614d3d565b50506000910152565b60008151808452614d76816020860160208601614d3a565b601f01601f19169290920160200192915050565b602081526000611d706020830184614d5e565b600060208284031215614daf57600080fd5b5035919050565b6001600160a01b0391909116815260200190565b60008060408385031215614ddd57600080fd5b8235614de881614d08565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310614e2057614e20614df6565b91905290565b600080600060608486031215614e3b57600080fd5b8335614e4681614d08565b92506020840135614e5681614d08565b929592945050506040919091013590565b60008060408385031215614e7a57600080fd5b50508035926020909101359150565b60008060408385031215614e9c57600080fd5b823591506020830135614eae81614d08565b809150509250929050565b600060208284031215614ecb57600080fd5b81356001600160601b0381168114611d7057600080fd5b6020808252825182820181905260009190848201906040850190845b81811015614cc957835183529284019291840191600101614efe565b80356003811061340057600080fd5b600060208284031215614f3b57600080fd5b611d7082614f1a565b60006080828403121561306857600080fd5b60008060a08385031215614f6957600080fd5b614f738484614f44565b946080939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614fbf57614fbf614f81565b604052919050565b60006001600160401b03821115614fe057614fe0614f81565b50601f01601f191660200190565b6000615001614ffc84614fc7565b614f97565b905082815283838301111561501557600080fd5b828260208301376000602084830101529392505050565b60006020828403121561503e57600080fd5b81356001600160401b0381111561505457600080fd5b8201601f8101841361506557600080fd5b612cb384823560208401614fee565b6001600160f81b038116811461133057600080fd5b60008083601f84011261509b57600080fd5b5081356001600160401b038111156150b257600080fd5b6020830191508360208260051b85010111156111f557600080fd5b600080600080606085870312156150e357600080fd5b84356150ee81615074565b935060208501356150fe81615074565b925060408501356001600160401b0381111561511957600080fd5b61512587828801615089565b95989497509550505050565b60ff85168152608081016002851061514b5761514b614df6565b84602083015283604083015282606083015295945050505050565b6000806040838503121561517957600080fd5b823561518481614d08565b915061519260208401614f1a565b90509250929050565b6000806000606084860312156151b057600080fd5b83356151bb81614d08565b95602085013595506040909401359392505050565b801515811461133057600080fd5b6000602082840312156151f057600080fd5b8135611d70816151d0565b6000806040838503121561520e57600080fd5b823561521981614d08565b91506020830135614eae816151d0565b6000806000806040858703121561523f57600080fd5b84356001600160401b038082111561525657600080fd5b61526288838901615089565b9096509450602087013591508082111561527b57600080fd5b5061512587828801615089565b6000806000806000606086880312156152a057600080fd5b85356001600160401b03808211156152b757600080fd5b6152c389838a01615089565b9097509550602088013591506152d882615074565b909350604087013590808211156152ee57600080fd5b506152fb88828901615089565b969995985093965092949392505050565b6000806000806080858703121561532257600080fd5b843561532d81614d08565b9350602085013561533d81614d08565b92506040850135915060608501356001600160401b0381111561535f57600080fd5b8501601f8101871361537057600080fd5b61537f87823560208401614fee565b91505092959194509250565b6000806040838503121561539e57600080fd5b82356153a981614d08565b91506020830135614eae81614d08565b6000608082840312156153cb57600080fd5b611d708383614f44565b6000806000604084860312156153ea57600080fd5b83356001600160401b0381111561540057600080fd5b61540c86828701615089565b909450925061541f905060208501614f1a565b90509250925092565b600181811c9082168061543c57607f821691505b60208210810361306857634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b81810381811115610f2c57610f2c61545c565b8082028115828204841417610f2c57610f2c61545c565b6000826154b957634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610f2c57610f2c61545c565b634e487b7160e01b600052603260045260246000fd5b6000600182016154f9576154f961545c565b5060010190565b601f82111561109d57600081815260208120601f850160051c810160208610156155275750805b601f850160051c820191505b81811015611ea657828155600101615533565b81516001600160401b0381111561555f5761555f614f81565b6155738161556d8454615428565b84615500565b602080601f8311600181146155a857600084156155905750858301515b600019600386901b1c1916600185901b178555611ea6565b600085815260208120601f198616915b828110156155d7578886015182559484019460019091019084016155b8565b50858210156155f55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020808252600f908201526e3737ba1032b737bab3b41032ba341760891b604082015260600190565b6020808252601d908201527f636c61696d206973206f76657220746865206d617820737570706c792e000000604082015260600190565b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b60ff8116811461133057600080fd5b81356156d3816156b9565b60ff8116905060ff19818184541617835560208401356156f281615074565b60081b16178155604082013561570781615074565b60608301356002811061571957600080fd5b6001600160f81b039190911660f89190911b6001600160f81b031916176001919091015550565b60006020828403121561575257600080fd5b8135611d70816156b9565b60609290921b6001600160601b031916825260081b60ff1916601482015260330190565b6020808252600e908201526d34b73b30b634b210383937b7b31760911b604082015260600190565b6020808252601c908201527f43616e206e6f7420617070726f7665206c6f636b656420746f6b656e00000000604082015260600190565b6020808252602d908201527f5265737472696374417070726f76653a2043616e206e6f7420617070726f766560408201526c103637b1b5b2b2103a37b5b2b760991b606082015260800190565b60006020828403121561583f57600080fd5b81516001600160401b0381111561585557600080fd5b8201601f8101841361586657600080fd5b8051615874614ffc82614fc7565b81815285602083850101111561588957600080fd5b614433826020830160208601614d3a565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516158cc816017850160208801614d3a565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516158fd816028840160208801614d3a565b01602801949350505050565b60006020828403121561591b57600080fd5b8151611d70816151d0565b60208082526022908201527f636c61696d206973206f76657220746865206d61782073616c6520737570706c6040820152613c9760f11b606082015260800190565b6020808252601d908201527f636c61696d206973206f76657220616c6c6f77656420616d6f756e742e000000604082015260600190565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b60008154615a0181615428565b60018281168015615a195760018114615a2e57615a5d565b60ff1984168752821515830287019450615a5d565b8560005260208060002060005b85811015615a545781548a820152908401908201615a3b565b50505082870194505b5050505092915050565b6000615a7382876159f4565b8551615a83818360208a01614d3a565b8551910190615a96818360208901614d3a565b615aa2818301866159f4565b98975050505050505050565b600081615abd57615abd61545c565b506000190190565b6001600160f81b038181168382160190808211156146275761462761545c565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615b1890830184614d5e565b9695505050505050565b600060208284031215615b3457600080fd5b8151611d7081614cd5565b634e487b7160e01b600052603160045260246000fd5b6001600160401b038281168282160390808211156146275761462761545c565b6001600160401b038181168382160190808211156146275761462761545c56feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a264697066735822122019ac440e785e2fce352cb3937970336da9981c76282f9fabd138d5709c8e414464736f6c63430008110033

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.