ETH Price: $3,035.98 (+4.29%)
 

Overview

Max Total Supply

506 TUHCP

Holders

288

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Balance
0 TUHCP
0x564b0f74bbc291bdb69a0be24496eaac3158a050
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:
TerrapinUniverseHeroesCardPack

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 20 : TerrapinUniverseHeroesCardPack.sol
//SPDX-License-Identifier: MIT

/*
 ***************************************************************************************************************************
 *                                                                                                                         *
 * ___________                                     .__           ____ ___        .__                                       *
 * \__    ___/____ _______ _______ _____   ______  |__|  ____   |    |   \ ____  |__|___  __  ____ _______  ______  ____   *
 *   |    | _/ __ \\_  __ \\_  __ \\__  \  \____ \ |  | /    \  |    |   //    \ |  |\  \/ /_/ __ \\_  __ \/  ___/_/ __ \  *
 *   |    | \  ___/ |  | \/ |  | \/ / __ \_|  |_> >|  ||   |  \ |    |  /|   |  \|  | \   / \  ___/ |  | \/\___ \ \  ___/  *
 *   |____|  \___  >|__|    |__|   (____  /|   __/ |__||___|  / |______/ |___|  /|__|  \_/   \___  >|__|  /____  > \___  > *
 *               \/                     \/ |__|             \/                \/                 \/            \/      \/  *
 *                                                                                                                         *
 ***************************************************************************************************************************
 */

pragma solidity ^0.8.9;

import "./interfaces/TerrapinUniverseCardPack.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/**
 * @title Terrapin Universe Heroes Card Pack
 *
 * @notice ERC-721 NFT Token Contract
 *
 * @author 0x1687572416fdd591bcc710fa07cee94a76eea201681884b1d5cc528cba584815
 */
contract TerrapinUniverseHeroesCardPack is EIP712, TerrapinUniverseCardPack {
    using ECDSA for bytes32;
    using EnumerableSet for EnumerableSet.AddressSet;
    using EnumerableSet for EnumerableSet.UintSet;

    bytes32 public constant MINT_SIGNER_ROLE = keccak256("MINT_SIGNER_ROLE");
    bytes32 public constant WHITELIST_TYPEHASH =
        keccak256("Whitelist(address account)");

    EnumerableSet.UintSet internal _WLOriginTokenIds;
    EnumerableSet.AddressSet internal _redeemedWhitelistAddresses;

    constructor(
        TerrapinGenesis terrapinGenesis_,
        string memory baseURI_,
        address[] memory operators,
        address[] memory mintSigners
    )
        EIP712("TerrapinUniverseHeroesCardPack", "1")
        TerrapinUniverseCardPack(
            "TerrapinUniverseHeroesCardPack",
            "TUHCP",
            terrapinGenesis_,
            baseURI_,
            operators
        )
    {
        for (uint256 index = 0; index < mintSigners.length; ++index) {
            _grantRole(MINT_SIGNER_ROLE, mintSigners[index]);
        }
    }

    /**
     * @notice Mint function, open to valid WL/Gen1 holders. A valid and unused
     * signature nets the message sender 1 token, while each owned and unused
     * Gen1 token nets the message sender MINT_COUNT_PER_GEN1 * #gen1TokenIds
     * tokens. Use the empty value `0x` for `sig`, or an empty array `[]` for
     * `gen1TokenIds` if not applicable. After redeeming, Gen1 tokens become
     * 'used' w.r.t. this function.
     *
     * For generating `gen1TokenIds`, see
     * {TerrapinUniverseCardPack-eligibleGen1TokenIdsOf}.
     */
    function mint(bytes calldata sig, uint256[] calldata gen1TokenIds)
        external
    {
        mintTo(_msgSender(), sig, gen1TokenIds);
    }

    function originOf(uint256 tokenId)
        external
        view
        override
        returns (TokenOrigin)
    {
        if (_hasMintedTokenId(tokenId) != true) revert InvalidTokenId();

        if (_WLOriginTokenIds.contains(tokenId)) {
            return TokenOrigin.WL;
        }

        return TokenOrigin.Gen1;
    }

    function mintTo(
        address to,
        bytes calldata sig,
        uint256[] calldata gen1TokenIds
    ) public nonReentrant {
        if (mintActive != true) revert MintNotActive();
        if (_soldOut()) revert MaxSupplyExceeded();
        if (_areGen1TokenIdsEligible(gen1TokenIds, _msgSender()) != true)
            revert InvalidGen1TokenIds();

        if (sig.length > 0) {
            if (_hasAccountRedeemedWhitelist(to)) {
                revert AccountPreviouslyMinted();
            }

            if (hasRole(OPERATOR_ROLE, _msgSender()) != true) {
                if (isWhitelistSignatureValid(sig, _msgSender()) != true) {
                    revert InvalidSignature();
                }
            }

            _mintViaWL(to);
        }

        _mintViaGen1(to, gen1TokenIds);
    }

    function isWhitelistSignatureValid(bytes calldata sig, address account)
        public
        view
        returns (bool)
    {
        bytes32 digest = _hashTypedDataV4(
            keccak256(abi.encode(WHITELIST_TYPEHASH, account))
        );
        address signer = ECDSA.recover(digest, sig);

        return hasRole(MINT_SIGNER_ROLE, signer);
    }

    function _mintViaWL(address account) private {
        _WLOriginTokenIds.add(_nextTokenId());
        _redeemedWhitelistAddresses.add(account);

        _safeMint(account, 1);
    }

    function _hasAccountRedeemedWhitelist(address account)
        private
        view
        returns (bool)
    {
        return _redeemedWhitelistAddresses.contains(account);
    }
}

File 2 of 20 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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, _msgSender());
        _;
    }

    /**
     * @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 override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @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 {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " 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 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.
     */
    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.
     */
    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`.
     */
    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.
     *
     * [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.
     */
    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.
     */
    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 20 : 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 20 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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 20 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 6 of 20 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 7 of 20 : 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 8 of 20 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @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] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 9 of 20 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 10 of 20 : draft-EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 11 of 20 : 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 12 of 20 : 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 13 of 20 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @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 / b + (a % b == 0 ? 0 : 1);
    }
}

File 14 of 20 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

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.
 */
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) {
        return _values(set._inner);
    }

    // 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;

        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 on 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;

        assembly {
            result := store
        }

        return result;
    }
}

File 15 of 20 : TerrapinGenesis.sol
//SPDX-License-Identifier: MIT

/*
 ************************************************************************************************************************
 *                                                                                                                      *
 * ___________                                     .__            ________                                 .__          *
 * \__    ___/____ _______ _______ _____   ______  |__|  ____    /  _____/   ____    ____    ____    ______|__|  ______ *
 *   |    | _/ __ \\_  __ \\_  __ \\__  \  \____ \ |  | /    \  /   \  ___ _/ __ \  /    \ _/ __ \  /  ___/|  | /  ___/ *
 *   |    | \  ___/ |  | \/ |  | \/ / __ \_|  |_> >|  ||   |  \ \    \_\  \\  ___/ |   |  \\  ___/  \___ \ |  | \___ \  *
 *   |____|  \___  >|__|    |__|   (____  /|   __/ |__||___|  /  \______  / \___  >|___|  / \___  >/____  >|__|/____  > *
 *               \/                     \/ |__|             \/          \/      \/      \/      \/      \/          \/  *
 *                                                                                                                      *
 ************************************************************************************************************************
 */

pragma solidity ^0.8.9;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "erc721a/contracts/extensions/ERC721AQueryable.sol";

error MintNotActive();
error MaxSupplyExceeded();
error InvalidSignature();
error AccountPreviouslyMinted();
error InvalidValue();
error ValueUnchanged();

contract OSOwnableDelegateProxy {}

contract OSProxyRegistry {
    mapping(address => OSOwnableDelegateProxy) public proxies;
}

/**
 * @title Terrapin Genesis
 *
 * @notice ERC-721 NFT Token Contract.
 *
 * @author 0x1687572416fdd591bcc710fa07cee94a76eea201681884b1d5cc528cba584815
 */
contract TerrapinGenesis is Ownable, AccessControl, EIP712, ERC721AQueryable {
    using Address for address payable;
    using ECDSA for bytes32;

    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
    bytes32 public constant MINT_SIGNER_ROLE = keccak256("MINT_SIGNER_ROLE");
    bytes32 public constant WHITELIST_TYPEHASH =
        keccak256("Whitelist(address account)");
    uint256 public constant maxSupply = 333;

    bool public mintActive;
    string public baseURI;

    OSProxyRegistry internal _osProxyRegistry;

    event MintActiveUpdated(bool mintActive);
    event BaseURIUpdated(string oldBaseURI, string baseURI);

    constructor(
        string memory baseURI_,
        address osProxyRegistryAddress,
        address[] memory operators,
        address[] memory mintSigners
    ) EIP712("TerrapinGenesis", "1") ERC721A("TerrapinGenesis", "TG") {
        baseURI = baseURI_;
        _osProxyRegistry = OSProxyRegistry(osProxyRegistryAddress);

        _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
        for (uint256 index = 0; index < operators.length; ++index) {
            _grantRole(OPERATOR_ROLE, operators[index]);
        }
        for (uint256 index = 0; index < mintSigners.length; ++index) {
            _grantRole(MINT_SIGNER_ROLE, mintSigners[index]);
        }
    }

    /**
     * @dev Mint function, only whitelisted accounts allowed. With a valid
     * signature from an account with a MINT_SIGNER_ROLE role, accounts may mint
     * up to 1 token.
     */
    function mint(bytes calldata sig) external {
        if (mintActive != true) revert MintNotActive();
        if (numberMinted(_msgSender()) > 0) revert AccountPreviouslyMinted();
        if ((_totalMinted() + 1) > maxSupply) revert MaxSupplyExceeded();

        bytes32 digest = _hashTypedDataV4(
            keccak256(abi.encode(WHITELIST_TYPEHASH, _msgSender()))
        );
        address signer = ECDSA.recover(digest, sig);
        if (hasRole(MINT_SIGNER_ROLE, signer) != true)
            revert InvalidSignature();

        _safeMint(_msgSender(), 1);
    }

    /**
     * @dev Special Mint function. For miscellaneous purposes, e.g. raffles.
     */
    function mintSpecial(address[] calldata addresses)
        external
        onlyRole(OPERATOR_ROLE)
    {
        if (_totalMinted() + addresses.length > maxSupply)
            revert MaxSupplyExceeded();

        for (uint256 index = 0; index < addresses.length; ++index) {
            _safeMint(addresses[index], 1);
        }
    }

    /**
     * @dev Reserve Mint function.
     */
    function mintReserve(address to, uint256 quantity)
        external
        onlyRole(OPERATOR_ROLE)
    {
        if (_totalMinted() + quantity > maxSupply) revert MaxSupplyExceeded();

        _safeMint(to, quantity);
    }

    function setMintActive(bool mintActive_) external onlyRole(OPERATOR_ROLE) {
        if (mintActive == mintActive_) revert ValueUnchanged();

        mintActive = mintActive_;

        emit MintActiveUpdated(mintActive);
    }

    function setBaseURI(string memory baseURI_)
        external
        onlyRole(OPERATOR_ROLE)
    {
        if (
            keccak256(abi.encodePacked(baseURI_)) ==
            keccak256(abi.encodePacked(_baseURI()))
        ) revert ValueUnchanged();

        string memory oldBaseURI = _baseURI();
        baseURI = baseURI_;

        emit BaseURIUpdated(oldBaseURI, baseURI_);
    }

    function withdraw() external onlyRole(DEFAULT_ADMIN_ROLE) {
        payable(_msgSender()).sendValue(address(this).balance);
    }

    /**
     * @dev Number of tokens minted.
     */
    function totalMinted() external view returns (uint256) {
        return _totalMinted();
    }

    /**
     * @dev Returns number of tokens `account` has minted.
     */
    function numberMinted(address account) public view returns (uint256) {
        return _numberMinted(account);
    }

    function isApprovedForAll(address owner_, address operator)
        public
        view
        override
        returns (bool)
    {
        if (super.isApprovedForAll(owner_, operator)) {
            return true;
        }

        if (
            address(_osProxyRegistry) != address(0) &&
            address(_osProxyRegistry.proxies(owner_)) == operator
        ) {
            return true;
        }

        return false;
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(AccessControl, ERC721A)
        returns (bool)
    {
        return
            ERC721A.supportsInterface(interfaceId) ||
            AccessControl.supportsInterface(interfaceId);
    }

    function _baseURI() internal view override returns (string memory) {
        return baseURI;
    }

    function _startTokenId() internal pure override returns (uint256) {
        return 1;
    }
}

File 16 of 20 : TerrapinUniverseCardPack.sol
//SPDX-License-Identifier: MIT

/*
 ***************************************************************************************************************************
 *                                                                                                                         *
 * ___________                                     .__           ____ ___        .__                                       *
 * \__    ___/____ _______ _______ _____   ______  |__|  ____   |    |   \ ____  |__|___  __  ____ _______  ______  ____   *
 *   |    | _/ __ \\_  __ \\_  __ \\__  \  \____ \ |  | /    \  |    |   //    \ |  |\  \/ /_/ __ \\_  __ \/  ___/_/ __ \  *
 *   |    | \  ___/ |  | \/ |  | \/ / __ \_|  |_> >|  ||   |  \ |    |  /|   |  \|  | \   / \  ___/ |  | \/\___ \ \  ___/  *
 *   |____|  \___  >|__|    |__|   (____  /|   __/ |__||___|  / |______/ |___|  /|__|  \_/   \___  >|__|  /____  > \___  > *
 *               \/                     \/ |__|             \/                \/                 \/            \/      \/  *
 *                                                                                                                         *
 ***************************************************************************************************************************
 */

pragma solidity ^0.8.9;

import {TerrapinGenesis, MintNotActive, MaxSupplyExceeded, InvalidSignature, AccountPreviouslyMinted, InvalidValue, ValueUnchanged} from "../TerrapinGenesis.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "erc721a/contracts/extensions/ERC721AQueryable.sol";

enum TokenOrigin {
    Unknown,
    Gen1,
    WL,
    HeroRedemption
}

/**
 * @title Terrapin Universe Card Pack
 *
 * @notice ERC-721 NFT Token Contract.
 *
 * @author 0x1687572416fdd591bcc710fa07cee94a76eea201681884b1d5cc528cba584815
 */
abstract contract TerrapinUniverseCardPack is
    Ownable,
    AccessControl,
    ReentrancyGuard,
    ERC721AQueryable
{
    using Address for address payable;
    using EnumerableSet for EnumerableSet.UintSet;

    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
    bytes32 public constant REDEEMER_ROLE = keccak256("REDEEMER_ROLE");
    uint256 public constant MINT_COUNT_PER_GEN1 = 2;
    uint256 public constant START_TOKEN_ID = 1;
    uint256 public constant maxSupply = 2000;
    address public constant NULL_ADDRESS = address(0);
    address public constant OS_CONDUIT_ADDRESS =
        0x1E0049783F008A0085193E00003D00cd54003c71;
    TerrapinGenesis public immutable terrapinGenesis;

    bool public mintActive;
    string public baseURI;

    EnumerableSet.UintSet internal _usedGen1TokenIds;

    event MintActiveUpdated(bool mintActive);
    event BaseURIUpdated(string oldBaseURI, string baseURI);

    error InvalidGen1TokenIds();
    error InvalidTokenId();
    error InvalidTerrapinGenesisAddress();

    constructor(
        string memory name_,
        string memory symbol_,
        TerrapinGenesis terrapinGenesis_,
        string memory baseURI_,
        address[] memory operators
    ) ERC721A(name_, symbol_) {
        terrapinGenesis = terrapinGenesis_;
        baseURI = baseURI_;

        _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
        for (uint256 index = 0; index < operators.length; ++index) {
            _grantRole(OPERATOR_ROLE, operators[index]);
        }
    }

    function burn(uint256[] calldata tokenIds)
        external
        onlyRole(REDEEMER_ROLE)
    {
        for (uint256 index = 0; index < tokenIds.length; ++index) {
            uint256 tokenId = tokenIds[index];

            _burn(tokenId, false);
        }
    }

    function setMintActive(bool mintActive_) external onlyRole(OPERATOR_ROLE) {
        if (mintActive == mintActive_) revert ValueUnchanged();

        mintActive = mintActive_;

        emit MintActiveUpdated(mintActive);
    }

    function setBaseURI(string calldata baseURI_)
        external
        onlyRole(OPERATOR_ROLE)
    {
        if (
            keccak256(abi.encodePacked(baseURI_)) ==
            keccak256(abi.encodePacked(_baseURI()))
        ) revert ValueUnchanged();

        string memory oldBaseURI = _baseURI();
        baseURI = baseURI_;

        emit BaseURIUpdated(oldBaseURI, baseURI_);
    }

    function withdraw() external onlyRole(DEFAULT_ADMIN_ROLE) {
        payable(_msgSender()).sendValue(address(this).balance);
    }

    function totalMinted() external view returns (uint256) {
        return _totalMinted();
    }

    function numberMinted(address account) external view returns (uint256) {
        return _numberMinted(account);
    }

    function usedGen1TokenIds() external view returns (uint256[] memory) {
        return _usedGen1TokenIds.values();
    }

    function originOf(uint256 tokenId)
        external
        view
        virtual
        returns (TokenOrigin);

    /**
     * @notice Used to calculate valid and unused gen1TokenIds for the
     * given `account` off-chain. The results of this function may be
     * safely passed to {mint}.
     */
    function eligibleGen1TokenIdsOf(address account)
        external
        view
        returns (uint256[] memory)
    {
        if (address(terrapinGenesis) == NULL_ADDRESS)
            revert InvalidTerrapinGenesisAddress();

        uint256[] memory tokenIds = terrapinGenesis.tokensOfOwner(account);
        uint256[] memory eligibleTokenIdsWithPadding = new uint256[](
            tokenIds.length
        );

        uint256 numberOfEligibleTokenIds = 0;
        for (
            uint256 tokenIdIndex = 0;
            tokenIdIndex < eligibleTokenIdsWithPadding.length;
            ++tokenIdIndex
        ) {
            uint256 tokenId = tokenIds[tokenIdIndex];
            if (isGen1TokenIdUsed(tokenId) != true) {
                eligibleTokenIdsWithPadding[numberOfEligibleTokenIds] = tokenId;
                ++numberOfEligibleTokenIds;
            }
        }

        uint256[] memory eligibleTokenIds = new uint256[](
            numberOfEligibleTokenIds
        );
        for (uint256 index = 0; index < numberOfEligibleTokenIds; ++index) {
            eligibleTokenIds[index] = eligibleTokenIdsWithPadding[index];
        }

        return eligibleTokenIds;
    }

    function isGen1TokenIdUsed(uint256 tokenId) public view returns (bool) {
        return _usedGen1TokenIds.contains(tokenId);
    }

    function isApprovedForAll(address owner_, address operator)
        public
        view
        override
        returns (bool)
    {
        if (super.isApprovedForAll(owner_, operator)) {
            return true;
        }

        if (operator == OS_CONDUIT_ADDRESS) {
            return true;
        }

        return false;
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(AccessControl, ERC721A)
        returns (bool)
    {
        return
            super.supportsInterface(interfaceId) ||
            AccessControl.supportsInterface(interfaceId);
    }

    function _mintViaGen1(address to, uint256[] calldata tokenIds) internal {
        uint256 numberToMint = MINT_COUNT_PER_GEN1;
        for (
            uint256 mintIndex = 0;
            mintIndex < tokenIds.length && numberToMint == MINT_COUNT_PER_GEN1;
            ++mintIndex
        ) {
            numberToMint = _allowableMintAmount(MINT_COUNT_PER_GEN1);
            if (numberToMint > 0) {
                _usedGen1TokenIds.add(tokenIds[mintIndex]);
                _safeMint(to, numberToMint);
            }
        }
    }

    function _baseURI() internal view override returns (string memory) {
        return baseURI;
    }

    function _soldOut() internal view returns (bool) {
        return _totalMinted() >= maxSupply;
    }

    function _allowableMintAmount(uint256 targetAmount)
        internal
        view
        returns (uint256)
    {
        uint256 remainingMintableAmount = maxSupply - _totalMinted();
        return Math.min(targetAmount, remainingMintableAmount);
    }

    function _hasMintedTokenId(uint256 tokenId) internal view returns (bool) {
        return tokenId >= _startTokenId() && tokenId < _nextTokenId();
    }

    function _startTokenId() internal pure override returns (uint256) {
        return START_TOKEN_ID;
    }

    function _areGen1TokenIdsEligible(
        uint256[] calldata tokenIds,
        address account
    ) internal view returns (bool) {
        if (address(terrapinGenesis) == NULL_ADDRESS)
            revert InvalidTerrapinGenesisAddress();

        bool eligible = true;

        bool[] memory duplicatesCheck = new bool[](terrapinGenesis.maxSupply());

        for (uint256 index = 0; index < tokenIds.length && eligible; ++index) {
            uint256 tokenId = tokenIds[index];
            uint256 duplicateCheckIndex = tokenId - _startTokenId();
            bool isContractOperatorOrTokenOwner = hasRole(
                OPERATOR_ROLE,
                account
            ) || terrapinGenesis.ownerOf(tokenId) == account;
            bool tokenIdIsUnused = _usedGen1TokenIds.contains(tokenId) != true;
            bool isNotDuplicate = duplicatesCheck[duplicateCheckIndex] == false;

            eligible =
                isContractOperatorOrTokenOwner &&
                tokenIdIsUnused &&
                isNotDuplicate;
            duplicatesCheck[duplicateCheckIndex] = true;
        }

        return eligible;
    }
}

File 17 of 20 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721A.sol';

/**
 * @dev Interface of ERC721 token receiver.
 */
interface ERC721A__IERC721Receiver {
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @title ERC721A
 *
 * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
 * Non-Fungible Token Standard, including the Metadata extension.
 * Optimized for lower gas during batch mints.
 *
 * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
 * starting from `_startTokenId()`.
 *
 * Assumptions:
 *
 * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721A is IERC721A {
    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
    struct TokenApprovalRef {
        address value;
    }

    // =============================================================
    //                           CONSTANTS
    // =============================================================

    // Mask of an entry in packed address data.
    uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

    // The bit position of `numberMinted` in packed address data.
    uint256 private constant _BITPOS_NUMBER_MINTED = 64;

    // The bit position of `numberBurned` in packed address data.
    uint256 private constant _BITPOS_NUMBER_BURNED = 128;

    // The bit position of `aux` in packed address data.
    uint256 private constant _BITPOS_AUX = 192;

    // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
    uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;

    // The bit position of `startTimestamp` in packed ownership.
    uint256 private constant _BITPOS_START_TIMESTAMP = 160;

    // The bit mask of the `burned` bit in packed ownership.
    uint256 private constant _BITMASK_BURNED = 1 << 224;

    // The bit position of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;

    // The bit mask of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;

    // The bit position of `extraData` in packed ownership.
    uint256 private constant _BITPOS_EXTRA_DATA = 232;

    // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
    uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;

    // The mask of the lower 160 bits for addresses.
    uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;

    // The maximum `quantity` that can be minted with {_mintERC2309}.
    // This limit is to prevent overflows on the address data entries.
    // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
    // is required to cause an overflow, which is unrealistic.
    uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;

    // The `Transfer` event signature is given by:
    // `keccak256(bytes("Transfer(address,address,uint256)"))`.
    bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    // =============================================================
    //                            STORAGE
    // =============================================================

    // The next token ID to be minted.
    uint256 private _currentIndex;

    // The number of tokens burned.
    uint256 private _burnCounter;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to ownership details
    // An empty struct value does not necessarily mean the token is unowned.
    // See {_packedOwnershipOf} implementation for details.
    //
    // Bits Layout:
    // - [0..159]   `addr`
    // - [160..223] `startTimestamp`
    // - [224]      `burned`
    // - [225]      `nextInitialized`
    // - [232..255] `extraData`
    mapping(uint256 => uint256) private _packedOwnerships;

    // Mapping owner address to address data.
    //
    // Bits Layout:
    // - [0..63]    `balance`
    // - [64..127]  `numberMinted`
    // - [128..191] `numberBurned`
    // - [192..255] `aux`
    mapping(address => uint256) private _packedAddressData;

    // Mapping from token ID to approved address.
    mapping(uint256 => TokenApprovalRef) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    // =============================================================
    //                          CONSTRUCTOR
    // =============================================================

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();
    }

    // =============================================================
    //                   TOKEN COUNTING OPERATIONS
    // =============================================================

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev Returns the next token ID to be minted.
     */
    function _nextTokenId() internal view virtual returns (uint256) {
        return _currentIndex;
    }

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than `_currentIndex - _startTokenId()` times.
        unchecked {
            return _currentIndex - _burnCounter - _startTokenId();
        }
    }

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view virtual returns (uint256) {
        // Counter underflow is impossible as `_currentIndex` does not decrement,
        // and it is initialized to `_startTokenId()`.
        unchecked {
            return _currentIndex - _startTokenId();
        }
    }

    /**
     * @dev Returns the total number of tokens burned.
     */
    function _totalBurned() internal view virtual returns (uint256) {
        return _burnCounter;
    }

    // =============================================================
    //                    ADDRESS DATA OPERATIONS
    // =============================================================

    /**
     * @dev Returns the number of tokens in `owner`'s account.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    function _getAux(address owner) internal view returns (uint64) {
        return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
    }

    /**
     * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    function _setAux(address owner, uint64 aux) internal virtual {
        uint256 packed = _packedAddressData[owner];
        uint256 auxCasted;
        // Cast `aux` with assembly to avoid redundant masking.
        assembly {
            auxCasted := aux
        }
        packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
        _packedAddressData[owner] = packed;
    }

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes
        // of the XOR of all function selectors in the interface.
        // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
        // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

    /**
     * @dev Returns the token collection name.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

        string memory baseURI = _baseURI();
        return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
    }

    /**
     * @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, it can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return '';
    }

    // =============================================================
    //                     OWNERSHIPS OPERATIONS
    // =============================================================

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }

    /**
     * @dev Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around over time.
     */
    function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnershipOf(tokenId));
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct at `index`.
     */
    function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnerships[index]);
    }

    /**
     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
     */
    function _initializeOwnershipAt(uint256 index) internal virtual {
        if (_packedOwnerships[index] == 0) {
            _packedOwnerships[index] = _packedOwnershipOf(index);
        }
    }

    /**
     * Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
        uint256 curr = tokenId;

        unchecked {
            if (_startTokenId() <= curr)
                if (curr < _currentIndex) {
                    uint256 packed = _packedOwnerships[curr];
                    // If not burned.
                    if (packed & _BITMASK_BURNED == 0) {
                        // Invariant:
                        // There will always be an initialized ownership slot
                        // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                        // before an unintialized ownership slot
                        // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                        // Hence, `curr` will not underflow.
                        //
                        // We can directly compare the packed value.
                        // If the address is zero, packed will be zero.
                        while (packed == 0) {
                            packed = _packedOwnerships[--curr];
                        }
                        return packed;
                    }
                }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
     */
    function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
        ownership.addr = address(uint160(packed));
        ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
        ownership.burned = packed & _BITMASK_BURNED != 0;
        ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
    }

    /**
     * @dev Packs ownership data into a single uint256.
     */
    function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
            result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
        }
    }

    /**
     * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
     */
    function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
        // For branchless setting of the `nextInitialized` flag.
        assembly {
            // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
            result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
        }
    }

    // =============================================================
    //                      APPROVAL OPERATIONS
    // =============================================================

    /**
     * @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) public payable virtual override {
        address owner = ownerOf(tokenId);

        if (_msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                revert ApprovalCallerNotOwnerNorApproved();
            }

        _tokenApprovals[tokenId].value = to;
        emit Approval(owner, to, tokenId);
    }

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return _tokenApprovals[tokenId].value;
    }

    /**
     * @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) public virtual override {
        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @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. See {_mint}.
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < _currentIndex && // If within bounds,
            _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
    }

    /**
     * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
     */
    function _isSenderApprovedOrOwner(
        address approvedAddress,
        address owner,
        address msgSender
    ) private pure returns (bool result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
            msgSender := and(msgSender, _BITMASK_ADDRESS)
            // `msgSender == owner || msgSender == approvedAddress`.
            result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
        }
    }

    /**
     * @dev Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedSlotAndAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
        assembly {
            approvedAddressSlot := tokenApproval.slot
            approvedAddress := sload(approvedAddressSlot)
        }
    }

    // =============================================================
    //                      TRANSFER OPERATIONS
    // =============================================================

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * 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
    ) public payable virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        // The nested ifs save around 20+ gas over a compound boolean condition.
        if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
            if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();

        if (to == address(0)) revert TransferToZeroAddress();

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // We can directly increment and decrement the balances.
            --_packedAddressData[from]; // Updates: `balance -= 1`.
            ++_packedAddressData[to]; // Updates: `balance += 1`.

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                to,
                _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, to, tokenId);
        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @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 memory _data
    ) public payable virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @dev Hook that is called before a set of serially-ordered token IDs
     * are about to be transferred. This includes minting.
     * And also called before burning one token.
     *
     * `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`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    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.
     * And also called after one token has been burned.
     *
     * `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` has been
     * transferred to `to`.
     * - When `from` is zero, `tokenId` has been minted for `to`.
     * - When `to` is zero, `tokenId` has been burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * `from` - Previous owner of the given token ID.
     * `to` - Target address that will receive the token.
     * `tokenId` - Token ID to be transferred.
     * `_data` - Optional data to send along with the call.
     *
     * Returns whether the call correctly returned the expected magic value.
     */
    function _checkContractOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
            bytes4 retval
        ) {
            return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                revert TransferToNonERC721ReceiverImplementer();
            } else {
                assembly {
                    revert(add(32, reason), mload(reason))
                }
            }
        }
    }

    // =============================================================
    //                        MINT OPERATIONS
    // =============================================================

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mint(address to, uint256 quantity) internal virtual {
        uint256 startTokenId = _currentIndex;
        if (quantity == 0) revert MintZeroQuantity();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are incredibly unrealistic.
        // `balance` and `numberMinted` have a maximum limit of 2**64.
        // `tokenId` has a maximum limit of 2**256.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

            // Use assembly to loop and emit the `Transfer` event for gas savings.
            // The duplicated `log4` removes an extra check and reduces stack juggling.
            // The assembly, together with the surrounding Solidity code, have been
            // delicately arranged to nudge the compiler into producing optimized opcodes.
            assembly {
                // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                toMasked := and(to, _BITMASK_ADDRESS)
                // Emit the `Transfer` event.
                log4(
                    0, // Start of data (0, since no data).
                    0, // End of data (0, since no data).
                    _TRANSFER_EVENT_SIGNATURE, // Signature.
                    0, // `address(0)`.
                    toMasked, // `to`.
                    startTokenId // `tokenId`.
                )

                // The `iszero(eq(,))` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
                // The compiler will optimize the `iszero` away for performance.
                for {
                    let tokenId := add(startTokenId, 1)
                } iszero(eq(tokenId, end)) {
                    tokenId := add(tokenId, 1)
                } {
                    // Emit the `Transfer` event. Similar to above.
                    log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                }
            }
            if (toMasked == 0) revert MintToZeroAddress();

            _currentIndex = end;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * This function is intended for efficient minting only during contract creation.
     *
     * It emits only one {ConsecutiveTransfer} as defined in
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
     * instead of a sequence of {Transfer} event(s).
     *
     * Calling this function outside of contract creation WILL make your contract
     * non-compliant with the ERC721 standard.
     * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
     * {ConsecutiveTransfer} event is only permissible during contract creation.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {ConsecutiveTransfer} event.
     */
    function _mintERC2309(address to, uint256 quantity) internal virtual {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();
        if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);

            _currentIndex = startTokenId + quantity;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @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.
     *
     * See {_mint}.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal virtual {
        _mint(to, quantity);

        unchecked {
            if (to.code.length != 0) {
                uint256 end = _currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (index < end);
                // Reentrancy protection.
                if (_currentIndex != end) revert();
            }
        }
    }

    /**
     * @dev Equivalent to `_safeMint(to, quantity, '')`.
     */
    function _safeMint(address to, uint256 quantity) internal virtual {
        _safeMint(to, quantity, '');
    }

    // =============================================================
    //                        BURN OPERATIONS
    // =============================================================

    /**
     * @dev Equivalent to `_burn(tokenId, false)`.
     */
    function _burn(uint256 tokenId) internal virtual {
        _burn(tokenId, false);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        address from = address(uint160(prevOwnershipPacked));

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        if (approvalCheck) {
            // The nested ifs save around 20+ gas over a compound boolean condition.
            if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
        }

        _beforeTokenTransfers(from, address(0), tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // Updates:
            // - `balance -= 1`.
            // - `numberBurned += 1`.
            //
            // We can directly decrement the balance, and increment the number burned.
            // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
            _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;

            // Updates:
            // - `address` to the last owner.
            // - `startTimestamp` to the timestamp of burning.
            // - `burned` to `true`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                from,
                (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, address(0), tokenId);
        _afterTokenTransfers(from, address(0), tokenId, 1);

        // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
        unchecked {
            _burnCounter++;
        }
    }

    // =============================================================
    //                     EXTRA DATA OPERATIONS
    // =============================================================

    /**
     * @dev Directly sets the extra data for the ownership data `index`.
     */
    function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
        uint256 packed = _packedOwnerships[index];
        if (packed == 0) revert OwnershipNotInitializedForExtraData();
        uint256 extraDataCasted;
        // Cast `extraData` with assembly to avoid redundant masking.
        assembly {
            extraDataCasted := extraData
        }
        packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
        _packedOwnerships[index] = packed;
    }

    /**
     * @dev Called during each token transfer to set the 24bit `extraData` field.
     * Intended to be overridden by the cosumer contract.
     *
     * `previousExtraData` - the value of `extraData` before transfer.
     *
     * 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`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _extraData(
        address from,
        address to,
        uint24 previousExtraData
    ) internal view virtual returns (uint24) {}

    /**
     * @dev Returns the next extra data for the packed ownership data.
     * The returned result is shifted into position.
     */
    function _nextExtraData(
        address from,
        address to,
        uint256 prevOwnershipPacked
    ) private view returns (uint256) {
        uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
        return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
    }

    // =============================================================
    //                       OTHER OPERATIONS
    // =============================================================

    /**
     * @dev Returns the message sender (defaults to `msg.sender`).
     *
     * If you are writing GSN compatible contracts, you need to override this function.
     */
    function _msgSenderERC721A() internal view virtual returns (address) {
        return msg.sender;
    }

    /**
     * @dev Converts a uint256 to its ASCII string decimal representation.
     */
    function _toString(uint256 value) internal pure virtual returns (string memory str) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
            let m := add(mload(0x40), 0xa0)
            // Update the free memory pointer to allocate.
            mstore(0x40, m)
            // Assign the `str` to the end.
            str := sub(m, 0x20)
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end of the memory to calculate the length later.
            let end := str

            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            // prettier-ignore
            for { let temp := value } 1 {} {
                str := sub(str, 1)
                // Write the character to the pointer.
                // The ASCII index of the '0' character is 48.
                mstore8(str, add(48, mod(temp, 10)))
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
                // prettier-ignore
                if iszero(temp) { break }
            }

            let length := sub(end, str)
            // Move the pointer 32 bytes leftwards to make room for the length.
            str := sub(str, 0x20)
            // Store the length.
            mstore(str, length)
        }
    }
}

File 18 of 20 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of ERC721A.
 */
interface IERC721A {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

    /**
     * The token does not exist.
     */
    error ApprovalQueryForNonexistentToken();

    /**
     * Cannot query the balance for the zero address.
     */
    error BalanceQueryForZeroAddress();

    /**
     * Cannot mint to the zero address.
     */
    error MintToZeroAddress();

    /**
     * The quantity of tokens minted must be more than zero.
     */
    error MintZeroQuantity();

    /**
     * The token does not exist.
     */
    error OwnerQueryForNonexistentToken();

    /**
     * The caller must own the token or be an approved operator.
     */
    error TransferCallerNotOwnerNorApproved();

    /**
     * The token must be owned by `from`.
     */
    error TransferFromIncorrectOwner();

    /**
     * Cannot safely transfer to a contract that does not implement the
     * ERC721Receiver interface.
     */
    error TransferToNonERC721ReceiverImplementer();

    /**
     * Cannot transfer to the zero address.
     */
    error TransferToZeroAddress();

    /**
     * The token does not exist.
     */
    error URIQueryForNonexistentToken();

    /**
     * The `quantity` minted with ERC2309 exceeds the safety limit.
     */
    error MintERC2309QuantityExceedsLimit();

    /**
     * The `extraData` cannot be set on an unintialized ownership slot.
     */
    error OwnershipNotInitializedForExtraData();

    // =============================================================
    //                            STRUCTS
    // =============================================================

    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Stores the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
        // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
        uint24 extraData;
    }

    // =============================================================
    //                         TOKEN COUNTERS
    // =============================================================

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() external view returns (uint256);

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);

    // =============================================================
    //                            IERC721
    // =============================================================

    /**
     * @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`,
     * 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 be 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,
        bytes calldata data
    ) external payable;

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom}
     * whenever possible.
     *
     * 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 payable;

    /**
     * @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 payable;

    /**
     * @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);

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

    /**
     * @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);

    // =============================================================
    //                           IERC2309
    // =============================================================

    /**
     * @dev Emitted when tokens in `fromTokenId` to `toTokenId`
     * (inclusive) is transferred from `from` to `to`, as defined in the
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
     *
     * See {_mintERC2309} for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}

File 19 of 20 : ERC721AQueryable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721AQueryable.sol';
import '../ERC721A.sol';

/**
 * @title ERC721AQueryable.
 *
 * @dev ERC721A subclass with convenience query functions.
 */
abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
    /**
     * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
     *
     * If the `tokenId` is out of bounds:
     *
     * - `addr = address(0)`
     * - `startTimestamp = 0`
     * - `burned = false`
     * - `extraData = 0`
     *
     * If the `tokenId` is burned:
     *
     * - `addr = <Address of owner before token was burned>`
     * - `startTimestamp = <Timestamp when token was burned>`
     * - `burned = true`
     * - `extraData = <Extra data when token was burned>`
     *
     * Otherwise:
     *
     * - `addr = <Address of owner>`
     * - `startTimestamp = <Timestamp of start of ownership>`
     * - `burned = false`
     * - `extraData = <Extra data at start of ownership>`
     */
    function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) {
        TokenOwnership memory ownership;
        if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) {
            return ownership;
        }
        ownership = _ownershipAt(tokenId);
        if (ownership.burned) {
            return ownership;
        }
        return _ownershipOf(tokenId);
    }

    /**
     * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
     * See {ERC721AQueryable-explicitOwnershipOf}
     */
    function explicitOwnershipsOf(uint256[] calldata tokenIds)
        external
        view
        virtual
        override
        returns (TokenOwnership[] memory)
    {
        unchecked {
            uint256 tokenIdsLength = tokenIds.length;
            TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength);
            for (uint256 i; i != tokenIdsLength; ++i) {
                ownerships[i] = explicitOwnershipOf(tokenIds[i]);
            }
            return ownerships;
        }
    }

    /**
     * @dev Returns an array of token IDs owned by `owner`,
     * in the range [`start`, `stop`)
     * (i.e. `start <= tokenId < stop`).
     *
     * This function allows for tokens to be queried if the collection
     * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
     *
     * Requirements:
     *
     * - `start < stop`
     */
    function tokensOfOwnerIn(
        address owner,
        uint256 start,
        uint256 stop
    ) external view virtual override returns (uint256[] memory) {
        unchecked {
            if (start >= stop) revert InvalidQueryRange();
            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;
            }
            // We need to call `explicitOwnershipOf(start)`,
            // because the slot at `start` may not be initialized.
            TokenOwnership memory ownership = explicitOwnershipOf(start);
            address currOwnershipAddr;
            // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`.
            // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range.
            if (!ownership.burned) {
                currOwnershipAddr = ownership.addr;
            }
            for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) {
                ownership = _ownershipAt(i);
                if (ownership.burned) {
                    continue;
                }
                if (ownership.addr != address(0)) {
                    currOwnershipAddr = ownership.addr;
                }
                if (currOwnershipAddr == owner) {
                    tokenIds[tokenIdsIdx++] = i;
                }
            }
            // Downsize the array to fit.
            assembly {
                mstore(tokenIds, tokenIdsIdx)
            }
            return tokenIds;
        }
    }

    /**
     * @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.
     *
     * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
     * multiple smaller scans if the collection is large enough to cause
     * an out-of-gas error (10K collections should be fine).
     */
    function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
        unchecked {
            uint256 tokenIdsIdx;
            address currOwnershipAddr;
            uint256 tokenIdsLength = balanceOf(owner);
            uint256[] memory tokenIds = new uint256[](tokenIdsLength);
            TokenOwnership memory ownership;
            for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
                ownership = _ownershipAt(i);
                if (ownership.burned) {
                    continue;
                }
                if (ownership.addr != address(0)) {
                    currOwnershipAddr = ownership.addr;
                }
                if (currOwnershipAddr == owner) {
                    tokenIds[tokenIdsIdx++] = i;
                }
            }
            return tokenIds;
        }
    }
}

File 20 of 20 : IERC721AQueryable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import '../IERC721A.sol';

/**
 * @dev Interface of ERC721AQueryable.
 */
interface IERC721AQueryable is IERC721A {
    /**
     * Invalid query range (`start` >= `stop`).
     */
    error InvalidQueryRange();

    /**
     * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
     *
     * If the `tokenId` is out of bounds:
     *
     * - `addr = address(0)`
     * - `startTimestamp = 0`
     * - `burned = false`
     * - `extraData = 0`
     *
     * If the `tokenId` is burned:
     *
     * - `addr = <Address of owner before token was burned>`
     * - `startTimestamp = <Timestamp when token was burned>`
     * - `burned = true`
     * - `extraData = <Extra data when token was burned>`
     *
     * Otherwise:
     *
     * - `addr = <Address of owner>`
     * - `startTimestamp = <Timestamp of start of ownership>`
     * - `burned = false`
     * - `extraData = <Extra data at start of ownership>`
     */
    function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory);

    /**
     * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
     * See {ERC721AQueryable-explicitOwnershipOf}
     */
    function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory);

    /**
     * @dev Returns an array of token IDs owned by `owner`,
     * in the range [`start`, `stop`)
     * (i.e. `start <= tokenId < stop`).
     *
     * This function allows for tokens to be queried if the collection
     * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
     *
     * Requirements:
     *
     * - `start < stop`
     */
    function tokensOfOwnerIn(
        address owner,
        uint256 start,
        uint256 stop
    ) external view returns (uint256[] memory);

    /**
     * @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.
     *
     * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
     * multiple smaller scans if the collection is large enough to cause
     * an out-of-gas error (10K collections should be fine).
     */
    function tokensOfOwner(address owner) external view returns (uint256[] memory);
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract TerrapinGenesis","name":"terrapinGenesis_","type":"address"},{"internalType":"string","name":"baseURI_","type":"string"},{"internalType":"address[]","name":"operators","type":"address[]"},{"internalType":"address[]","name":"mintSigners","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountPreviouslyMinted","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidGen1TokenIds","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidTerrapinGenesisAddress","type":"error"},{"inputs":[],"name":"InvalidTokenId","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintNotActive","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ValueUnchanged","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":false,"internalType":"string","name":"oldBaseURI","type":"string"},{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"BaseURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"mintActive","type":"bool"}],"name":"MintActiveUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_COUNT_PER_GEN1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_SIGNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NULL_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OS_CONDUIT_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REDEEMER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"START_TOKEN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WHITELIST_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"eligibleGen1TokenIdsOf","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isGen1TokenIdUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"sig","type":"bytes"},{"internalType":"address","name":"account","type":"address"}],"name":"isWhitelistSignatureValid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"sig","type":"bytes"},{"internalType":"uint256[]","name":"gen1TokenIds","type":"uint256[]"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"sig","type":"bytes"},{"internalType":"uint256[]","name":"gen1TokenIds","type":"uint256[]"}],"name":"mintTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"numberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"originOf","outputs":[{"internalType":"enum TokenOrigin","name":"","type":"uint8"}],"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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","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":"payable","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":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"mintActive_","type":"bool"}],"name":"setMintActive","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":[],"name":"terrapinGenesis","outputs":[{"internalType":"contract TerrapinGenesis","name":"","type":"address"}],"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":"totalMinted","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":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usedGen1TokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101606040523480156200001257600080fd5b50604051620042c3380380620042c3833981016040819052620000359162000515565b604080518082018252601e8082527f546572726170696e556e6976657273654865726f6573436172645061636b00006020808401829052845180860186526005815264054554843560dc1b81830152855180870187529384528382019283528551808701875260018152603160f81b90830152925190912060e08190527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66101008190524660a081815287517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818701819052818a01959095526060810193909352608080840192909252308382018190528851808503909201825260c09384019098528051940193909320909252939052610120929092529085858584846200015f33620002a1565b60016002558151620001799060059060208501906200037a565b5080516200018f9060069060208401906200037a565b50600160035550506001600160a01b038316610140528151620001ba90600c9060208501906200037a565b50620001c8600033620002f1565b60005b81518110156200023657620002237f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9298383815181106200020f576200020f62000639565b6020026020010151620002f160201b60201c565b6200022e816200064f565b9050620001cb565b50505050505060005b81518110156200029657620002837fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c8383815181106200020f576200020f62000639565b6200028e816200064f565b90506200023f565b5050505050620006b6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16620003765760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45b5050565b828054620003889062000679565b90600052602060002090601f016020900481019282620003ac5760008555620003f7565b82601f10620003c757805160ff1916838001178555620003f7565b82800160010185558215620003f7579182015b82811115620003f7578251825591602001919060010190620003da565b506200040592915062000409565b5090565b5b808211156200040557600081556001016200040a565b6001600160a01b03811681146200043657600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200047a576200047a62000439565b604052919050565b600082601f8301126200049457600080fd5b815160206001600160401b03821115620004b257620004b262000439565b8160051b620004c38282016200044f565b9283528481018201928281019087851115620004de57600080fd5b83870192505b848310156200050a578251620004fa8162000420565b82529183019190830190620004e4565b979650505050505050565b600080600080608085870312156200052c57600080fd5b8451620005398162000420565b602086810151919550906001600160401b03808211156200055957600080fd5b818801915088601f8301126200056e57600080fd5b81518181111562000583576200058362000439565b62000597601f8201601f191685016200044f565b8181528a85838601011115620005ac57600080fd5b60005b82811015620005cc578481018601518282018701528501620005af565b82811115620005de5760008684840101525b5060408a015190975093505080831115620005f857600080fd5b6200060689848a0162000482565b945060608801519250808311156200061d57600080fd5b50506200062d8782880162000482565b91505092959194509250565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200067257634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200068e57607f821691505b60208210811415620006b057634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e051610100516101205161014051613b8f6200073460003960008181610967015281816119da01528181611a41015281816121430152818161219201526122d701526000612b3f01526000612b8e01526000612b6901526000612ac201526000612aec01526000612b160152613b8f6000f3fe6080604052600436106102ff5760003560e01c80638462151c11610190578063c23dc68f116100dc578063de0ce17d11610095578063f26b6e1a1161006f578063f26b6e1a14610915578063f2fde38b14610935578063f4cc37bd14610955578063f5b541a61461098957600080fd5b8063de0ce17d146108c0578063e985e9c5146108d5578063ee1cc944146108f557600080fd5b8063c23dc68f146107fd578063c87b56dd1461082a578063d547741f1461084a578063d5abeb011461086a578063d875a72614610880578063dc33e681146108a057600080fd5b806395d89b4111610149578063a22cb46511610123578063a22cb46514610795578063a2309ff8146107b5578063b80f55c9146107ca578063b88d4fde146107ea57600080fd5b806395d89b411461074b57806399a2557a14610760578063a217fddf1461078057600080fd5b80638462151c1461069657806384eaa9b6146106c357806387f65c91146106e35780638a88487d146106f85780638da5cb5b1461070d57806391d148541461072b57600080fd5b8063390dad5f1161024f5780636352211e1161020857806370a08231116101e257806370a0823114610600578063715018a614610620578063794b2a07146106355780637fa46ab41461066257600080fd5b80636352211e146105a35780636c0360eb146105c3578063702d5394146105d857600080fd5b8063390dad5f146104c65780633ccfd60b146104fa57806342842e0e1461050f57806355f804b3146105225780635bbb2177146105425780636301dccf1461056f57600080fd5b80631a899744116102bc57806325fd90f31161029657806325fd90f31461044c5780632f2ff15d1461046657806336568abe14610486578063387b711d146104a657600080fd5b80631a899744146103e857806323b872dd14610408578063248a9ca31461041b57600080fd5b80630164f0881461030457806301ffc9a71461032c57806306fdde031461035c578063081812fc1461037e578063095ea7b3146103b657806318160ddd146103cb575b600080fd5b34801561031057600080fd5b50610319600281565b6040519081526020015b60405180910390f35b34801561033857600080fd5b5061034c610347366004613170565b6109ab565b6040519015158152602001610323565b34801561036857600080fd5b506103716109cb565b60405161032391906131e5565b34801561038a57600080fd5b5061039e6103993660046131f8565b610a5d565b6040516001600160a01b039091168152602001610323565b6103c96103c4366004613226565b610aa1565b005b3480156103d757600080fd5b506004546003540360001901610319565b3480156103f457600080fd5b5061034c6104033660046131f8565b610b41565b6103c9610416366004613252565b610b4e565b34801561042757600080fd5b506103196104363660046131f8565b6000908152600160208190526040909120015490565b34801561045857600080fd5b50600b5461034c9060ff1681565b34801561047257600080fd5b506103c9610481366004613293565b610cd7565b34801561049257600080fd5b506103c96104a1366004613293565b610d03565b3480156104b257600080fd5b506103c96104c1366004613348565b610d86565b3480156104d257600080fd5b506103197fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c81565b34801561050657600080fd5b506103c9610d99565b6103c961051d366004613252565b610db2565b34801561052e57600080fd5b506103c961053d3660046133b3565b610dcd565b34801561054e57600080fd5b5061056261055d3660046133f4565b610eb6565b6040516103239190613465565b34801561057b57600080fd5b506103197fe74c04bdb85741f90efadc0228949f2b97fc0c6a16334216c9bd13273891142b81565b3480156105af57600080fd5b5061039e6105be3660046131f8565b610f81565b3480156105cf57600080fd5b50610371610f8c565b3480156105e457600080fd5b5061039e731e0049783f008a0085193e00003d00cd54003c7181565b34801561060c57600080fd5b5061031961061b3660046134a7565b61101a565b34801561062c57600080fd5b506103c9611068565b34801561064157600080fd5b506106556106503660046131f8565b6110ce565b60405161032391906134da565b34801561066e57600080fd5b506103197f44ac9762eec3a11893fefb11d028bb3102560094137c3ed4518712475b2577cc81565b3480156106a257600080fd5b506106b66106b13660046134a7565b61111b565b6040516103239190613502565b3480156106cf57600080fd5b506103c96106de36600461353a565b61122a565b3480156106ef57600080fd5b50610319600181565b34801561070457600080fd5b506106b6611396565b34801561071957600080fd5b506000546001600160a01b031661039e565b34801561073757600080fd5b5061034c610746366004613293565b6113a7565b34801561075757600080fd5b506103716113d2565b34801561076c57600080fd5b506106b661077b3660046135bc565b6113e1565b34801561078c57600080fd5b50610319600081565b3480156107a157600080fd5b506103c96107b0366004613606565b61156c565b3480156107c157600080fd5b506103196115d8565b3480156107d657600080fd5b506103c96107e53660046133f4565b6115e7565b6103c96107f8366004613681565b611656565b34801561080957600080fd5b5061081d6108183660046131f8565b61169a565b6040516103239190613744565b34801561083657600080fd5b506103716108453660046131f8565b611722565b34801561085657600080fd5b506103c9610865366004613293565b6117a6565b34801561087657600080fd5b506103196107d081565b34801561088c57600080fd5b5061034c61089b366004613752565b6117cd565b3480156108ac57600080fd5b506103196108bb3660046134a7565b6118ad565b3480156108cc57600080fd5b5061039e600081565b3480156108e157600080fd5b5061034c6108f03660046137a8565b6118d7565b34801561090157600080fd5b506103c96109103660046137d6565b611945565b34801561092157600080fd5b506106b66109303660046134a7565b6119d6565b34801561094157600080fd5b506103c96109503660046134a7565b611c25565b34801561096157600080fd5b5061039e7f000000000000000000000000000000000000000000000000000000000000000081565b34801561099557600080fd5b50610319600080516020613b1a83398151915281565b60006109b682611ced565b806109c557506109c582611d3b565b92915050565b6060600580546109da906137f1565b80601f0160208091040260200160405190810160405280929190818152602001828054610a06906137f1565b8015610a535780601f10610a2857610100808354040283529160200191610a53565b820191906000526020600020905b815481529060010190602001808311610a3657829003601f168201915b5050505050905090565b6000610a6882611d70565b610a85576040516333d1c03960e21b815260040160405180910390fd5b506000908152600960205260409020546001600160a01b031690565b6000610aac82610f81565b9050336001600160a01b03821614610ae557610ac881336118d7565b610ae5576040516367d9dca160e11b815260040160405180910390fd5b60008281526009602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60006109c5600d83611da5565b6000610b5982611dbd565b9050836001600160a01b0316816001600160a01b031614610b8c5760405162a1148160e81b815260040160405180910390fd5b60008281526009602052604090208054610bb88187335b6001600160a01b039081169116811491141790565b610be357610bc686336118d7565b610be357604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610c0a57604051633a954ecd60e21b815260040160405180910390fd5b8015610c1557600082555b6001600160a01b038681166000908152600860205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260076020526040902055600160e11b8316610ca05760018401600081815260076020526040902054610c9e576003548114610c9e5760008181526007602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020613b3a83398151915260405160405180910390a4505050505050565b60008281526001602081905260409091200154610cf48133611e26565b610cfe8383611e8a565b505050565b6001600160a01b0381163314610d785760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610d828282611ef5565b5050565b610d93338585858561122a565b50505050565b6000610da58133611e26565b610daf3347611f5c565b50565b610cfe83838360405180602001604052806000815250611656565b600080516020613b1a833981519152610de68133611e26565b610dee612075565b604051602001610dfe919061382c565b604051602081830303815290604052805190602001208383604051602001610e27929190613848565b604051602081830303815290604052805190602001201415610e5c5760405163df82d43b60e01b815260040160405180910390fd5b6000610e66612075565b9050610e74600c85856130c1565b507f309b29ded109b9e28fb9885757b3e0096eb75c51d23aa4635d68bcd569f6adc1818585604051610ea893929190613858565b60405180910390a150505050565b6060816000816001600160401b03811115610ed357610ed361363b565b604051908082528060200260200182016040528015610f2557816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610ef15790505b50905060005b828114610f7857610f53868683818110610f4757610f4761389e565b9050602002013561169a565b828281518110610f6557610f6561389e565b6020908102919091010152600101610f2b565b50949350505050565b60006109c582611dbd565b600c8054610f99906137f1565b80601f0160208091040260200160405190810160405280929190818152602001828054610fc5906137f1565b80156110125780601f10610fe757610100808354040283529160200191611012565b820191906000526020600020905b815481529060010190602001808311610ff557829003601f168201915b505050505081565b60006001600160a01b038216611043576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600860205260409020546001600160401b031690565b6000546001600160a01b031633146110c25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d6f565b6110cc6000612084565b565b60006110d9826120d4565b15156001146110fb576040516307ed98ed60e31b815260040160405180910390fd5b611106600f83611da5565b1561111357506002919050565b506001919050565b6060600080600061112b8561101a565b90506000816001600160401b038111156111475761114761363b565b604051908082528060200260200182016040528015611170578160200160208202803683370190505b50905061119d60408051608081018252600080825260208201819052918101829052606081019190915290565b60015b83861461121e576111b0816120ea565b91508160400151156111c157611216565b81516001600160a01b0316156111d657815194505b876001600160a01b0316856001600160a01b0316141561121657808387806001019850815181106112095761120961389e565b6020026020010181815250505b6001016111a0565b50909695505050505050565b60028054141561127c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d6f565b60028055600b5460ff1615156001146112a85760405163914edb0f60e01b815260040160405180910390fd5b6112b0612126565b156112ce57604051638a164f6360e01b815260040160405180910390fd5b6112d982823361213f565b15156001146112fb5760405163a4633ea560e01b815260040160405180910390fd5b821561137f5761130a85612415565b1561132857604051630de2dc9360e41b815260040160405180910390fd5b611340600080516020613b1a833981519152336113a7565b1515600114611376576113548484336117cd565b151560011461137657604051638baa579f60e01b815260040160405180910390fd5b61137f85612422565b61138a85838361244e565b50506001600255505050565b60606113a2600d6124c7565b905090565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600680546109da906137f1565b606081831061140357604051631960ccad60e11b815260040160405180910390fd5b60008061140f60035490565b9050600185101561141f57600194505b8084111561142b578093505b60006114368761101a565b905084861015611455578585038181101561144f578091505b50611459565b5060005b6000816001600160401b038111156114735761147361363b565b60405190808252806020026020018201604052801561149c578160200160208202803683370190505b509050816114af57935061156592505050565b60006114ba8861169a565b9050600081604001516114cb575080515b885b8881141580156114dd5750848714155b15611559576114eb816120ea565b92508260400151156114fc57611551565b82516001600160a01b03161561151157825191505b8a6001600160a01b0316826001600160a01b0316141561155157808488806001019950815181106115445761154461389e565b6020026020010181815250505b6001016114cd565b50505092835250909150505b9392505050565b336000818152600a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60006113a26003546000190190565b7f44ac9762eec3a11893fefb11d028bb3102560094137c3ed4518712475b2577cc6116128133611e26565b60005b82811015610d935760008484838181106116315761163161389e565b9050602002013590506116458160006124d4565b5061164f816138ca565b9050611615565b611661848484610b4e565b6001600160a01b0383163b15610d935761167d84848484612606565b610d93576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806116f357506003548310155b156116fe5792915050565b611707836120ea565b90508060400151156117195792915050565b611565836126fd565b606061172d82611d70565b61174a57604051630a14c4b560e41b815260040160405180910390fd5b6000611754612075565b90508051600014156117755760405180602001604052806000815250611565565b8061177f84612732565b6040516020016117909291906138e5565b6040516020818303038152906040529392505050565b600082815260016020819052604090912001546117c38133611e26565b610cfe8383611ef5565b6000806118337fe74c04bdb85741f90efadc0228949f2b97fc0c6a16334216c9bd13273891142b846040516020016118189291909182526001600160a01b0316602082015260400190565b60405160208183030381529060405280519060200120612780565b905060006118778287878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506127ce92505050565b90506118a37fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c826113a7565b9695505050505050565b6001600160a01b038116600090815260086020526040808220546001600160401b03911c166109c5565b6001600160a01b038083166000908152600a6020908152604080832093851683529290529081205460ff161561190f575060016109c5565b6001600160a01b038216731e0049783f008a0085193e00003d00cd54003c71141561193c575060016109c5565b50600092915050565b600080516020613b1a83398151915261195e8133611e26565b600b5460ff16151582151514156119885760405163df82d43b60e01b815260040160405180910390fd5b600b805460ff191683151590811790915560405160ff909116151581527f4f6846e1a6a026ffba330735c9ca2845cfe23bccb44541d241c637b8542fa7a09060200160405180910390a15050565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611a1f57604051636f2c3cd960e01b815260040160405180910390fd5b604051632118854760e21b81526001600160a01b0383811660048301526000917f000000000000000000000000000000000000000000000000000000000000000090911690638462151c9060240160006040518083038186803b158015611a8557600080fd5b505afa158015611a99573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ac19190810190613914565b9050600081516001600160401b03811115611ade57611ade61363b565b604051908082528060200260200182016040528015611b07578160200160208202803683370190505b5090506000805b8251811015611b82576000848281518110611b2b57611b2b61389e565b60200260200101519050611b3e81610b41565b1515600114611b715780848481518110611b5a57611b5a61389e565b6020908102919091010152611b6e836138ca565b92505b50611b7b816138ca565b9050611b0e565b506000816001600160401b03811115611b9d57611b9d61363b565b604051908082528060200260200182016040528015611bc6578160200160208202803683370190505b50905060005b82811015611c1b57838181518110611be657611be661389e565b6020026020010151828281518110611c0057611c0061389e565b6020908102919091010152611c14816138ca565b9050611bcc565b5095945050505050565b6000546001600160a01b03163314611c7f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d6f565b6001600160a01b038116611ce45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d6f565b610daf81612084565b60006301ffc9a760e01b6001600160e01b031983161480611d1e57506380ac58cd60e01b6001600160e01b03198316145b806109c55750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216637965db0b60e01b14806109c557506301ffc9a760e01b6001600160e01b03198316146109c5565b600081600111158015611d84575060035482105b80156109c5575050600090815260076020526040902054600160e01b161590565b60008181526001830160205260408120541515611565565b60008180600111611e0d57600354811015611e0d57600081815260076020526040902054600160e01b8116611e0b575b80611565575060001901600081815260076020526040902054611ded565b505b604051636f96cda160e11b815260040160405180910390fd5b611e3082826113a7565b610d8257611e48816001600160a01b031660146127f2565b611e538360206127f2565b604051602001611e649291906139b9565b60408051601f198184030181529082905262461bcd60e51b8252610d6f916004016131e5565b611e9482826113a7565b610d825760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611eff82826113a7565b15610d825760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b80471015611fac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d6f565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611ff9576040519150601f19603f3d011682016040523d82523d6000602084013e611ffe565b606091505b5050905080610cfe5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d6f565b6060600c80546109da906137f1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000600182101580156109c55750506003541190565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600760205260409020546109c59061298d565b60006107d06121386003546000190190565b1015905090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661218857604051636f2c3cd960e01b815260040160405180910390fd5b60006001905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d5abeb016040518163ffffffff1660e01b815260040160206040518083038186803b1580156121e957600080fd5b505afa1580156121fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122219190613a2e565b6001600160401b038111156122385761223861363b565b604051908082528060200260200182016040528015612261578160200160208202803683370190505b50905060005b85811080156122735750825b1561240a57600087878381811061228c5761228c61389e565b905060200201359050600061229f600190565b6122a99083613a47565b905060006122c5600080516020613b1a833981519152896113a7565b8061237e5750876001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636352211e856040518263ffffffff1660e01b815260040161232391815260200190565b60206040518083038186803b15801561233b57600080fd5b505afa15801561234f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123739190613a5e565b6001600160a01b0316145b9050600061238d600d85611da5565b1515600115151415905060008684815181106123ab576123ab61389e565b60209081029190910101511590508280156123c35750815b80156123cc5750805b975060018785815181106123e2576123e261389e565b602002602001019015159081151581525050505050505080612403906138ca565b9050612267565b509095945050505050565b60006109c56011836129d4565b61243661242e60035490565b600f906129f6565b50612442601182612a02565b50610daf816001612a17565b600260005b82811080156124625750600282145b156124c0576124716002612a31565b915081156124b0576124a584848381811061248e5761248e61389e565b90506020020135600d6129f690919063ffffffff16565b506124b08583612a17565b6124b9816138ca565b9050612453565b5050505050565b6060600061156583612a59565b60006124df83611dbd565b9050806000806124fd86600090815260096020526040902080549091565b91509150841561253d57612512818433610ba3565b61253d5761252083336118d7565b61253d57604051632ce44b5f60e11b815260040160405180910390fd5b801561254857600082555b6001600160a01b038316600081815260086020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260076020526040902055600160e11b84166125cf57600186016000818152600760205260409020546125cd5760035481146125cd5760008181526007602052604090208590555b505b60405186906000906001600160a01b03861690600080516020613b3a833981519152908390a4505060048054600101905550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061263b903390899088908890600401613a7b565b602060405180830381600087803b15801561265557600080fd5b505af1925050508015612685575060408051601f3d908101601f1916820190925261268291810190613aae565b60015b6126e0573d8080156126b3576040519150601f19603f3d011682016040523d82523d6000602084013e6126b8565b606091505b5080516126d8576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6040805160808101825260008082526020820181905291810182905260608101919091526109c561272d83611dbd565b61298d565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806127695761276e565b61274c565b50819003601f19909101908152919050565b60006109c561278d612ab5565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006127dd8585612bdc565b915091506127ea81612c4c565b509392505050565b60606000612801836002613acb565b61280c906002613aea565b6001600160401b038111156128235761282361363b565b6040519080825280601f01601f19166020018201604052801561284d576020820181803683370190505b509050600360fc1b816000815181106128685761286861389e565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106128975761289761389e565b60200101906001600160f81b031916908160001a90535060006128bb846002613acb565b6128c6906001613aea565b90505b600181111561293e576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106128fa576128fa61389e565b1a60f81b8282815181106129105761291061389e565b60200101906001600160f81b031916908160001a90535060049490941c9361293781613b02565b90506128c9565b5083156115655760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d6f565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6001600160a01b03811660009081526001830160205260408120541515611565565b60006115658383612e07565b6000611565836001600160a01b038416612e07565b610d82828260405180602001604052806000815250612e56565b600080612a416003546000190190565b612a4d906107d0613a47565b90506115658382612ebc565b606081600001805480602002602001604051908101604052809291908181526020018280548015612aa957602002820191906000526020600020905b815481526020019060010190808311612a95575b50505050509050919050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015612b0e57507f000000000000000000000000000000000000000000000000000000000000000046145b15612b3857507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600080825160411415612c135760208301516040840151606085015160001a612c0787828585612ed2565b94509450505050612c45565b825160401415612c3d5760208301516040840151612c32868383612fbf565b935093505050612c45565b506000905060025b9250929050565b6000816004811115612c6057612c606134c4565b1415612c695750565b6001816004811115612c7d57612c7d6134c4565b1415612ccb5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610d6f565b6002816004811115612cdf57612cdf6134c4565b1415612d2d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610d6f565b6003816004811115612d4157612d416134c4565b1415612d9a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610d6f565b6004816004811115612dae57612dae6134c4565b1415610daf5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610d6f565b6000818152600183016020526040812054612e4e575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556109c5565b5060006109c5565b612e608383612fee565b6001600160a01b0383163b15610cfe576003548281035b612e8a6000868380600101945086612606565b612ea7576040516368d2bf6b60e11b815260040160405180910390fd5b818110612e775781600354146124c057600080fd5b6000818310612ecb5781611565565b5090919050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612f095750600090506003612fb6565b8460ff16601b14158015612f2157508460ff16601c14155b15612f325750600090506004612fb6565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612f86573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612faf57600060019250925050612fb6565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b01612fe087828885612ed2565b935093505050935093915050565b6003548161300f5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526008602090815260408083208054680100000000000000018802019055848352600790915281206001851460e11b4260a01b17831790558284019083908390600080516020613b3a8339815191528180a4600183015b81811461309a5780836000600080516020613b3a833981519152600080a4600101613074565b50816130b857604051622e076360e81b815260040160405180910390fd5b60035550505050565b8280546130cd906137f1565b90600052602060002090601f0160209004810192826130ef5760008555613135565b82601f106131085782800160ff19823516178555613135565b82800160010185558215613135579182015b8281111561313557823582559160200191906001019061311a565b50613141929150613145565b5090565b5b808211156131415760008155600101613146565b6001600160e01b031981168114610daf57600080fd5b60006020828403121561318257600080fd5b81356115658161315a565b60005b838110156131a8578181015183820152602001613190565b83811115610d935750506000910152565b600081518084526131d181602086016020860161318d565b601f01601f19169290920160200192915050565b60208152600061156560208301846131b9565b60006020828403121561320a57600080fd5b5035919050565b6001600160a01b0381168114610daf57600080fd5b6000806040838503121561323957600080fd5b823561324481613211565b946020939093013593505050565b60008060006060848603121561326757600080fd5b833561327281613211565b9250602084013561328281613211565b929592945050506040919091013590565b600080604083850312156132a657600080fd5b8235915060208301356132b881613211565b809150509250929050565b60008083601f8401126132d557600080fd5b5081356001600160401b038111156132ec57600080fd5b602083019150836020828501011115612c4557600080fd5b60008083601f84011261331657600080fd5b5081356001600160401b0381111561332d57600080fd5b6020830191508360208260051b8501011115612c4557600080fd5b6000806000806040858703121561335e57600080fd5b84356001600160401b038082111561337557600080fd5b613381888389016132c3565b9096509450602087013591508082111561339a57600080fd5b506133a787828801613304565b95989497509550505050565b600080602083850312156133c657600080fd5b82356001600160401b038111156133dc57600080fd5b6133e8858286016132c3565b90969095509350505050565b6000806020838503121561340757600080fd5b82356001600160401b0381111561341d57600080fd5b6133e885828601613304565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b8181101561121e57613494838551613429565b9284019260809290920191600101613481565b6000602082840312156134b957600080fd5b813561156581613211565b634e487b7160e01b600052602160045260246000fd5b60208101600483106134fc57634e487b7160e01b600052602160045260246000fd5b91905290565b6020808252825182820181905260009190848201906040850190845b8181101561121e5783518352928401929184019160010161351e565b60008060008060006060868803121561355257600080fd5b853561355d81613211565b945060208601356001600160401b038082111561357957600080fd5b61358589838a016132c3565b9096509450604088013591508082111561359e57600080fd5b506135ab88828901613304565b969995985093965092949392505050565b6000806000606084860312156135d157600080fd5b83356135dc81613211565b95602085013595506040909401359392505050565b8035801515811461360157600080fd5b919050565b6000806040838503121561361957600080fd5b823561362481613211565b9150613632602084016135f1565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156136795761367961363b565b604052919050565b6000806000806080858703121561369757600080fd5b84356136a281613211565b93506020858101356136b381613211565b93506040860135925060608601356001600160401b03808211156136d657600080fd5b818801915088601f8301126136ea57600080fd5b8135818111156136fc576136fc61363b565b61370e601f8201601f19168501613651565b9150808252898482850101111561372457600080fd5b808484018584013760008482840101525080935050505092959194509250565b608081016109c58284613429565b60008060006040848603121561376757600080fd5b83356001600160401b0381111561377d57600080fd5b613789868287016132c3565b909450925050602084013561379d81613211565b809150509250925092565b600080604083850312156137bb57600080fd5b82356137c681613211565b915060208301356132b881613211565b6000602082840312156137e857600080fd5b611565826135f1565b600181811c9082168061380557607f821691505b6020821081141561382657634e487b7160e01b600052602260045260246000fd5b50919050565b6000825161383e81846020870161318d565b9190910192915050565b8183823760009101908152919050565b60408152600061386b60408301866131b9565b8281036020840152838152838560208301376000602085830101526020601f19601f860116820101915050949350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156138de576138de6138b4565b5060010190565b600083516138f781846020880161318d565b83519083019061390b81836020880161318d565b01949350505050565b6000602080838503121561392757600080fd5b82516001600160401b038082111561393e57600080fd5b818501915085601f83011261395257600080fd5b8151818111156139645761396461363b565b8060051b9150613975848301613651565b818152918301840191848101908884111561398f57600080fd5b938501935b838510156139ad57845182529385019390850190613994565b98975050505050505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516139f181601785016020880161318d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613a2281602884016020880161318d565b01602801949350505050565b600060208284031215613a4057600080fd5b5051919050565b600082821015613a5957613a596138b4565b500390565b600060208284031215613a7057600080fd5b815161156581613211565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906118a3908301846131b9565b600060208284031215613ac057600080fd5b81516115658161315a565b6000816000190483118215151615613ae557613ae56138b4565b500290565b60008219821115613afd57613afd6138b4565b500190565b600081613b1157613b116138b4565b50600019019056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204d1bd18f22343ffae023f922e8cb70f50208dca9c330cb2c727f9c48450e453e64736f6c63430008090033000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b7000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000003868747470733a2f2f6d657461646174612e746572726170696e67656e657369732e636f6d2f746f6b656e2d756e6976657273652d6863702f00000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d000000000000000000000000b643c924632f71ac70a982ebc7e4099620f076c10000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d000000000000000000000000f1be574e5936bd41bcdfc54a4954f1d550d9498b

Deployed Bytecode

0x6080604052600436106102ff5760003560e01c80638462151c11610190578063c23dc68f116100dc578063de0ce17d11610095578063f26b6e1a1161006f578063f26b6e1a14610915578063f2fde38b14610935578063f4cc37bd14610955578063f5b541a61461098957600080fd5b8063de0ce17d146108c0578063e985e9c5146108d5578063ee1cc944146108f557600080fd5b8063c23dc68f146107fd578063c87b56dd1461082a578063d547741f1461084a578063d5abeb011461086a578063d875a72614610880578063dc33e681146108a057600080fd5b806395d89b4111610149578063a22cb46511610123578063a22cb46514610795578063a2309ff8146107b5578063b80f55c9146107ca578063b88d4fde146107ea57600080fd5b806395d89b411461074b57806399a2557a14610760578063a217fddf1461078057600080fd5b80638462151c1461069657806384eaa9b6146106c357806387f65c91146106e35780638a88487d146106f85780638da5cb5b1461070d57806391d148541461072b57600080fd5b8063390dad5f1161024f5780636352211e1161020857806370a08231116101e257806370a0823114610600578063715018a614610620578063794b2a07146106355780637fa46ab41461066257600080fd5b80636352211e146105a35780636c0360eb146105c3578063702d5394146105d857600080fd5b8063390dad5f146104c65780633ccfd60b146104fa57806342842e0e1461050f57806355f804b3146105225780635bbb2177146105425780636301dccf1461056f57600080fd5b80631a899744116102bc57806325fd90f31161029657806325fd90f31461044c5780632f2ff15d1461046657806336568abe14610486578063387b711d146104a657600080fd5b80631a899744146103e857806323b872dd14610408578063248a9ca31461041b57600080fd5b80630164f0881461030457806301ffc9a71461032c57806306fdde031461035c578063081812fc1461037e578063095ea7b3146103b657806318160ddd146103cb575b600080fd5b34801561031057600080fd5b50610319600281565b6040519081526020015b60405180910390f35b34801561033857600080fd5b5061034c610347366004613170565b6109ab565b6040519015158152602001610323565b34801561036857600080fd5b506103716109cb565b60405161032391906131e5565b34801561038a57600080fd5b5061039e6103993660046131f8565b610a5d565b6040516001600160a01b039091168152602001610323565b6103c96103c4366004613226565b610aa1565b005b3480156103d757600080fd5b506004546003540360001901610319565b3480156103f457600080fd5b5061034c6104033660046131f8565b610b41565b6103c9610416366004613252565b610b4e565b34801561042757600080fd5b506103196104363660046131f8565b6000908152600160208190526040909120015490565b34801561045857600080fd5b50600b5461034c9060ff1681565b34801561047257600080fd5b506103c9610481366004613293565b610cd7565b34801561049257600080fd5b506103c96104a1366004613293565b610d03565b3480156104b257600080fd5b506103c96104c1366004613348565b610d86565b3480156104d257600080fd5b506103197fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c81565b34801561050657600080fd5b506103c9610d99565b6103c961051d366004613252565b610db2565b34801561052e57600080fd5b506103c961053d3660046133b3565b610dcd565b34801561054e57600080fd5b5061056261055d3660046133f4565b610eb6565b6040516103239190613465565b34801561057b57600080fd5b506103197fe74c04bdb85741f90efadc0228949f2b97fc0c6a16334216c9bd13273891142b81565b3480156105af57600080fd5b5061039e6105be3660046131f8565b610f81565b3480156105cf57600080fd5b50610371610f8c565b3480156105e457600080fd5b5061039e731e0049783f008a0085193e00003d00cd54003c7181565b34801561060c57600080fd5b5061031961061b3660046134a7565b61101a565b34801561062c57600080fd5b506103c9611068565b34801561064157600080fd5b506106556106503660046131f8565b6110ce565b60405161032391906134da565b34801561066e57600080fd5b506103197f44ac9762eec3a11893fefb11d028bb3102560094137c3ed4518712475b2577cc81565b3480156106a257600080fd5b506106b66106b13660046134a7565b61111b565b6040516103239190613502565b3480156106cf57600080fd5b506103c96106de36600461353a565b61122a565b3480156106ef57600080fd5b50610319600181565b34801561070457600080fd5b506106b6611396565b34801561071957600080fd5b506000546001600160a01b031661039e565b34801561073757600080fd5b5061034c610746366004613293565b6113a7565b34801561075757600080fd5b506103716113d2565b34801561076c57600080fd5b506106b661077b3660046135bc565b6113e1565b34801561078c57600080fd5b50610319600081565b3480156107a157600080fd5b506103c96107b0366004613606565b61156c565b3480156107c157600080fd5b506103196115d8565b3480156107d657600080fd5b506103c96107e53660046133f4565b6115e7565b6103c96107f8366004613681565b611656565b34801561080957600080fd5b5061081d6108183660046131f8565b61169a565b6040516103239190613744565b34801561083657600080fd5b506103716108453660046131f8565b611722565b34801561085657600080fd5b506103c9610865366004613293565b6117a6565b34801561087657600080fd5b506103196107d081565b34801561088c57600080fd5b5061034c61089b366004613752565b6117cd565b3480156108ac57600080fd5b506103196108bb3660046134a7565b6118ad565b3480156108cc57600080fd5b5061039e600081565b3480156108e157600080fd5b5061034c6108f03660046137a8565b6118d7565b34801561090157600080fd5b506103c96109103660046137d6565b611945565b34801561092157600080fd5b506106b66109303660046134a7565b6119d6565b34801561094157600080fd5b506103c96109503660046134a7565b611c25565b34801561096157600080fd5b5061039e7f000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b781565b34801561099557600080fd5b50610319600080516020613b1a83398151915281565b60006109b682611ced565b806109c557506109c582611d3b565b92915050565b6060600580546109da906137f1565b80601f0160208091040260200160405190810160405280929190818152602001828054610a06906137f1565b8015610a535780601f10610a2857610100808354040283529160200191610a53565b820191906000526020600020905b815481529060010190602001808311610a3657829003601f168201915b5050505050905090565b6000610a6882611d70565b610a85576040516333d1c03960e21b815260040160405180910390fd5b506000908152600960205260409020546001600160a01b031690565b6000610aac82610f81565b9050336001600160a01b03821614610ae557610ac881336118d7565b610ae5576040516367d9dca160e11b815260040160405180910390fd5b60008281526009602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60006109c5600d83611da5565b6000610b5982611dbd565b9050836001600160a01b0316816001600160a01b031614610b8c5760405162a1148160e81b815260040160405180910390fd5b60008281526009602052604090208054610bb88187335b6001600160a01b039081169116811491141790565b610be357610bc686336118d7565b610be357604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610c0a57604051633a954ecd60e21b815260040160405180910390fd5b8015610c1557600082555b6001600160a01b038681166000908152600860205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260076020526040902055600160e11b8316610ca05760018401600081815260076020526040902054610c9e576003548114610c9e5760008181526007602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020613b3a83398151915260405160405180910390a4505050505050565b60008281526001602081905260409091200154610cf48133611e26565b610cfe8383611e8a565b505050565b6001600160a01b0381163314610d785760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610d828282611ef5565b5050565b610d93338585858561122a565b50505050565b6000610da58133611e26565b610daf3347611f5c565b50565b610cfe83838360405180602001604052806000815250611656565b600080516020613b1a833981519152610de68133611e26565b610dee612075565b604051602001610dfe919061382c565b604051602081830303815290604052805190602001208383604051602001610e27929190613848565b604051602081830303815290604052805190602001201415610e5c5760405163df82d43b60e01b815260040160405180910390fd5b6000610e66612075565b9050610e74600c85856130c1565b507f309b29ded109b9e28fb9885757b3e0096eb75c51d23aa4635d68bcd569f6adc1818585604051610ea893929190613858565b60405180910390a150505050565b6060816000816001600160401b03811115610ed357610ed361363b565b604051908082528060200260200182016040528015610f2557816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610ef15790505b50905060005b828114610f7857610f53868683818110610f4757610f4761389e565b9050602002013561169a565b828281518110610f6557610f6561389e565b6020908102919091010152600101610f2b565b50949350505050565b60006109c582611dbd565b600c8054610f99906137f1565b80601f0160208091040260200160405190810160405280929190818152602001828054610fc5906137f1565b80156110125780601f10610fe757610100808354040283529160200191611012565b820191906000526020600020905b815481529060010190602001808311610ff557829003601f168201915b505050505081565b60006001600160a01b038216611043576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600860205260409020546001600160401b031690565b6000546001600160a01b031633146110c25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d6f565b6110cc6000612084565b565b60006110d9826120d4565b15156001146110fb576040516307ed98ed60e31b815260040160405180910390fd5b611106600f83611da5565b1561111357506002919050565b506001919050565b6060600080600061112b8561101a565b90506000816001600160401b038111156111475761114761363b565b604051908082528060200260200182016040528015611170578160200160208202803683370190505b50905061119d60408051608081018252600080825260208201819052918101829052606081019190915290565b60015b83861461121e576111b0816120ea565b91508160400151156111c157611216565b81516001600160a01b0316156111d657815194505b876001600160a01b0316856001600160a01b0316141561121657808387806001019850815181106112095761120961389e565b6020026020010181815250505b6001016111a0565b50909695505050505050565b60028054141561127c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d6f565b60028055600b5460ff1615156001146112a85760405163914edb0f60e01b815260040160405180910390fd5b6112b0612126565b156112ce57604051638a164f6360e01b815260040160405180910390fd5b6112d982823361213f565b15156001146112fb5760405163a4633ea560e01b815260040160405180910390fd5b821561137f5761130a85612415565b1561132857604051630de2dc9360e41b815260040160405180910390fd5b611340600080516020613b1a833981519152336113a7565b1515600114611376576113548484336117cd565b151560011461137657604051638baa579f60e01b815260040160405180910390fd5b61137f85612422565b61138a85838361244e565b50506001600255505050565b60606113a2600d6124c7565b905090565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600680546109da906137f1565b606081831061140357604051631960ccad60e11b815260040160405180910390fd5b60008061140f60035490565b9050600185101561141f57600194505b8084111561142b578093505b60006114368761101a565b905084861015611455578585038181101561144f578091505b50611459565b5060005b6000816001600160401b038111156114735761147361363b565b60405190808252806020026020018201604052801561149c578160200160208202803683370190505b509050816114af57935061156592505050565b60006114ba8861169a565b9050600081604001516114cb575080515b885b8881141580156114dd5750848714155b15611559576114eb816120ea565b92508260400151156114fc57611551565b82516001600160a01b03161561151157825191505b8a6001600160a01b0316826001600160a01b0316141561155157808488806001019950815181106115445761154461389e565b6020026020010181815250505b6001016114cd565b50505092835250909150505b9392505050565b336000818152600a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60006113a26003546000190190565b7f44ac9762eec3a11893fefb11d028bb3102560094137c3ed4518712475b2577cc6116128133611e26565b60005b82811015610d935760008484838181106116315761163161389e565b9050602002013590506116458160006124d4565b5061164f816138ca565b9050611615565b611661848484610b4e565b6001600160a01b0383163b15610d935761167d84848484612606565b610d93576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806116f357506003548310155b156116fe5792915050565b611707836120ea565b90508060400151156117195792915050565b611565836126fd565b606061172d82611d70565b61174a57604051630a14c4b560e41b815260040160405180910390fd5b6000611754612075565b90508051600014156117755760405180602001604052806000815250611565565b8061177f84612732565b6040516020016117909291906138e5565b6040516020818303038152906040529392505050565b600082815260016020819052604090912001546117c38133611e26565b610cfe8383611ef5565b6000806118337fe74c04bdb85741f90efadc0228949f2b97fc0c6a16334216c9bd13273891142b846040516020016118189291909182526001600160a01b0316602082015260400190565b60405160208183030381529060405280519060200120612780565b905060006118778287878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506127ce92505050565b90506118a37fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c826113a7565b9695505050505050565b6001600160a01b038116600090815260086020526040808220546001600160401b03911c166109c5565b6001600160a01b038083166000908152600a6020908152604080832093851683529290529081205460ff161561190f575060016109c5565b6001600160a01b038216731e0049783f008a0085193e00003d00cd54003c71141561193c575060016109c5565b50600092915050565b600080516020613b1a83398151915261195e8133611e26565b600b5460ff16151582151514156119885760405163df82d43b60e01b815260040160405180910390fd5b600b805460ff191683151590811790915560405160ff909116151581527f4f6846e1a6a026ffba330735c9ca2845cfe23bccb44541d241c637b8542fa7a09060200160405180910390a15050565b60607f000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b76001600160a01b0316611a1f57604051636f2c3cd960e01b815260040160405180910390fd5b604051632118854760e21b81526001600160a01b0383811660048301526000917f000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b790911690638462151c9060240160006040518083038186803b158015611a8557600080fd5b505afa158015611a99573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ac19190810190613914565b9050600081516001600160401b03811115611ade57611ade61363b565b604051908082528060200260200182016040528015611b07578160200160208202803683370190505b5090506000805b8251811015611b82576000848281518110611b2b57611b2b61389e565b60200260200101519050611b3e81610b41565b1515600114611b715780848481518110611b5a57611b5a61389e565b6020908102919091010152611b6e836138ca565b92505b50611b7b816138ca565b9050611b0e565b506000816001600160401b03811115611b9d57611b9d61363b565b604051908082528060200260200182016040528015611bc6578160200160208202803683370190505b50905060005b82811015611c1b57838181518110611be657611be661389e565b6020026020010151828281518110611c0057611c0061389e565b6020908102919091010152611c14816138ca565b9050611bcc565b5095945050505050565b6000546001600160a01b03163314611c7f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d6f565b6001600160a01b038116611ce45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d6f565b610daf81612084565b60006301ffc9a760e01b6001600160e01b031983161480611d1e57506380ac58cd60e01b6001600160e01b03198316145b806109c55750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216637965db0b60e01b14806109c557506301ffc9a760e01b6001600160e01b03198316146109c5565b600081600111158015611d84575060035482105b80156109c5575050600090815260076020526040902054600160e01b161590565b60008181526001830160205260408120541515611565565b60008180600111611e0d57600354811015611e0d57600081815260076020526040902054600160e01b8116611e0b575b80611565575060001901600081815260076020526040902054611ded565b505b604051636f96cda160e11b815260040160405180910390fd5b611e3082826113a7565b610d8257611e48816001600160a01b031660146127f2565b611e538360206127f2565b604051602001611e649291906139b9565b60408051601f198184030181529082905262461bcd60e51b8252610d6f916004016131e5565b611e9482826113a7565b610d825760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b611eff82826113a7565b15610d825760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b80471015611fac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610d6f565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611ff9576040519150601f19603f3d011682016040523d82523d6000602084013e611ffe565b606091505b5050905080610cfe5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610d6f565b6060600c80546109da906137f1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000600182101580156109c55750506003541190565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600760205260409020546109c59061298d565b60006107d06121386003546000190190565b1015905090565b60007f000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b76001600160a01b031661218857604051636f2c3cd960e01b815260040160405180910390fd5b60006001905060007f000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b76001600160a01b031663d5abeb016040518163ffffffff1660e01b815260040160206040518083038186803b1580156121e957600080fd5b505afa1580156121fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122219190613a2e565b6001600160401b038111156122385761223861363b565b604051908082528060200260200182016040528015612261578160200160208202803683370190505b50905060005b85811080156122735750825b1561240a57600087878381811061228c5761228c61389e565b905060200201359050600061229f600190565b6122a99083613a47565b905060006122c5600080516020613b1a833981519152896113a7565b8061237e5750876001600160a01b03167f000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b76001600160a01b0316636352211e856040518263ffffffff1660e01b815260040161232391815260200190565b60206040518083038186803b15801561233b57600080fd5b505afa15801561234f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123739190613a5e565b6001600160a01b0316145b9050600061238d600d85611da5565b1515600115151415905060008684815181106123ab576123ab61389e565b60209081029190910101511590508280156123c35750815b80156123cc5750805b975060018785815181106123e2576123e261389e565b602002602001019015159081151581525050505050505080612403906138ca565b9050612267565b509095945050505050565b60006109c56011836129d4565b61243661242e60035490565b600f906129f6565b50612442601182612a02565b50610daf816001612a17565b600260005b82811080156124625750600282145b156124c0576124716002612a31565b915081156124b0576124a584848381811061248e5761248e61389e565b90506020020135600d6129f690919063ffffffff16565b506124b08583612a17565b6124b9816138ca565b9050612453565b5050505050565b6060600061156583612a59565b60006124df83611dbd565b9050806000806124fd86600090815260096020526040902080549091565b91509150841561253d57612512818433610ba3565b61253d5761252083336118d7565b61253d57604051632ce44b5f60e11b815260040160405180910390fd5b801561254857600082555b6001600160a01b038316600081815260086020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260076020526040902055600160e11b84166125cf57600186016000818152600760205260409020546125cd5760035481146125cd5760008181526007602052604090208590555b505b60405186906000906001600160a01b03861690600080516020613b3a833981519152908390a4505060048054600101905550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061263b903390899088908890600401613a7b565b602060405180830381600087803b15801561265557600080fd5b505af1925050508015612685575060408051601f3d908101601f1916820190925261268291810190613aae565b60015b6126e0573d8080156126b3576040519150601f19603f3d011682016040523d82523d6000602084013e6126b8565b606091505b5080516126d8576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6040805160808101825260008082526020820181905291810182905260608101919091526109c561272d83611dbd565b61298d565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806127695761276e565b61274c565b50819003601f19909101908152919050565b60006109c561278d612ab5565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b60008060006127dd8585612bdc565b915091506127ea81612c4c565b509392505050565b60606000612801836002613acb565b61280c906002613aea565b6001600160401b038111156128235761282361363b565b6040519080825280601f01601f19166020018201604052801561284d576020820181803683370190505b509050600360fc1b816000815181106128685761286861389e565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106128975761289761389e565b60200101906001600160f81b031916908160001a90535060006128bb846002613acb565b6128c6906001613aea565b90505b600181111561293e576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106128fa576128fa61389e565b1a60f81b8282815181106129105761291061389e565b60200101906001600160f81b031916908160001a90535060049490941c9361293781613b02565b90506128c9565b5083156115655760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610d6f565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6001600160a01b03811660009081526001830160205260408120541515611565565b60006115658383612e07565b6000611565836001600160a01b038416612e07565b610d82828260405180602001604052806000815250612e56565b600080612a416003546000190190565b612a4d906107d0613a47565b90506115658382612ebc565b606081600001805480602002602001604051908101604052809291908181526020018280548015612aa957602002820191906000526020600020905b815481526020019060010190808311612a95575b50505050509050919050565b6000306001600160a01b037f0000000000000000000000006ab3dcca416ab4a8a1c94da71e4d60b321779c2c16148015612b0e57507f000000000000000000000000000000000000000000000000000000000000000146145b15612b3857507f2615fbb95abfa48ce58f0804a7ade4684118fa16e8671043c725ff73006f5b8c90565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f8a845f7ec246fc1224124e3c907ef345361a70abc52c347aea4e63d502b67484828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600080825160411415612c135760208301516040840151606085015160001a612c0787828585612ed2565b94509450505050612c45565b825160401415612c3d5760208301516040840151612c32868383612fbf565b935093505050612c45565b506000905060025b9250929050565b6000816004811115612c6057612c606134c4565b1415612c695750565b6001816004811115612c7d57612c7d6134c4565b1415612ccb5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610d6f565b6002816004811115612cdf57612cdf6134c4565b1415612d2d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610d6f565b6003816004811115612d4157612d416134c4565b1415612d9a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610d6f565b6004816004811115612dae57612dae6134c4565b1415610daf5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610d6f565b6000818152600183016020526040812054612e4e575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556109c5565b5060006109c5565b612e608383612fee565b6001600160a01b0383163b15610cfe576003548281035b612e8a6000868380600101945086612606565b612ea7576040516368d2bf6b60e11b815260040160405180910390fd5b818110612e775781600354146124c057600080fd5b6000818310612ecb5781611565565b5090919050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612f095750600090506003612fb6565b8460ff16601b14158015612f2157508460ff16601c14155b15612f325750600090506004612fb6565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612f86573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612faf57600060019250925050612fb6565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b01612fe087828885612ed2565b935093505050935093915050565b6003548161300f5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526008602090815260408083208054680100000000000000018802019055848352600790915281206001851460e11b4260a01b17831790558284019083908390600080516020613b3a8339815191528180a4600183015b81811461309a5780836000600080516020613b3a833981519152600080a4600101613074565b50816130b857604051622e076360e81b815260040160405180910390fd5b60035550505050565b8280546130cd906137f1565b90600052602060002090601f0160209004810192826130ef5760008555613135565b82601f106131085782800160ff19823516178555613135565b82800160010185558215613135579182015b8281111561313557823582559160200191906001019061311a565b50613141929150613145565b5090565b5b808211156131415760008155600101613146565b6001600160e01b031981168114610daf57600080fd5b60006020828403121561318257600080fd5b81356115658161315a565b60005b838110156131a8578181015183820152602001613190565b83811115610d935750506000910152565b600081518084526131d181602086016020860161318d565b601f01601f19169290920160200192915050565b60208152600061156560208301846131b9565b60006020828403121561320a57600080fd5b5035919050565b6001600160a01b0381168114610daf57600080fd5b6000806040838503121561323957600080fd5b823561324481613211565b946020939093013593505050565b60008060006060848603121561326757600080fd5b833561327281613211565b9250602084013561328281613211565b929592945050506040919091013590565b600080604083850312156132a657600080fd5b8235915060208301356132b881613211565b809150509250929050565b60008083601f8401126132d557600080fd5b5081356001600160401b038111156132ec57600080fd5b602083019150836020828501011115612c4557600080fd5b60008083601f84011261331657600080fd5b5081356001600160401b0381111561332d57600080fd5b6020830191508360208260051b8501011115612c4557600080fd5b6000806000806040858703121561335e57600080fd5b84356001600160401b038082111561337557600080fd5b613381888389016132c3565b9096509450602087013591508082111561339a57600080fd5b506133a787828801613304565b95989497509550505050565b600080602083850312156133c657600080fd5b82356001600160401b038111156133dc57600080fd5b6133e8858286016132c3565b90969095509350505050565b6000806020838503121561340757600080fd5b82356001600160401b0381111561341d57600080fd5b6133e885828601613304565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b8181101561121e57613494838551613429565b9284019260809290920191600101613481565b6000602082840312156134b957600080fd5b813561156581613211565b634e487b7160e01b600052602160045260246000fd5b60208101600483106134fc57634e487b7160e01b600052602160045260246000fd5b91905290565b6020808252825182820181905260009190848201906040850190845b8181101561121e5783518352928401929184019160010161351e565b60008060008060006060868803121561355257600080fd5b853561355d81613211565b945060208601356001600160401b038082111561357957600080fd5b61358589838a016132c3565b9096509450604088013591508082111561359e57600080fd5b506135ab88828901613304565b969995985093965092949392505050565b6000806000606084860312156135d157600080fd5b83356135dc81613211565b95602085013595506040909401359392505050565b8035801515811461360157600080fd5b919050565b6000806040838503121561361957600080fd5b823561362481613211565b9150613632602084016135f1565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156136795761367961363b565b604052919050565b6000806000806080858703121561369757600080fd5b84356136a281613211565b93506020858101356136b381613211565b93506040860135925060608601356001600160401b03808211156136d657600080fd5b818801915088601f8301126136ea57600080fd5b8135818111156136fc576136fc61363b565b61370e601f8201601f19168501613651565b9150808252898482850101111561372457600080fd5b808484018584013760008482840101525080935050505092959194509250565b608081016109c58284613429565b60008060006040848603121561376757600080fd5b83356001600160401b0381111561377d57600080fd5b613789868287016132c3565b909450925050602084013561379d81613211565b809150509250925092565b600080604083850312156137bb57600080fd5b82356137c681613211565b915060208301356132b881613211565b6000602082840312156137e857600080fd5b611565826135f1565b600181811c9082168061380557607f821691505b6020821081141561382657634e487b7160e01b600052602260045260246000fd5b50919050565b6000825161383e81846020870161318d565b9190910192915050565b8183823760009101908152919050565b60408152600061386b60408301866131b9565b8281036020840152838152838560208301376000602085830101526020601f19601f860116820101915050949350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156138de576138de6138b4565b5060010190565b600083516138f781846020880161318d565b83519083019061390b81836020880161318d565b01949350505050565b6000602080838503121561392757600080fd5b82516001600160401b038082111561393e57600080fd5b818501915085601f83011261395257600080fd5b8151818111156139645761396461363b565b8060051b9150613975848301613651565b818152918301840191848101908884111561398f57600080fd5b938501935b838510156139ad57845182529385019390850190613994565b98975050505050505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516139f181601785016020880161318d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613a2281602884016020880161318d565b01602801949350505050565b600060208284031215613a4057600080fd5b5051919050565b600082821015613a5957613a596138b4565b500390565b600060208284031215613a7057600080fd5b815161156581613211565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906118a3908301846131b9565b600060208284031215613ac057600080fd5b81516115658161315a565b6000816000190483118215151615613ae557613ae56138b4565b500290565b60008219821115613afd57613afd6138b4565b500190565b600081613b1157613b116138b4565b50600019019056fe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204d1bd18f22343ffae023f922e8cb70f50208dca9c330cb2c727f9c48450e453e64736f6c63430008090033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b7000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000003868747470733a2f2f6d657461646174612e746572726170696e67656e657369732e636f6d2f746f6b656e2d756e6976657273652d6863702f00000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d000000000000000000000000b643c924632f71ac70a982ebc7e4099620f076c10000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d000000000000000000000000f1be574e5936bd41bcdfc54a4954f1d550d9498b

-----Decoded View---------------
Arg [0] : terrapinGenesis_ (address): 0xf68f9Bf35312C228c9D213f31c477c92032d80b7
Arg [1] : baseURI_ (string): https://metadata.terrapingenesis.com/token-universe-hcp/
Arg [2] : operators (address[]): 0xC329D2dC3685eD3BE3209b33DAF37f60347c969d,0xb643c924632f71ac70a982Ebc7E4099620f076C1
Arg [3] : mintSigners (address[]): 0xC329D2dC3685eD3BE3209b33DAF37f60347c969d,0xf1Be574E5936BD41bCdfc54A4954F1d550d9498B

-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b7
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000038
Arg [5] : 68747470733a2f2f6d657461646174612e746572726170696e67656e65736973
Arg [6] : 2e636f6d2f746f6b656e2d756e6976657273652d6863702f0000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [8] : 000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d
Arg [9] : 000000000000000000000000b643c924632f71ac70a982ebc7e4099620f076c1
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [11] : 000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d
Arg [12] : 000000000000000000000000f1be574e5936bd41bcdfc54a4954f1d550d9498b


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.