ETH Price: $2,022.30 (-1.31%)

Contract

0xF398303b3e682f930b063Ab093C29E50C5eB533E
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SignPass

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 26 : SignPass.sol
// SPDX-License-Identifier: UNLICENSED
// solhint-disable max-line-length
pragma solidity ^0.8.24;

import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import { ERC721AQueryableUpgradeable } from "erc721a-upgradeable/contracts/extensions/ERC721AQueryableUpgradeable.sol";
import { ERC721AUpgradeable } from "erc721a-upgradeable/contracts/ERC721AUpgradeable.sol";
import { IERC721AUpgradeable } from "erc721a-upgradeable/contracts/IERC721AUpgradeable.sol";
import { ISP } from "@ethsign/sign-protocol-evm/src/interfaces/ISP.sol";
import { ISPHook } from "@ethsign/sign-protocol-evm/src/interfaces/ISPHook.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC6066 } from "./IERC6066.sol";
import { IERC1271 } from "@openzeppelin/contracts/interfaces/IERC1271.sol";

contract SignPass is OwnableUpgradeable, UUPSUpgradeable, ERC721AQueryableUpgradeable, ISPHook, IERC6066, IERC1271 {
    uint256 public constant MAX_TOTAL_SUPPLY = 1000;

    // keccak256(abi.encode(uint256(keccak256("ethsign.misc.SignPass")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant SignPassStorageLocation =
        0xb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc00;

    /// @custom:storage-location erc7201:ethsign.misc.SignPass
    struct SignPassStorage {
        address spInstance;
        uint64 approvedSpSchemaId;
        address approvedSpAttester;
        string baseURI;
        mapping(uint256 tokenId => bool transferable) isUntransferable;
        mapping(uint256 tokenId => mapping(bytes32 hash => bool approved)) _erc6066;
        string unifiedURI;
    }

    error OverMint();
    error Unsupported();
    error InvalidData();
    error LowLevelCallError(bytes data);

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        if (block.chainid != 31_337) _disableInitializers();
    }

    function initialize() external initializer initializerERC721A {
        __ERC721A_init_unchained("SignPass", "SIGNPASS");
        __Ownable_init_unchained(_msgSender());
    }

    function setSignProtocolConfig(
        address spInstance,
        uint64 approvedSpSchemaId,
        address approvedSpAttester
    )
        external
        onlyOwner
    {
        SignPassStorage storage $ = _getSignPassStorage();
        $.spInstance = spInstance;
        $.approvedSpSchemaId = approvedSpSchemaId;
        $.approvedSpAttester = approvedSpAttester;
    }

    function setBaseURI(string calldata baseURI) external onlyOwner {
        _getSignPassStorage().baseURI = baseURI;
    }

    function setUnifiedURI(string calldata unifiedURI) external onlyOwner {
        _getSignPassStorage().unifiedURI = unifiedURI;
    }

    function safeMint(address to, uint256 quantity) external onlyOwner {
        _safeMint(to, quantity);
    }

    function safeTransferFrom(address from, address to, uint256[] calldata tokenIds) external {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            safeTransferFrom(from, to, tokenIds[i], "");
        }
    }

    function sign(uint256 tokenId, bytes32 hash, bool approved) external {
        if (ownerOf(tokenId) != _msgSenderERC721A()) revert Unsupported();
        _getSignPassStorage()._erc6066[tokenId][hash] = approved;
        emit ERC6066Signed(ownerOf(tokenId), tokenId, hash, approved);
    }

    function withdrawETH() external onlyOwner {
        (bool success, bytes memory data) = owner().call{ value: address(this).balance }("");
        if (!success) revert LowLevelCallError(data);
    }

    function didReceiveAttestation(
        address attester,
        uint64 schemaId,
        uint64 attestationId,
        bytes calldata extraData
    )
        external
        payable
    {
        _getSignPassStorage().isUntransferable[_checkAndGetTokenIdFromHook(
            _msgSender(), attester, schemaId, attestationId, extraData
        )] = true;
    }

    function didReceiveRevocation(
        address attester,
        uint64 schemaId,
        uint64 attestationId,
        bytes calldata extraData
    )
        external
        payable
    {
        _getSignPassStorage().isUntransferable[_checkAndGetTokenIdFromHook(
            _msgSender(), attester, schemaId, attestationId, extraData
        )] = false;
    }

    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue) {
        uint256 tokenId = abi.decode(signature, (uint256));
        return isValidSignature(tokenId, hash, "");
    }

    function didReceiveRevocation(address, uint64, uint64, IERC20, uint256, bytes calldata) external pure override {
        revert Unsupported();
    }

    function didReceiveAttestation(address, uint64, uint64, IERC20, uint256, bytes calldata) external pure override {
        revert Unsupported();
    }

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    )
        public
        payable
        virtual
        override(ERC721AUpgradeable, IERC721AUpgradeable)
    {
        if (_getSignPassStorage().isUntransferable[tokenId]) revert Unsupported();
        ERC721AUpgradeable.transferFrom(from, to, tokenId);
    }

    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override(ERC721AUpgradeable, IERC721AUpgradeable)
        returns (string memory)
    {
        if (!_exists(tokenId)) _revert(URIQueryForNonexistentToken.selector);

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

    function isValidSignature(uint256 tokenId, bytes32 hash, bytes memory) public view returns (bytes4 magicValue) {
        return _getSignPassStorage()._erc6066[tokenId][hash] ? IERC6066.isValidSignature.selector : bytes4(0);
    }

    function _mint(address to, uint256 quantity) internal override {
        if (totalSupply() + quantity > MAX_TOTAL_SUPPLY) revert OverMint();
        super._mint(to, quantity);
    }

    function _checkAndGetTokenIdFromHook(
        address sender,
        address attester,
        uint64 schemaId,
        uint64 attestationId,
        bytes calldata extraData
    )
        internal
        view
        returns (uint256 tokenId)
    {
        SignPassStorage storage $ = _getSignPassStorage();
        if (sender != $.spInstance || schemaId != $.approvedSpSchemaId || attester != $.approvedSpAttester) {
            revert Unsupported();
        }
        address recipient = abi.decode(ISP($.spInstance).getAttestation(attestationId).recipients[0], (address));
        tokenId = abi.decode(extraData, (uint256));
        if (ownerOf(tokenId) != recipient) revert InvalidData();
    }

    // solhint-disable-next-line no-empty-blocks
    function _authorizeUpgrade(address newImplementation) internal virtual override onlyOwner { }

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

    function _getSignPassStorage() internal pure returns (SignPassStorage storage $) {
        assembly {
            $.slot := SignPassStorageLocation
        }
    }
}

File 2 of 26 : ISP.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import { IVersionable } from "./IVersionable.sol";
import { Schema } from "../models/Schema.sol";
import { Attestation, OffchainAttestation } from "../models/Attestation.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 * @title Sign Protocol Interface
 * @author Jack Xu @ EthSign
 */
interface ISP is IVersionable {
    event SchemaRegistered(uint64 schemaId);
    event AttestationMade(uint64 attestationId, string indexingKey);
    event AttestationRevoked(uint64 attestationId, string reason);
    event OffchainAttestationMade(string attestationId);
    event OffchainAttestationRevoked(string attestationId, string reason);

    /**
     * @dev 0x9e87fac8
     */
    error Paused();
    /**
     * @dev 0x38f8c6c4
     */
    error SchemaNonexistent();
    /**
     * @dev 0x71984561
     */
    error SchemaWrongRegistrant();
    /**
     * @dev 0x8ac42f49
     */
    error AttestationIrrevocable();
    /**
     * @dev 0x54681a13
     */
    error AttestationNonexistent();
    /**
     * @dev 0xa65e02ed
     */
    error AttestationInvalidDuration();
    /**
     * @dev 0xd8c3da86
     */
    error AttestationAlreadyRevoked();
    /**
     * @dev 0xa9ad2007
     */
    error AttestationWrongAttester();
    /**
     * @dev 0xc83e3cdf
     */
    error OffchainAttestationExists();
    /**
     * @dev 0xa006519a
     */
    error OffchainAttestationNonexistent();
    /**
     * @dev 0xa0671d20
     */
    error OffchainAttestationAlreadyRevoked();
    /**
     * @dev 0xfdf4e6f9
     */
    error InvalidDelegateSignature();
    /**
     * @dev 0x5c34b9cc
     */
    error LegacySPRequired();

    /**
     * @notice Registers a Schema.
     * @dev Emits `SchemaRegistered`.
     * @param schema See `Schema`.
     * @param delegateSignature An optional ECDSA delegateSignature if this is a delegated attestation. Use `""` or `0x`
     * otherwise.
     * @return schemaId The assigned ID of the registered schema.
     */
    function register(Schema memory schema, bytes calldata delegateSignature) external returns (uint64 schemaId);

    /**
     * @notice Makes an attestation.
     * @dev Emits `AttestationMade`.
     * @param attestation See `Attestation`.
     * @param indexingKey Used by the frontend to aid indexing.
     * @param delegateSignature An optional ECDSA delegateSignature if this is a delegated attestation. Use `""` or `0x`
     * otherwise.
     * @param extraData This is forwarded to the resolver directly.
     * @return attestationId The assigned ID of the attestation.
     */
    function attest(
        Attestation calldata attestation,
        string calldata indexingKey,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external
        returns (uint64 attestationId);

    /**
     * @notice Makes an attestation where the schema hook expects ETH payment.
     * @dev Emits `AttestationMade`.
     * @param attestation See `Attestation`.
     * @param resolverFeesETH Amount of funds to send to the hook.
     * @param indexingKey Used by the frontend to aid indexing.
     * @param delegateSignature An optional ECDSA delegateSignature if this is a delegated attestation. Use `""` or `0x`
     * otherwise.
     * @param extraData This is forwarded to the resolver directly.
     * @return attestationId The assigned ID of the attestation.
     */
    function attest(
        Attestation calldata attestation,
        uint256 resolverFeesETH,
        string calldata indexingKey,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external
        payable
        returns (uint64 attestationId);

    /**
     * @notice Makes an attestation where the schema hook expects ERC20 payment.
     * @dev Emits `AttestationMade`.
     * @param attestation See `Attestation`.
     * @param resolverFeesERC20Token ERC20 token address used for payment.
     * @param resolverFeesERC20Amount Amount of funds to send to the hook.
     * @param indexingKey Used by the frontend to aid indexing.
     * @param delegateSignature An optional ECDSA delegateSignature if this is a delegated attestation. Use `""` or `0x`
     * otherwise.
     * @param extraData This is forwarded to the resolver directly.
     * @return attestationId The assigned ID of the attestation.
     */
    function attest(
        Attestation calldata attestation,
        IERC20 resolverFeesERC20Token,
        uint256 resolverFeesERC20Amount,
        string calldata indexingKey,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external
        returns (uint64 attestationId);

    /**
     * @notice Timestamps an off-chain data ID.
     * @dev Emits `OffchainAttestationMade`.
     * @param offchainAttestationId The off-chain data ID.
     * @param delegateAttester An optional delegated attester that authorized the caller to attest on their behalf if
     * this is a delegated attestation. Use `address(0)` otherwise.
     * @param delegateSignature An optional ECDSA delegateSignature if this is a delegated attestation. Use `""` or `0x`
     * otherwise. Use `""` or `0x` otherwise.
     */
    function attestOffchain(
        string calldata offchainAttestationId,
        address delegateAttester,
        bytes calldata delegateSignature
    )
        external;

    /**
     * @notice Revokes an existing revocable attestation.
     * @dev Emits `AttestationRevoked`. Must be called by the attester.
     * @param attestationId An existing attestation ID.
     * @param reason The revocation reason. This is only emitted as an event to save gas.
     * @param delegateSignature An optional ECDSA delegateSignature if this is a delegated revocation.
     * @param extraData This is forwarded to the resolver directly.
     */
    function revoke(
        uint64 attestationId,
        string calldata reason,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external;

    /**
     * @notice Revokes an existing revocable attestation where the schema hook expects ERC20 payment.
     * @dev Emits `AttestationRevoked`. Must be called by the attester.
     * @param attestationId An existing attestation ID.
     * @param reason The revocation reason. This is only emitted as an event to save gas.
     * @param resolverFeesETH Amount of funds to send to the hook.
     * @param delegateSignature An optional ECDSA delegateSignature if this is a delegated revocation.
     * @param extraData This is forwarded to the resolver directly.
     */
    function revoke(
        uint64 attestationId,
        string calldata reason,
        uint256 resolverFeesETH,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external
        payable;

    /**
     * @notice Revokes an existing revocable attestation where the schema hook expects ERC20 payment.
     * @dev Emits `AttestationRevoked`. Must be called by the attester.
     * @param attestationId An existing attestation ID.
     * @param reason The revocation reason. This is only emitted as an event to save gas.
     * @param resolverFeesERC20Token ERC20 token address used for payment.
     * @param resolverFeesERC20Amount Amount of funds to send to the hook.
     * @param delegateSignature An optional ECDSA delegateSignature if this is a delegated revocation.
     * @param extraData This is forwarded to the resolver directly.
     */
    function revoke(
        uint64 attestationId,
        string calldata reason,
        IERC20 resolverFeesERC20Token,
        uint256 resolverFeesERC20Amount,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external;

    /**
     * @notice Revokes an existing offchain attestation.
     * @dev Emits `OffchainAttestationRevoked`. Must be called by the attester.
     * @param offchainAttestationId An existing attestation ID.
     * @param reason The revocation reason. This is only emitted as an event to save gas.
     * @param delegateSignature An optional ECDSA delegateSignature if this is a delegated revocation.
     */
    function revokeOffchain(
        string calldata offchainAttestationId,
        string calldata reason,
        bytes calldata delegateSignature
    )
        external;

    /**
     * @notice Batch registers a Schema.
     */
    function registerBatch(
        Schema[] calldata schemas,
        bytes calldata delegateSignature
    )
        external
        returns (uint64[] calldata schemaIds);

    /**
     * @notice Batch attests.
     */
    function attestBatch(
        Attestation[] calldata attestations,
        string[] calldata indexingKeys,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external
        returns (uint64[] calldata attestationIds);

    /**
     * @notice Batch attests where the schema hook expects ETH payment.
     */
    function attestBatch(
        Attestation[] calldata attestations,
        uint256[] calldata resolverFeesETH,
        string[] calldata indexingKeys,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external
        payable
        returns (uint64[] calldata attestationIds);

    /**
     * @notice Batch attests where the schema hook expects ERC20 payment.
     */
    function attestBatch(
        Attestation[] calldata attestations,
        IERC20[] calldata resolverFeesERC20Tokens,
        uint256[] calldata resolverFeesERC20Amount,
        string[] calldata indexingKeys,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external
        returns (uint64[] calldata attestationIds);

    /**
     * @notice Batch timestamps off-chain data IDs.
     */
    function attestOffchainBatch(
        string[] calldata offchainAttestationIds,
        address delegateAttester,
        bytes calldata delegateSignature
    )
        external;

    /**
     * @notice Batch revokes revocable on-chain attestations.
     */
    function revokeBatch(
        uint64[] calldata attestationIds,
        string[] calldata reasons,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external;

    /**
     * @notice Batch revokes revocable on-chain attestations where the schema hook expects ETH payment.
     */
    function revokeBatch(
        uint64[] calldata attestationIds,
        string[] calldata reasons,
        uint256[] calldata resolverFeesETH,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external
        payable;

    /**
     * @notice Batch revokes revocable on-chain attestations where the schema hook expects ERC20 payment.
     */
    function revokeBatch(
        uint64[] calldata attestationIds,
        string[] calldata reasons,
        IERC20[] calldata resolverFeesERC20Tokens,
        uint256[] calldata resolverFeesERC20Amount,
        bytes calldata delegateSignature,
        bytes calldata extraData
    )
        external;

    /**
     * @notice Batch revokes off-chain attestations.
     */
    function revokeOffchainBatch(
        string[] calldata offchainAttestationIds,
        string[] calldata reasons,
        bytes calldata delegateSignature
    )
        external;

    /**
     * @notice Returns the specified `Schema`.
     */
    function getSchema(uint64 schemaId) external view returns (Schema calldata);

    /**
     * @notice Returns the specified `Attestation`.
     */
    function getAttestation(uint64 attestationId) external view returns (Attestation calldata);

    /**
     * @notice Returns the specified `OffchainAttestation`.
     */
    function getOffchainAttestation(string calldata offchainAttestationId)
        external
        view
        returns (OffchainAttestation calldata);

    /**
     * @notice Returns the hash that will be used to authorize a delegated registration.
     */
    function getDelegatedRegisterHash(Schema memory schema) external pure returns (bytes32);

    /**
     * @notice Returns the hash that will be used to authorize a delegated batch registration.
     */
    function getDelegatedRegisterBatchHash(Schema[] memory schemas) external pure returns (bytes32);

    /**
     * @notice Returns the hash that will be used to authorize a delegated attestation.
     */
    function getDelegatedAttestHash(Attestation calldata attestation) external pure returns (bytes32);

    /**
     * @notice Returns the hash that will be used to authorize a delegated batch attestation.
     */
    function getDelegatedAttestBatchHash(Attestation[] calldata attestations) external pure returns (bytes32);

    /**
     * @notice Returns the hash that will be used to authorize a delegated offchain attestation.
     */
    function getDelegatedOffchainAttestHash(string calldata offchainAttestationId) external pure returns (bytes32);

    /**
     * @notice Returns the hash that will be used to authorize a delegated batch offchain attestation.
     */
    function getDelegatedOffchainAttestBatchHash(string[] calldata offchainAttestationIds)
        external
        pure
        returns (bytes32);

    /**
     * @notice Returns the hash that will be used to authorize a delegated revocation.
     */
    function getDelegatedRevokeHash(uint64 attestationId, string memory reason) external pure returns (bytes32);

    /**
     * @notice Returns the hash that will be used to authorize a delegated batch revocation.
     */
    function getDelegatedRevokeBatchHash(
        uint64[] memory attestationIds,
        string[] memory reasons
    )
        external
        pure
        returns (bytes32);

    /**
     * @notice Returns the hash that will be used to authorize a delegated offchain revocation.
     */
    function getDelegatedOffchainRevokeHash(
        string memory offchainAttestationId,
        string memory reason
    )
        external
        pure
        returns (bytes32);

    /**
     * @notice Returns the hash that will be used to authorize a delegated batch offchain revocation.
     */
    function getDelegatedOffchainRevokeBatchHash(
        string[] memory offchainAttestationIds,
        string[] memory reasons
    )
        external
        pure
        returns (bytes32);

    /**
     * @notice Returns the current schema counter. This is incremented for each `Schema` registered.
     */
    function schemaCounter() external view returns (uint64);

    /**
     * @notice Returns the current on-chain attestation counter. This is incremented for each `Attestation` made.
     */
    function attestationCounter() external view returns (uint64);
}

File 3 of 26 : ISPHook.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 * @title SIGN Attestation Protocol Resolver Interface
 * @author Jack Xu @ EthSign
 */
interface ISPHook {
    function didReceiveAttestation(
        address attester,
        uint64 schemaId,
        uint64 attestationId,
        bytes calldata extraData
    )
        external
        payable;

    function didReceiveAttestation(
        address attester,
        uint64 schemaId,
        uint64 attestationId,
        IERC20 resolverFeeERC20Token,
        uint256 resolverFeeERC20Amount,
        bytes calldata extraData
    )
        external;

    function didReceiveRevocation(
        address attester,
        uint64 schemaId,
        uint64 attestationId,
        bytes calldata extraData
    )
        external
        payable;

    function didReceiveRevocation(
        address attester,
        uint64 schemaId,
        uint64 attestationId,
        IERC20 resolverFeeERC20Token,
        uint256 resolverFeeERC20Amount,
        bytes calldata extraData
    )
        external;
}

File 4 of 26 : IVersionable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title IVersionable
 * @author Jack Xu @ EthSign
 * @dev This interface helps contracts to keep track of their versioning for upgrade compatibility checks.
 */
interface IVersionable {
    function version() external pure returns (string memory);
}

File 5 of 26 : Attestation.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

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

/**
 * @title Attestation
 * @author Jack Xu @ EthSign
 * @notice This struct represents an on-chain attestation record. This record is not deleted after revocation.
 *
 * `schemaId`: The `Schema` that this Attestation is based on. It must exist.
 * `linkedAttestationId`: Useful if the current Attestation references a previous Attestation. It can either be 0 or an
 * existing attestation ID.
 * `attestTimestamp`: When the attestation was made. This is automatically populated by `_attest(...)`.
 * `revokeTimestamp`: When the attestation was revoked. This is automatically populated by `_revoke(...)`.
 * `attester`: The attester. At this time, the attester must be the caller of `attest()`.
 * `validUntil`: The expiration timestamp of the Attestation. Must respect `Schema.maxValidFor`. 0 indicates no
 * expiration date.
 * `dataLocation`: Where `Attestation.data` is stored. See `DataLocation.DataLocation`.
 * `revoked`: If the Attestation has been revoked. It is possible to make a revoked Attestation.
 * `recipients`: The intended ABI-encoded recipients of this Attestation. This is of type `bytes` to support non-EVM
 * repicients.
 * `data`: The raw data of the Attestation based on `Schema.schema`. There is no enforcement here, however. Recommended
 * to use `abi.encode`.
 */
struct Attestation {
    uint64 schemaId;
    uint64 linkedAttestationId;
    uint64 attestTimestamp;
    uint64 revokeTimestamp;
    address attester;
    uint64 validUntil;
    DataLocation dataLocation;
    bool revoked;
    bytes[] recipients;
    bytes data;
}

/**
 * @title OffchainAttestation
 * @author Jack Xu @ EthSign
 * @notice This struct represents an off-chain attestation record. This record is not deleted after revocation.
 *
 * `attester`: The attester. At this time, the attester must be the caller of `attestOffchain()`.
 * `timestamp`: The `block.timestamp` of the function call.
 */
struct OffchainAttestation {
    address attester;
    uint64 timestamp;
}

File 6 of 26 : DataLocation.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title DataLocation
 * @author Jack Xu @ EthSign
 * @notice This enum indicates where `Schema.data` and `Attestation.data` are stored.
 */
enum DataLocation {
    ONCHAIN,
    ARWEAVE,
    IPFS,
    CUSTOM
}

File 7 of 26 : Schema.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import { ISPHook } from "../interfaces/ISPHook.sol";
import { DataLocation } from "./DataLocation.sol";

/**
 * @title Schema
 * @author Jack Xu @ EthSign
 * @notice This struct represents an on-chain Schema that Attestations can conform to.
 *
 * `registrant`: The address that registered this schema.
 * `revocable`: Whether Attestations that adopt this Schema can be revoked.
 * `dataLocation`: Where `Schema.data` is stored. See `DataLocation.DataLocation`.
 * `maxValidFor`: The maximum number of seconds that an Attestation can remain valid. 0 means Attestations can be valid
 * forever. This is enforced through `Attestation.validUntil`.
 * `hook`: The `ISPHook` that is called at the end of every function. 0 means there is no hook set. See
 * `ISPHook`.
 * `timestamp`: When the schema was registered. This is automatically populated by `_register(...)`.
 * `data`: The raw schema that `Attestation.data` should follow. Since there is no way to enforce this, it is a `string`
 * for easy readability.
 */
struct Schema {
    address registrant;
    bool revocable;
    DataLocation dataLocation;
    uint64 maxValidFor;
    ISPHook hook;
    uint64 timestamp;
    string data;
}

File 8 of 26 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        OwnableStorage storage $ = _getOwnableStorage();
        return $._owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 9 of 26 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 10 of 26 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.20;

import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable __self = address(this);

    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev The call is from an unauthorized context.
     */
    error UUPSUnauthorizedCallContext();

    /**
     * @dev The storage `slot` is unsupported as a UUID.
     */
    error UUPSUnsupportedProxiableUUID(bytes32 slot);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        _checkProxy();
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        _checkNotDelegated();
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual notDelegated returns (bytes32) {
        return ERC1967Utils.IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data);
    }

    /**
     * @dev Reverts if the execution is not performed via delegatecall or the execution
     * context is not of a proxy with an ERC1967-compliant implementation pointing to self.
     * See {_onlyProxy}.
     */
    function _checkProxy() internal view virtual {
        if (
            address(this) == __self || // Must be called through delegatecall
            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
        ) {
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Reverts if the execution is performed via delegatecall.
     * See {notDelegated}.
     */
    function _checkNotDelegated() internal view virtual {
        if (address(this) != __self) {
            // Must not be called through delegatecall
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
     *
     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
     * is expected to be the implementation slot in ERC1967.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
                revert UUPSUnsupportedProxiableUUID(slot);
            }
            ERC1967Utils.upgradeToAndCall(newImplementation, data);
        } catch {
            // The implementation is not UUPS
            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
        }
    }
}

File 11 of 26 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 12 of 26 : draft-IERC1822.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.20;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822Proxiable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

File 13 of 26 : IERC1271.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1271.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC1271 standard signature validation method for
 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
 */
interface IERC1271 {
    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param hash      Hash of the data to be signed
     * @param signature Signature byte array associated with _data
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}

File 14 of 26 : IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 15 of 26 : ERC1967Utils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.20;

import {IBeacon} from "../beacon/IBeacon.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 */
library ERC1967Utils {
    // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
    // This will be fixed in Solidity 0.8.21. At that point we should remove these events.
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {IERC1967-AdminChanged} event.
     */
    function changeAdmin(address newAdmin) internal {
        emit AdminChanged(getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

File 16 of 26 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 17 of 26 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

File 18 of 26 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

File 19 of 26 : ERC721A__Initializable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable diamond facet contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */

import {ERC721A__InitializableStorage} from './ERC721A__InitializableStorage.sol';

abstract contract ERC721A__Initializable {
    using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializerERC721A() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(
            ERC721A__InitializableStorage.layout()._initializing
                ? _isConstructor()
                : !ERC721A__InitializableStorage.layout()._initialized,
            'ERC721A__Initializable: contract is already initialized'
        );

        bool isTopLevelCall = !ERC721A__InitializableStorage.layout()._initializing;
        if (isTopLevelCall) {
            ERC721A__InitializableStorage.layout()._initializing = true;
            ERC721A__InitializableStorage.layout()._initialized = true;
        }

        _;

        if (isTopLevelCall) {
            ERC721A__InitializableStorage.layout()._initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializingERC721A() {
        require(
            ERC721A__InitializableStorage.layout()._initializing,
            'ERC721A__Initializable: contract is not initializing'
        );
        _;
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        // extcodesize checks the size of the code stored in an address, and
        // address returns the current address. Since the code is still not
        // deployed when running a constructor, any checks on its code size will
        // yield zero, making it an effective way to detect if a contract is
        // under construction or not.
        address self = address(this);
        uint256 cs;
        assembly {
            cs := extcodesize(self)
        }
        return cs == 0;
    }
}

File 20 of 26 : ERC721A__InitializableStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base storage for the  initialization function for upgradeable diamond facet contracts
 **/

library ERC721A__InitializableStorage {
    struct Layout {
        /*
         * Indicates that the contract has been initialized.
         */
        bool _initialized;
        /*
         * Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.initializable.facet');

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 21 of 26 : ERC721AStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library ERC721AStorage {
    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
    struct TokenApprovalRef {
        address value;
    }

    struct Layout {
        // =============================================================
        //                            STORAGE
        // =============================================================

        // The next token ID to be minted.
        uint256 _currentIndex;
        // The number of tokens burned.
        uint256 _burnCounter;
        // Token name
        string _name;
        // Token symbol
        string _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) _packedOwnerships;
        // Mapping owner address to address data.
        //
        // Bits Layout:
        // - [0..63]    `balance`
        // - [64..127]  `numberMinted`
        // - [128..191] `numberBurned`
        // - [192..255] `aux`
        mapping(address => uint256) _packedAddressData;
        // Mapping from token ID to approved address.
        mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals;
        // Mapping from owner to operator approvals
        mapping(address => mapping(address => bool)) _operatorApprovals;
        // The amount of tokens minted above `_sequentialUpTo()`.
        // We call these spot mints (i.e. non-sequential mints).
        uint256 _spotMinted;
    }

    bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.ERC721A');

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 22 of 26 : ERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721AUpgradeable.sol';
import {ERC721AStorage} from './ERC721AStorage.sol';
import './ERC721A__Initializable.sol';

/**
 * @dev Interface of ERC721 token receiver.
 */
interface ERC721A__IERC721ReceiverUpgradeable {
    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()`.
 *
 * The `_sequentialUpTo()` function can be overriden to enable spot mints
 * (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`.
 *
 * 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 ERC721AUpgradeable is ERC721A__Initializable, IERC721AUpgradeable {
    using ERC721AStorage for ERC721AStorage.Layout;

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

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

    function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializingERC721A {
        __ERC721A_init_unchained(name_, symbol_);
    }

    function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializingERC721A {
        ERC721AStorage.layout()._name = name_;
        ERC721AStorage.layout()._symbol = symbol_;
        ERC721AStorage.layout()._currentIndex = _startTokenId();

        if (_sequentialUpTo() < _startTokenId()) _revert(SequentialUpToTooSmall.selector);
    }

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

    /**
     * @dev Returns the starting token ID for sequential mints.
     *
     * Override this function to change the starting token ID for sequential mints.
     *
     * Note: The value returned must never change after any tokens have been minted.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev Returns the maximum token ID (inclusive) for sequential mints.
     *
     * Override this function to return a value less than 2**256 - 1,
     * but greater than `_startTokenId()`, to enable spot (non-sequential) mints.
     *
     * Note: The value returned must never change after any tokens have been minted.
     */
    function _sequentialUpTo() internal view virtual returns (uint256) {
        return type(uint256).max;
    }

    /**
     * @dev Returns the next token ID to be minted.
     */
    function _nextTokenId() internal view virtual returns (uint256) {
        return ERC721AStorage.layout()._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 result) {
        // Counter underflow is impossible as `_burnCounter` cannot be incremented
        // more than `_currentIndex + _spotMinted - _startTokenId()` times.
        unchecked {
            // With spot minting, the intermediate `result` can be temporarily negative,
            // and the computation must be unchecked.
            result = ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId();
            if (_sequentialUpTo() != type(uint256).max) result += ERC721AStorage.layout()._spotMinted;
        }
    }

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view virtual returns (uint256 result) {
        // Counter underflow is impossible as `_currentIndex` does not decrement,
        // and it is initialized to `_startTokenId()`.
        unchecked {
            result = ERC721AStorage.layout()._currentIndex - _startTokenId();
            if (_sequentialUpTo() != type(uint256).max) result += ERC721AStorage.layout()._spotMinted;
        }
    }

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

    /**
     * @dev Returns the total number of tokens that are spot-minted.
     */
    function _totalSpotMinted() internal view virtual returns (uint256) {
        return ERC721AStorage.layout()._spotMinted;
    }

    // =============================================================
    //                    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.selector);
        return ERC721AStorage.layout()._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return
            (ERC721AStorage.layout()._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
            (ERC721AStorage.layout()._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(ERC721AStorage.layout()._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 = ERC721AStorage.layout()._packedAddressData[owner];
        uint256 auxCasted;
        // Cast `aux` with assembly to avoid redundant masking.
        assembly {
            auxCasted := aux
        }
        packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
        ERC721AStorage.layout()._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 ERC721AStorage.layout()._name;
    }

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() public view virtual override returns (string memory) {
        return ERC721AStorage.layout()._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.selector);

        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(ERC721AStorage.layout()._packedOwnerships[index]);
    }

    /**
     * @dev Returns whether the ownership slot at `index` is initialized.
     * An uninitialized slot does not necessarily mean that the slot has no owner.
     */
    function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) {
        return ERC721AStorage.layout()._packedOwnerships[index] != 0;
    }

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

    /**
     * @dev Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
        if (_startTokenId() <= tokenId) {
            packed = ERC721AStorage.layout()._packedOwnerships[tokenId];

            if (tokenId > _sequentialUpTo()) {
                if (_packedOwnershipExists(packed)) return packed;
                _revert(OwnerQueryForNonexistentToken.selector);
            }

            // If the data at the starting slot does not exist, start the scan.
            if (packed == 0) {
                if (tokenId >= ERC721AStorage.layout()._currentIndex) _revert(OwnerQueryForNonexistentToken.selector);
                // 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, `tokenId` will not underflow.
                //
                // We can directly compare the packed value.
                // If the address is zero, packed will be zero.
                for (;;) {
                    unchecked {
                        packed = ERC721AStorage.layout()._packedOwnerships[--tokenId];
                    }
                    if (packed == 0) continue;
                    if (packed & _BITMASK_BURNED == 0) return packed;
                    // Otherwise, the token is burned, and we must revert.
                    // This handles the case of batch burned tokens, where only the burned bit
                    // of the starting slot is set, and remaining slots are left uninitialized.
                    _revert(OwnerQueryForNonexistentToken.selector);
                }
            }
            // Otherwise, the data exists and we can skip the scan.
            // This is possible because we have already achieved the target condition.
            // This saves 2143 gas on transfers of initialized tokens.
            // If the token is not burned, return `packed`. Otherwise, revert.
            if (packed & _BITMASK_BURNED == 0) return packed;
        }
        _revert(OwnerQueryForNonexistentToken.selector);
    }

    /**
     * @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. See {ERC721A-_approve}.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     */
    function approve(address to, uint256 tokenId) public payable virtual override {
        _approve(to, tokenId, true);
    }

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

        return ERC721AStorage.layout()._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 {
        ERC721AStorage.layout()._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 ERC721AStorage.layout()._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 result) {
        if (_startTokenId() <= tokenId) {
            if (tokenId > _sequentialUpTo())
                return _packedOwnershipExists(ERC721AStorage.layout()._packedOwnerships[tokenId]);

            if (tokenId < ERC721AStorage.layout()._currentIndex) {
                uint256 packed;
                while ((packed = ERC721AStorage.layout()._packedOwnerships[tokenId]) == 0) --tokenId;
                result = packed & _BITMASK_BURNED == 0;
            }
        }
    }

    /**
     * @dev Returns whether `packed` represents a token that exists.
     */
    function _packedOwnershipExists(uint256 packed) private pure returns (bool result) {
        assembly {
            // The following is equivalent to `owner != address(0) && burned == false`.
            // Symbolically tested.
            result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_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)
    {
        ERC721AStorage.TokenApprovalRef storage tokenApproval = ERC721AStorage.layout()._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);

        // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
        from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS));

        if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector);

        (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.selector);

        _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.
            --ERC721AStorage.layout()._packedAddressData[from]; // Updates: `balance -= 1`.
            ++ERC721AStorage.layout()._packedAddressData[to]; // Updates: `balance += 1`.

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            ERC721AStorage.layout()._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 (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != ERC721AStorage.layout()._currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
        uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
        assembly {
            // 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.
                from, // `from`.
                toMasked, // `to`.
                tokenId // `tokenId`.
            )
        }
        if (toMasked == 0) _revert(TransferToZeroAddress.selector);

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

    /**
     * @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__IERC721ReceiverUpgradeable(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data)
        returns (bytes4 retval) {
            return retval == ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                _revert(TransferToNonERC721ReceiverImplementer.selector);
            }
            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 = ERC721AStorage.layout()._currentIndex;
        if (quantity == 0) _revert(MintZeroQuantity.selector);

        _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:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
            uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;

            if (toMasked == 0) _revert(MintToZeroAddress.selector);

            uint256 end = startTokenId + quantity;
            uint256 tokenId = startTokenId;

            if (end - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);

            do {
                assembly {
                    // 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`.
                        tokenId // `tokenId`.
                    )
                }
                // The `!=` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
            } while (++tokenId != end);

            ERC721AStorage.layout()._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 = ERC721AStorage.layout()._currentIndex;
        if (to == address(0)) _revert(MintToZeroAddress.selector);
        if (quantity == 0) _revert(MintZeroQuantity.selector);
        if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector);

        _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`.
            ERC721AStorage.layout()._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`.
            ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            if (startTokenId + quantity - 1 > _sequentialUpTo()) _revert(SequentialMintExceedsLimit.selector);

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

            ERC721AStorage.layout()._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 = ERC721AStorage.layout()._currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        _revert(TransferToNonERC721ReceiverImplementer.selector);
                    }
                } while (index < end);
                // This prevents reentrancy to `_safeMint`.
                // It does not prevent reentrancy to `_safeMintSpot`.
                if (ERC721AStorage.layout()._currentIndex != end) revert();
            }
        }
    }

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

    /**
     * @dev Mints a single token at `tokenId`.
     *
     * Note: A spot-minted `tokenId` that has been burned can be re-minted again.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` must be greater than `_sequentialUpTo()`.
     * - `tokenId` must not exist.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mintSpot(address to, uint256 tokenId) internal virtual {
        if (tokenId <= _sequentialUpTo()) _revert(SpotMintTokenIdTooSmall.selector);
        uint256 prevOwnershipPacked = ERC721AStorage.layout()._packedOwnerships[tokenId];
        if (_packedOwnershipExists(prevOwnershipPacked)) _revert(TokenAlreadyExists.selector);

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

        // Overflows are incredibly unrealistic.
        // The `numberMinted` for `to` is incremented by 1, and has a max limit of 2**64 - 1.
        // `_spotMinted` is incremented by 1, and has a max limit of 2**256 - 1.
        unchecked {
            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `true` (as `quantity == 1`).
            ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(1) | _nextExtraData(address(0), to, prevOwnershipPacked)
            );

            // Updates:
            // - `balance += 1`.
            // - `numberMinted += 1`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            ERC721AStorage.layout()._packedAddressData[to] += (1 << _BITPOS_NUMBER_MINTED) | 1;

            // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
            uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;

            if (toMasked == 0) _revert(MintToZeroAddress.selector);

            assembly {
                // 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`.
                    tokenId // `tokenId`.
                )
            }

            ++ERC721AStorage.layout()._spotMinted;
        }

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

    /**
     * @dev Safely mints a single token at `tokenId`.
     *
     * Note: A spot-minted `tokenId` that has been burned can be re-minted again.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}.
     * - `tokenId` must be greater than `_sequentialUpTo()`.
     * - `tokenId` must not exist.
     *
     * See {_mintSpot}.
     *
     * Emits a {Transfer} event.
     */
    function _safeMintSpot(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mintSpot(to, tokenId);

        unchecked {
            if (to.code.length != 0) {
                uint256 currentSpotMinted = ERC721AStorage.layout()._spotMinted;
                if (!_checkContractOnERC721Received(address(0), to, tokenId, _data)) {
                    _revert(TransferToNonERC721ReceiverImplementer.selector);
                }
                // This prevents reentrancy to `_safeMintSpot`.
                // It does not prevent reentrancy to `_safeMint`.
                if (ERC721AStorage.layout()._spotMinted != currentSpotMinted) revert();
            }
        }
    }

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

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

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

    /**
     * @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:
     *
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function _approve(
        address to,
        uint256 tokenId,
        bool approvalCheck
    ) internal virtual {
        address owner = ownerOf(tokenId);

        if (approvalCheck && _msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                _revert(ApprovalCallerNotOwnerNorApproved.selector);
            }

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

    // =============================================================
    //                        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.selector);
        }

        _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;`.
            ERC721AStorage.layout()._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`.
            ERC721AStorage.layout()._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 (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != ERC721AStorage.layout()._currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

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

        // Overflow not possible, as `_burnCounter` cannot be exceed `_currentIndex + _spotMinted` times.
        unchecked {
            ERC721AStorage.layout()._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 = ERC721AStorage.layout()._packedOwnerships[index];
        if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector);
        uint256 extraDataCasted;
        // Cast `extraData` with assembly to avoid redundant masking.
        assembly {
            extraDataCasted := extraData
        }
        packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
        ERC721AStorage.layout()._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)
        }
    }

    /**
     * @dev For more efficient reverts.
     */
    function _revert(bytes4 errorSelector) internal pure {
        assembly {
            mstore(0x00, errorSelector)
            revert(0x00, 0x04)
        }
    }
}

File 23 of 26 : ERC721AQueryableUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721AQueryableUpgradeable.sol';
import '../ERC721AUpgradeable.sol';
import '../ERC721A__Initializable.sol';

/**
 * @title ERC721AQueryable.
 *
 * @dev ERC721A subclass with convenience query functions.
 */
abstract contract ERC721AQueryableUpgradeable is
    ERC721A__Initializable,
    ERC721AUpgradeable,
    IERC721AQueryableUpgradeable
{
    function __ERC721AQueryable_init() internal onlyInitializingERC721A {
        __ERC721AQueryable_init_unchained();
    }

    function __ERC721AQueryable_init_unchained() internal onlyInitializingERC721A {}

    /**
     * @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 ownership)
    {
        unchecked {
            if (tokenId >= _startTokenId()) {
                if (tokenId > _sequentialUpTo()) return _ownershipAt(tokenId);

                if (tokenId < _nextTokenId()) {
                    // If the `tokenId` is within bounds,
                    // scan backwards for the initialized ownership slot.
                    while (!_ownershipIsInitialized(tokenId)) --tokenId;
                    return _ownershipAt(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)
    {
        TokenOwnership[] memory ownerships;
        uint256 i = tokenIds.length;
        assembly {
            // Grab the free memory pointer.
            ownerships := mload(0x40)
            // Store the length.
            mstore(ownerships, i)
            // Allocate one word for the length,
            // `tokenIds.length` words for the pointers.
            i := shl(5, i) // Multiply `i` by 32.
            mstore(0x40, add(add(ownerships, 0x20), i))
        }
        while (i != 0) {
            uint256 tokenId;
            assembly {
                i := sub(i, 0x20)
                tokenId := calldataload(add(tokenIds.offset, i))
            }
            TokenOwnership memory ownership = explicitOwnershipOf(tokenId);
            assembly {
                // Store the pointer of `ownership` in the `ownerships` array.
                mstore(add(add(ownerships, 0x20), i), ownership)
            }
        }
        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) {
        return _tokensOfOwnerIn(owner, start, stop);
    }

    /**
     * @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) {
        // If spot mints are enabled, full-range scan is disabled.
        if (_sequentialUpTo() != type(uint256).max) _revert(NotCompatibleWithSpotMints.selector);
        uint256 start = _startTokenId();
        uint256 stop = _nextTokenId();
        uint256[] memory tokenIds;
        if (start != stop) tokenIds = _tokensOfOwnerIn(owner, start, stop);
        return tokenIds;
    }

    /**
     * @dev Helper function for returning an array of token IDs owned by `owner`.
     *
     * Note that this function is optimized for smaller bytecode size over runtime gas,
     * since it is meant to be called off-chain.
     */
    function _tokensOfOwnerIn(
        address owner,
        uint256 start,
        uint256 stop
    ) private view returns (uint256[] memory tokenIds) {
        unchecked {
            if (start >= stop) _revert(InvalidQueryRange.selector);
            // Set `start = max(start, _startTokenId())`.
            if (start < _startTokenId()) start = _startTokenId();
            uint256 nextTokenId = _nextTokenId();
            // If spot mints are enabled, scan all the way until the specified `stop`.
            uint256 stopLimit = _sequentialUpTo() != type(uint256).max ? stop : nextTokenId;
            // Set `stop = min(stop, stopLimit)`.
            if (stop >= stopLimit) stop = stopLimit;
            // Number of tokens to scan.
            uint256 tokenIdsMaxLength = balanceOf(owner);
            // Set `tokenIdsMaxLength` to zero if the range contains no tokens.
            if (start >= stop) tokenIdsMaxLength = 0;
            // If there are one or more tokens to scan.
            if (tokenIdsMaxLength != 0) {
                // Set `tokenIdsMaxLength = min(balanceOf(owner), tokenIdsMaxLength)`.
                if (stop - start <= tokenIdsMaxLength) tokenIdsMaxLength = stop - start;
                uint256 m; // Start of available memory.
                assembly {
                    // Grab the free memory pointer.
                    tokenIds := mload(0x40)
                    // Allocate one word for the length, and `tokenIdsMaxLength` words
                    // for the data. `shl(5, x)` is equivalent to `mul(32, x)`.
                    m := add(tokenIds, shl(5, add(tokenIdsMaxLength, 1)))
                    mstore(0x40, m)
                }
                // 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;
                uint256 tokenIdsIdx;
                // Use a do-while, which is slightly more efficient for this case,
                // as the array will at least contain one element.
                do {
                    if (_sequentialUpTo() != type(uint256).max) {
                        // Skip the remaining unused sequential slots.
                        if (start == nextTokenId) start = _sequentialUpTo() + 1;
                        // Reset `currOwnershipAddr`, as each spot-minted token is a batch of one.
                        if (start > _sequentialUpTo()) currOwnershipAddr = address(0);
                    }
                    ownership = _ownershipAt(start); // This implicitly allocates memory.
                    assembly {
                        switch mload(add(ownership, 0x40))
                        // if `ownership.burned == false`.
                        case 0 {
                            // if `ownership.addr != address(0)`.
                            // The `addr` already has it's upper 96 bits clearned,
                            // since it is written to memory with regular Solidity.
                            if mload(ownership) {
                                currOwnershipAddr := mload(ownership)
                            }
                            // if `currOwnershipAddr == owner`.
                            // The `shl(96, x)` is to make the comparison agnostic to any
                            // dirty upper 96 bits in `owner`.
                            if iszero(shl(96, xor(currOwnershipAddr, owner))) {
                                tokenIdsIdx := add(tokenIdsIdx, 1)
                                mstore(add(tokenIds, shl(5, tokenIdsIdx)), start)
                            }
                        }
                        // Otherwise, reset `currOwnershipAddr`.
                        // This handles the case of batch burned tokens
                        // (burned bit of first slot set, remaining slots left uninitialized).
                        default {
                            currOwnershipAddr := 0
                        }
                        start := add(start, 1)
                        // Free temporary memory implicitly allocated for ownership
                        // to avoid quadratic memory expansion costs.
                        mstore(0x40, m)
                    }
                } while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength));
                // Store the length of the array.
                assembly {
                    mstore(tokenIds, tokenIdsIdx)
                }
            }
        }
    }
}

File 24 of 26 : IERC721AQueryableUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import '../IERC721AUpgradeable.sol';

/**
 * @dev Interface of ERC721AQueryable.
 */
interface IERC721AQueryableUpgradeable is IERC721AUpgradeable {
    /**
     * 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);
}

File 25 of 26 : IERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of ERC721A.
 */
interface IERC721AUpgradeable {
    /**
     * 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();

    /**
     * `_sequentialUpTo()` must be greater than `_startTokenId()`.
     */
    error SequentialUpToTooSmall();

    /**
     * The `tokenId` of a sequential mint exceeds `_sequentialUpTo()`.
     */
    error SequentialMintExceedsLimit();

    /**
     * Spot minting requires a `tokenId` greater than `_sequentialUpTo()`.
     */
    error SpotMintTokenIdTooSmall();

    /**
     * Cannot mint over a token that already exists.
     */
    error TokenAlreadyExists();

    /**
     * The feature is not compatible with spot mints.
     */
    error NotCompatibleWithSpotMints();

    // =============================================================
    //                            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 26 of 26 : IERC6066.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC6066 {
    event ERC6066Signed(address owner, uint256 tokenId, bytes32 hash, bool approved);

    /**
     * @dev MUST return if the signature provided is valid for the provided tokenId and hash
     * @param tokenId   Token ID of the signing NFT
     * @param hash      Hash of the data to be signed
     * @param data      OPTIONAL arbitrary data that may aid verification
     *
     * MUST return the bytes4 magic value 0x12edb34f when function passes.
     * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5)
     * MUST allow external calls
     *
     */
    function isValidSignature(
        uint256 tokenId,
        bytes32 hash,
        bytes calldata data
    )
        external
        view
        returns (bytes4 magicValue);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidData","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"}],"name":"LowLevelCallError","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"OverMint","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","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":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"inputs":[],"name":"Unsupported","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"hash","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ERC6066Signed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"MAX_TOTAL_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[{"internalType":"address","name":"attester","type":"address"},{"internalType":"uint64","name":"schemaId","type":"uint64"},{"internalType":"uint64","name":"attestationId","type":"uint64"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"didReceiveAttestation","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"contract IERC20","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"didReceiveAttestation","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"attester","type":"address"},{"internalType":"uint64","name":"schemaId","type":"uint64"},{"internalType":"uint64","name":"attestationId","type":"uint64"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"didReceiveRevocation","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"contract IERC20","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"didReceiveRevocation","outputs":[],"stateMutability":"pure","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 IERC721AUpgradeable.TokenOwnership","name":"ownership","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 IERC721AUpgradeable.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":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","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"},{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"magicValue","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"magicValue","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"safeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"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":"address","name":"spInstance","type":"address"},{"internalType":"uint64","name":"approvedSpSchemaId","type":"uint64"},{"internalType":"address","name":"approvedSpAttester","type":"address"}],"name":"setSignProtocolConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"unifiedURI","type":"string"}],"name":"setUnifiedURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"sign","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"result","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":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a0604052306080523480156200001557600080fd5b5046617a69146200002a576200002a62000030565b620000e4565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000815760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000e15780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b60805161301a6200010e6000396000818161179c015281816117c50152611906015261301a6000f3fe6080604052600436106102305760003560e01c806370a082311161012e578063b7f0f277116100ab578063e086e5ec1161006f578063e086e5ec1461066b578063e33361f414610680578063e830b5c7146103e4578063e985e9c514610693578063f2fde38b146106b357600080fd5b8063b7f0f277146105cb578063b88d4fde146105eb578063c23dc68f146105fe578063c87b56dd1461062b578063d8e5c46e1461064b57600080fd5b806395d89b41116100f257806395d89b411461052557806399a2557a1461053a578063a14481941461055a578063a22cb4651461057a578063ad3cb1cc1461059a57600080fd5b806370a0823114610499578063715018a6146104b95780638129fc1c146104ce5780638462151c146104e35780638da5cb5b1461051057600080fd5b806324cf6f0f116101bc5780634f1ef286116101805780634f1ef2861461040457806352d1902d1461041757806355f804b31461042c5780635bbb21771461044c5780636352211e1461047957600080fd5b806324cf6f0f1461038857806333039d3d146103a85780633398b4ed146103be57806342842e0e146103d15780634466507a146103e457600080fd5b806312edb34f1161020357806312edb34f146102d95780631626ba7e1461031257806318160ddd146103325780632241640d1461035557806323b872dd1461037557600080fd5b806301ffc9a71461023557806306fdde031461026a578063081812fc1461028c578063095ea7b3146102c4575b600080fd5b34801561024157600080fd5b5061025561025036600461223c565b6106d3565b60405190151581526020015b60405180910390f35b34801561027657600080fd5b5061027f610725565b60405161026191906122a9565b34801561029857600080fd5b506102ac6102a73660046122bc565b6107c0565b6040516001600160a01b039091168152602001610261565b6102d76102d23660046122ea565b610804565b005b3480156102e557600080fd5b506102f96102f4366004612402565b610814565b6040516001600160e01b03199091168152602001610261565b34801561031e57600080fd5b506102f961032d366004612451565b61086e565b34801561033e57600080fd5b506103476108a9565b604051908152602001610261565b34801561036157600080fd5b506102d76103703660046124df565b6108c8565b6102d7610383366004612520565b610901565b34801561039457600080fd5b506102d76103a33660046125a5565b61095b565b3480156103b457600080fd5b506103476103e881565b6102d76103cc36600461261e565b6109a8565b6102d76103df366004612520565b6109f3565b3480156103f057600080fd5b506102d76103ff366004612699565b610a0e565b6102d7610412366004612730565b610a27565b34801561042357600080fd5b50610347610a42565b34801561043857600080fd5b506102d76104473660046124df565b610a5f565b34801561045857600080fd5b5061046c610467366004612769565b610a93565b60405161026191906127da565b34801561048557600080fd5b506102ac6104943660046122bc565b610adf565b3480156104a557600080fd5b506103476104b4366004612828565b610aea565b3480156104c557600080fd5b506102d7610b49565b3480156104da57600080fd5b506102d7610b5d565b3480156104ef57600080fd5b506105036104fe366004612828565b610dbf565b6040516102619190612845565b34801561051c57600080fd5b506102ac610deb565b34801561053157600080fd5b5061027f610e19565b34801561054657600080fd5b5061050361055536600461287d565b610e31565b34801561056657600080fd5b506102d76105753660046122ea565b610e3e565b34801561058657600080fd5b506102d76105953660046128c0565b610e50565b3480156105a657600080fd5b5061027f604051806040016040528060058152602001640352e302e360dc1b81525081565b3480156105d757600080fd5b506102d76105e63660046128f9565b610ecd565b6102d76105f9366004612932565b610fa1565b34801561060a57600080fd5b5061061e6106193660046122bc565b610fe2565b604051610261919061299d565b34801561063757600080fd5b5061027f6106463660046122bc565b61103d565b34801561065757600080fd5b506102d76106663660046129ab565b611151565b34801561067757600080fd5b506102d76111d3565b6102d761068e36600461261e565b61125a565b34801561069f57600080fd5b506102556106ae3660046129eb565b611270565b3480156106bf57600080fd5b506102d76106ce366004612828565b6112ad565b60006301ffc9a760e01b6001600160e01b03198316148061070457506380ac58cd60e01b6001600160e01b03198316145b8061071f5750635b5e139f60e01b6001600160e01b03198316145b92915050565b606061072f6112eb565b600201805461073d90612a19565b80601f016020809104026020016040519081016040528092919081815260200182805461076990612a19565b80156107b65780601f1061078b576101008083540402835291602001916107b6565b820191906000526020600020905b81548152906001019060200180831161079957829003601f168201915b5050505050905090565b60006107cb8261130f565b6107df576107df6333d1c03960e21b611365565b6107e76112eb565b60009283526006016020525060409020546001600160a01b031690565b6108108282600161136f565b5050565b60008381527fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc046020908152604080832085845290915281205460ff1661085b576000610864565b6312edb34f60e01b5b90505b9392505050565b600080828060200190518101906108859190612a53565b90506108a1818560405180602001604052806000815250610814565b949350505050565b6000806108b46112eb565b600101546108c06112eb565b540303905090565b6108d0611420565b7fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc056108fc828483612abc565b505050565b60008181527fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc03602052604090205460ff161561095057604051634851657960e11b815260040160405180910390fd5b6108fc838383611452565b60005b818110156109a157610999858585858581811061097d5761097d612b7b565b9050602002013560405180602001604052806000815250610fa1565b60010161095e565b5050505050565b6001600080516020612fa58339815191525b60030160006109cd338989898989611615565b81526020810191909152604001600020805460ff19169115159190911790555050505050565b6108fc83838360405180602001604052806000815250610fa1565b604051634851657960e11b815260040160405180910390fd5b610a2f611791565b610a3882611836565b610810828261183e565b6000610a4c6118fb565b50600080516020612f8583398151915290565b610a67611420565b7fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc026108fc828483612abc565b60408051828152600583901b8082016020019092526060915b8015610ad757601f1980820191860101356000610ac882610fe2565b8484016020015250610aac9050565b509392505050565b600061071f82611944565b60006001600160a01b038216610b0a57610b0a6323d3ad8160e21b611365565b6001600160401b03610b1a6112eb565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b610b51611420565b610b5b60006119ff565b565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b0316600081158015610ba25750825b90506000826001600160401b03166001148015610bbe5750303b155b905081158015610bcc575080155b15610bea5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610c1457845460ff60401b1916600160401b1785555b600080516020612fc583398151915254610100900460ff16610c4957600080516020612fc58339815191525460ff1615610c4d565b303b155b610cc45760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a656400000000000000000060648201526084015b60405180910390fd5b600080516020612fc583398151915254610100900460ff16158015610d0057600080516020612fc5833981519152805461ffff19166101011790555b610d4a604051806040016040528060088152602001675369676e5061737360c01b815250604051806040016040528060088152602001675349474e5041535360c01b815250611a70565b610d5333611b30565b8015610d7257600080516020612fc5833981519152805461ff00191690555b5083156109a157845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050565b6060600080610dcc611b38565b905060608183146108a157610de2858484611b48565b95945050505050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6060610e236112eb565b600301805461073d90612a19565b6060610864848484611b48565b610e46611420565b6108108282611c4a565b80610e596112eb565b336000818152600792909201602090815260408084206001600160a01b03881680865290835293819020805460ff19169515159590951790945592518415158152919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b33610ed784610adf565b6001600160a01b031614610efe57604051634851657960e11b815260040160405180910390fd5b60008381527fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc04602090815260408083208584529091529020805460ff19168215151790557fd09cf6d215eba644959a0259fe17dd671d64293754f8fe16b2da1be2218ad5ff610f6c84610adf565b604080516001600160a01b039092168252602082018690528101849052821515606082015260800160405180910390a1505050565b610fac848484610901565b6001600160a01b0383163b15610fdc57610fc884848484611c64565b610fdc57610fdc6368d2bf6b60e11b611365565b50505050565b60408051608081018252600080825260208201819052918101829052606081019190915261100e611b38565b821015611038575b61101f82611dcf565b61102f5760001990910190611016565b61071f82611d46565b919050565b60606110488261130f565b61105c5761105c630a14c4b560e41b611365565b6000611066611def565b90508051600003611120577fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc05805461109d90612a19565b80601f01602080910402602001604051908101604052809291908181526020018280546110c990612a19565b80156111165780601f106110eb57610100808354040283529160200191611116565b820191906000526020600020905b8154815290600101906020018083116110f957829003601f168201915b5050505050610867565b8061112a84611e05565b60405160200161113b929190612b91565b6040516020818303038152906040529392505050565b611159611420565b600080516020612fa583398151915280546001600160401b0393909316600160a01b026001600160e01b03199093166001600160a01b0394851617929092179091557fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc018054919092166001600160a01b0319909116179055565b6111db611420565b6000806111e6610deb565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114611230576040519150601f19603f3d011682016040523d82523d6000602084013e611235565b606091505b509150915081610810578060405163d351ff9b60e01b8152600401610cbb91906122a9565b6000600080516020612fa58339815191526109ba565b600061127a6112eb565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6112b5611420565b6001600160a01b0381166112df57604051631e4fbdf760e01b815260006004820152602401610cbb565b6112e8816119ff565b50565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b60006113196112eb565b548210156110385760005b61132c6112eb565b6000848152600491909101602052604081205491508190036113585761135183612bd6565b9250611324565b600160e01b161592915050565b8060005260046000fd5b600061137a83610adf565b90508180156113925750336001600160a01b03821614155b156113b5576113a18133611270565b6113b5576113b56367d9dca160e11b611365565b836113be6112eb565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b33611429610deb565b6001600160a01b031614610b5b5760405163118cdaa760e01b8152336004820152602401610cbb565b600061145d82611944565b6001600160a01b0394851694909150811684146114835761148362a1148160e81b611365565b60008061148f84611e49565b915091506114b4818761149f3390565b6001600160a01b039081169116811491141790565b6114d6576114c28633611270565b6114d6576114d6632ce44b5f60e11b611365565b80156114e157600082555b6114e96112eb565b6001600160a01b03871660009081526005919091016020526040902080546000190190556115156112eb565b6001600160a01b03861660008181526005929092016020526040909120805460010190554260a01b17600160e11b1761154c6112eb565b60008681526004919091016020526040812091909155600160e11b841690036115c2576001840161157b6112eb565b6000828152600491909101602052604081205490036115c05761159c6112eb565b5481146115c057836115ac6112eb565b600083815260049190910160205260409020555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a48060000361160c5761160c633a954ecd60e21b611365565b50505050505050565b600080516020612fa58339815191528054600091906001600160a01b038981169116141580611658575080546001600160401b03878116600160a01b9092041614155b80611673575060018101546001600160a01b03888116911614155b1561169157604051634851657960e11b815260040160405180910390fd5b805460405162c44a5160e71b81526001600160401b03871660048201526000916001600160a01b031690636225288090602401600060405180830381865afa1580156116e1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117099190810190612d00565b610100015160008151811061172057611720612b7b565b602002602001015180602001905181019061173b9190612e1f565b9050611749848601866122bc565b9250806001600160a01b031661175e84610adf565b6001600160a01b03161461178557604051635cb045db60e01b815260040160405180910390fd5b50509695505050505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061181857507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661180c600080516020612f85833981519152546001600160a01b031690565b6001600160a01b031614155b15610b5b5760405163703e46dd60e11b815260040160405180910390fd5b6112e8611420565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611898575060408051601f3d908101601f1916820190925261189591810190612a53565b60015b6118c057604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610cbb565b600080516020612f8583398151915281146118f157604051632a87526960e21b815260048101829052602401610cbb565b6108fc8383611e71565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610b5b5760405163703e46dd60e11b815260040160405180910390fd5b600061194e6112eb565b600083815260049190910160205260409020549050806000036119dc576119736112eb565b54821061198a5761198a636f96cda160e11b611365565b6119926112eb565b60001990920160008181526004939093016020526040909220549050801561198a57600160e01b81166000036119c757919050565b6119d7636f96cda160e11b611365565b61198a565b600160e01b81166000036119ef57919050565b611038636f96cda160e11b611365565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b600080516020612fc583398151915254610100900460ff16611af15760405162461bcd60e51b815260206004820152603460248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604482015273206973206e6f7420696e697469616c697a696e6760601b6064820152608401610cbb565b81611afa6112eb565b60020190611b089082612e3c565b5080611b126112eb565b60030190611b209082612e3c565b506000611b2b6112eb565b555050565b6112b5611ec7565b6000611b426112eb565b54919050565b6060818310611b6157611b61631960ccad60e11b611365565b6000611b6b611b38565b905080808410611b79578093505b6000611b8487610aea565b9050848610611b91575060005b8015611c40578086860311611ba557508484035b604080516001830160051b81019182905294506000611bc388610fe2565b905060008160400151611bd4575080515b60005b611be08a611d46565b9250604083015160008114611bf85760009250611c1d565b835115611c0457835192505b8b831860601b611c1d576001820191508a8260051b8a01525b5060018a01995083604052888a1480611c3557508481145b15611bd75787525050505b5050509392505050565b610810828260405180602001604052806000815250611f10565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611c99903390899088908890600401612efb565b6020604051808303816000875af1925050508015611cd4575060408051601f3d908101601f19168201909252611cd191810190612f38565b60015b611d29573d808015611d02576040519150601f19603f3d011682016040523d82523d6000602084013e611d07565b606091505b508051600003611d2157611d216368d2bf6b60e11b611365565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60408051608081018252600080825260208201819052918101829052606081019190915261071f611d756112eb565b60008481526004919091016020526040902054604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6000611dd96112eb565b6000928352600401602052506040902054151590565b6060600080516020612fa583398151915261072f565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611e1f5750819003601f19909101908152919050565b6000806000611e566112eb565b60009485526006016020525050604090912080549092909150565b611e7a82611f7d565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115611ebf576108fc8282611fe2565b61081061204f565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610b5b57604051631afcd79f60e31b815260040160405180910390fd5b611f1a838361206e565b6001600160a01b0383163b156108fc576000611f346112eb565b5490508281035b611f4e6000868380600101945086611c64565b611f6257611f626368d2bf6b60e11b611365565b818110611f3b5781611f726112eb565b54146109a157600080fd5b806001600160a01b03163b600003611fb357604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610cbb565b600080516020612f8583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b031684604051611fff9190612f55565b600060405180830381855af49150503d806000811461203a576040519150601f19603f3d011682016040523d82523d6000602084013e61203f565b606091505b5091509150610de28583836120ad565b3415610b5b5760405163b398979f60e01b815260040160405180910390fd5b6103e88161207a6108a9565b6120849190612f71565b11156120a357604051633bd7ad7760e21b815260040160405180910390fd5b6108108282612109565b6060826120c2576120bd826121fd565b610867565b81511580156120d957506001600160a01b0384163b155b1561210257604051639996b31560e01b81526001600160a01b0385166004820152602401610cbb565b5080610867565b60006121136112eb565b549050600082900361212f5761212f63b562e8dd60e01b611365565b6001600160a01b0383164260a01b6001841460e11b171761214e6112eb565b600083815260049190910160205260409020556801000000000000000182026121756112eb565b6001600160a01b03851660008181526005929092016020526040822080549093019092558190036121af576121af622e076360e81b611365565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a48181600101915081036121b457816121f36112eb565b55506108fc915050565b80511561220d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160e01b0319811681146112e857600080fd5b60006020828403121561224e57600080fd5b813561086781612226565b60005b8381101561227457818101518382015260200161225c565b50506000910152565b60008151808452612295816020860160208601612259565b601f01601f19169290920160200192915050565b602081526000610867602083018461227d565b6000602082840312156122ce57600080fd5b5035919050565b6001600160a01b03811681146112e857600080fd5b600080604083850312156122fd57600080fd5b8235612308816122d5565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b038111828210171561234f5761234f612316565b60405290565b604051601f8201601f191681016001600160401b038111828210171561237d5761237d612316565b604052919050565b60006001600160401b0382111561239e5761239e612316565b50601f01601f191660200190565b600082601f8301126123bd57600080fd5b81356123d06123cb82612385565b612355565b8181528460208386010111156123e557600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561241757600080fd5b833592506020840135915060408401356001600160401b0381111561243b57600080fd5b612447868287016123ac565b9150509250925092565b6000806040838503121561246457600080fd5b8235915060208301356001600160401b0381111561248157600080fd5b61248d858286016123ac565b9150509250929050565b60008083601f8401126124a957600080fd5b5081356001600160401b038111156124c057600080fd5b6020830191508360208285010111156124d857600080fd5b9250929050565b600080602083850312156124f257600080fd5b82356001600160401b0381111561250857600080fd5b61251485828601612497565b90969095509350505050565b60008060006060848603121561253557600080fd5b8335612540816122d5565b92506020840135612550816122d5565b929592945050506040919091013590565b60008083601f84011261257357600080fd5b5081356001600160401b0381111561258a57600080fd5b6020830191508360208260051b85010111156124d857600080fd5b600080600080606085870312156125bb57600080fd5b84356125c6816122d5565b935060208501356125d6816122d5565b925060408501356001600160401b038111156125f157600080fd5b6125fd87828801612561565b95989497509550505050565b6001600160401b03811681146112e857600080fd5b60008060008060006080868803121561263657600080fd5b8535612641816122d5565b9450602086013561265181612609565b9350604086013561266181612609565b925060608601356001600160401b0381111561267c57600080fd5b61268888828901612497565b969995985093965092949392505050565b600080600080600080600060c0888a0312156126b457600080fd5b87356126bf816122d5565b965060208801356126cf81612609565b955060408801356126df81612609565b945060608801356126ef816122d5565b93506080880135925060a08801356001600160401b0381111561271157600080fd5b61271d8a828b01612497565b989b979a50959850939692959293505050565b6000806040838503121561274357600080fd5b823561274e816122d5565b915060208301356001600160401b0381111561248157600080fd5b6000806020838503121561277c57600080fd5b82356001600160401b0381111561279257600080fd5b61251485828601612561565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b8181101561281c5761280983855161279e565b92840192608092909201916001016127f6565b50909695505050505050565b60006020828403121561283a57600080fd5b8135610867816122d5565b6020808252825182820181905260009190848201906040850190845b8181101561281c57835183529284019291840191600101612861565b60008060006060848603121561289257600080fd5b833561289d816122d5565b95602085013595506040909401359392505050565b80151581146112e857600080fd5b600080604083850312156128d357600080fd5b82356128de816122d5565b915060208301356128ee816128b2565b809150509250929050565b60008060006060848603121561290e57600080fd5b83359250602084013591506040840135612927816128b2565b809150509250925092565b6000806000806080858703121561294857600080fd5b8435612953816122d5565b93506020850135612963816122d5565b92506040850135915060608501356001600160401b0381111561298557600080fd5b612991878288016123ac565b91505092959194509250565b6080810161071f828461279e565b6000806000606084860312156129c057600080fd5b83356129cb816122d5565b925060208401356129db81612609565b91506040840135612927816122d5565b600080604083850312156129fe57600080fd5b8235612a09816122d5565b915060208301356128ee816122d5565b600181811c90821680612a2d57607f821691505b602082108103612a4d57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215612a6557600080fd5b5051919050565b601f8211156108fc576000816000526020600020601f850160051c81016020861015612a955750805b601f850160051c820191505b81811015612ab457828155600101612aa1565b505050505050565b6001600160401b03831115612ad357612ad3612316565b612ae783612ae18354612a19565b83612a6c565b6000601f841160018114612b1b5760008515612b035750838201355b600019600387901b1c1916600186901b1783556109a1565b600083815260209020601f19861690835b82811015612b4c5786850135825560209485019460019092019101612b2c565b5086821015612b695760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052603260045260246000fd5b60008351612ba3818460208801612259565b835190830190612bb7818360208801612259565b01949350505050565b634e487b7160e01b600052601160045260246000fd5b600081612be557612be5612bc0565b506000190190565b805161103881612609565b8051611038816122d5565b80516004811061103857600080fd5b8051611038816128b2565b600082601f830112612c2e57600080fd5b8151612c3c6123cb82612385565b818152846020838601011115612c5157600080fd5b6108a1826020830160208701612259565b600082601f830112612c7357600080fd5b815160206001600160401b0380831115612c8f57612c8f612316565b8260051b612c9e838201612355565b9384528581018301938381019088861115612cb857600080fd5b84880192505b85831015612cf457825184811115612cd65760008081fd5b612ce48a87838c0101612c1d565b8352509184019190840190612cbe565b98975050505050505050565b600060208284031215612d1257600080fd5b81516001600160401b0380821115612d2957600080fd5b908301906101408286031215612d3e57600080fd5b612d4661232c565b612d4f83612bed565b8152612d5d60208401612bed565b6020820152612d6e60408401612bed565b6040820152612d7f60608401612bed565b6060820152612d9060808401612bf8565b6080820152612da160a08401612bed565b60a0820152612db260c08401612c03565b60c0820152612dc360e08401612c12565b60e08201526101008084015183811115612ddc57600080fd5b612de888828701612c62565b8284015250506101208084015183811115612e0257600080fd5b612e0e88828701612c1d565b918301919091525095945050505050565b600060208284031215612e3157600080fd5b8151610867816122d5565b81516001600160401b03811115612e5557612e55612316565b612e6981612e638454612a19565b84612a6c565b602080601f831160018114612e9e5760008415612e865750858301515b600019600386901b1c1916600185901b178555612ab4565b600085815260208120601f198616915b82811015612ecd57888601518255948401946001909101908401612eae565b5085821015612eeb5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612f2e9083018461227d565b9695505050505050565b600060208284031215612f4a57600080fd5b815161086781612226565b60008251612f67818460208701612259565b9190910192915050565b8082018082111561071f5761071f612bc056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbcb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc00ee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa26469706673582212201536c628a6d4f444810d0fdbf306925fc6b24cf263213566b811731b3ea247b864736f6c63430008180033

Deployed Bytecode

0x6080604052600436106102305760003560e01c806370a082311161012e578063b7f0f277116100ab578063e086e5ec1161006f578063e086e5ec1461066b578063e33361f414610680578063e830b5c7146103e4578063e985e9c514610693578063f2fde38b146106b357600080fd5b8063b7f0f277146105cb578063b88d4fde146105eb578063c23dc68f146105fe578063c87b56dd1461062b578063d8e5c46e1461064b57600080fd5b806395d89b41116100f257806395d89b411461052557806399a2557a1461053a578063a14481941461055a578063a22cb4651461057a578063ad3cb1cc1461059a57600080fd5b806370a0823114610499578063715018a6146104b95780638129fc1c146104ce5780638462151c146104e35780638da5cb5b1461051057600080fd5b806324cf6f0f116101bc5780634f1ef286116101805780634f1ef2861461040457806352d1902d1461041757806355f804b31461042c5780635bbb21771461044c5780636352211e1461047957600080fd5b806324cf6f0f1461038857806333039d3d146103a85780633398b4ed146103be57806342842e0e146103d15780634466507a146103e457600080fd5b806312edb34f1161020357806312edb34f146102d95780631626ba7e1461031257806318160ddd146103325780632241640d1461035557806323b872dd1461037557600080fd5b806301ffc9a71461023557806306fdde031461026a578063081812fc1461028c578063095ea7b3146102c4575b600080fd5b34801561024157600080fd5b5061025561025036600461223c565b6106d3565b60405190151581526020015b60405180910390f35b34801561027657600080fd5b5061027f610725565b60405161026191906122a9565b34801561029857600080fd5b506102ac6102a73660046122bc565b6107c0565b6040516001600160a01b039091168152602001610261565b6102d76102d23660046122ea565b610804565b005b3480156102e557600080fd5b506102f96102f4366004612402565b610814565b6040516001600160e01b03199091168152602001610261565b34801561031e57600080fd5b506102f961032d366004612451565b61086e565b34801561033e57600080fd5b506103476108a9565b604051908152602001610261565b34801561036157600080fd5b506102d76103703660046124df565b6108c8565b6102d7610383366004612520565b610901565b34801561039457600080fd5b506102d76103a33660046125a5565b61095b565b3480156103b457600080fd5b506103476103e881565b6102d76103cc36600461261e565b6109a8565b6102d76103df366004612520565b6109f3565b3480156103f057600080fd5b506102d76103ff366004612699565b610a0e565b6102d7610412366004612730565b610a27565b34801561042357600080fd5b50610347610a42565b34801561043857600080fd5b506102d76104473660046124df565b610a5f565b34801561045857600080fd5b5061046c610467366004612769565b610a93565b60405161026191906127da565b34801561048557600080fd5b506102ac6104943660046122bc565b610adf565b3480156104a557600080fd5b506103476104b4366004612828565b610aea565b3480156104c557600080fd5b506102d7610b49565b3480156104da57600080fd5b506102d7610b5d565b3480156104ef57600080fd5b506105036104fe366004612828565b610dbf565b6040516102619190612845565b34801561051c57600080fd5b506102ac610deb565b34801561053157600080fd5b5061027f610e19565b34801561054657600080fd5b5061050361055536600461287d565b610e31565b34801561056657600080fd5b506102d76105753660046122ea565b610e3e565b34801561058657600080fd5b506102d76105953660046128c0565b610e50565b3480156105a657600080fd5b5061027f604051806040016040528060058152602001640352e302e360dc1b81525081565b3480156105d757600080fd5b506102d76105e63660046128f9565b610ecd565b6102d76105f9366004612932565b610fa1565b34801561060a57600080fd5b5061061e6106193660046122bc565b610fe2565b604051610261919061299d565b34801561063757600080fd5b5061027f6106463660046122bc565b61103d565b34801561065757600080fd5b506102d76106663660046129ab565b611151565b34801561067757600080fd5b506102d76111d3565b6102d761068e36600461261e565b61125a565b34801561069f57600080fd5b506102556106ae3660046129eb565b611270565b3480156106bf57600080fd5b506102d76106ce366004612828565b6112ad565b60006301ffc9a760e01b6001600160e01b03198316148061070457506380ac58cd60e01b6001600160e01b03198316145b8061071f5750635b5e139f60e01b6001600160e01b03198316145b92915050565b606061072f6112eb565b600201805461073d90612a19565b80601f016020809104026020016040519081016040528092919081815260200182805461076990612a19565b80156107b65780601f1061078b576101008083540402835291602001916107b6565b820191906000526020600020905b81548152906001019060200180831161079957829003601f168201915b5050505050905090565b60006107cb8261130f565b6107df576107df6333d1c03960e21b611365565b6107e76112eb565b60009283526006016020525060409020546001600160a01b031690565b6108108282600161136f565b5050565b60008381527fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc046020908152604080832085845290915281205460ff1661085b576000610864565b6312edb34f60e01b5b90505b9392505050565b600080828060200190518101906108859190612a53565b90506108a1818560405180602001604052806000815250610814565b949350505050565b6000806108b46112eb565b600101546108c06112eb565b540303905090565b6108d0611420565b7fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc056108fc828483612abc565b505050565b60008181527fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc03602052604090205460ff161561095057604051634851657960e11b815260040160405180910390fd5b6108fc838383611452565b60005b818110156109a157610999858585858581811061097d5761097d612b7b565b9050602002013560405180602001604052806000815250610fa1565b60010161095e565b5050505050565b6001600080516020612fa58339815191525b60030160006109cd338989898989611615565b81526020810191909152604001600020805460ff19169115159190911790555050505050565b6108fc83838360405180602001604052806000815250610fa1565b604051634851657960e11b815260040160405180910390fd5b610a2f611791565b610a3882611836565b610810828261183e565b6000610a4c6118fb565b50600080516020612f8583398151915290565b610a67611420565b7fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc026108fc828483612abc565b60408051828152600583901b8082016020019092526060915b8015610ad757601f1980820191860101356000610ac882610fe2565b8484016020015250610aac9050565b509392505050565b600061071f82611944565b60006001600160a01b038216610b0a57610b0a6323d3ad8160e21b611365565b6001600160401b03610b1a6112eb565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b610b51611420565b610b5b60006119ff565b565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b0316600081158015610ba25750825b90506000826001600160401b03166001148015610bbe5750303b155b905081158015610bcc575080155b15610bea5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610c1457845460ff60401b1916600160401b1785555b600080516020612fc583398151915254610100900460ff16610c4957600080516020612fc58339815191525460ff1615610c4d565b303b155b610cc45760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e747261637460448201527f20697320616c726561647920696e697469616c697a656400000000000000000060648201526084015b60405180910390fd5b600080516020612fc583398151915254610100900460ff16158015610d0057600080516020612fc5833981519152805461ffff19166101011790555b610d4a604051806040016040528060088152602001675369676e5061737360c01b815250604051806040016040528060088152602001675349474e5041535360c01b815250611a70565b610d5333611b30565b8015610d7257600080516020612fc5833981519152805461ff00191690555b5083156109a157845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15050505050565b6060600080610dcc611b38565b905060608183146108a157610de2858484611b48565b95945050505050565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6060610e236112eb565b600301805461073d90612a19565b6060610864848484611b48565b610e46611420565b6108108282611c4a565b80610e596112eb565b336000818152600792909201602090815260408084206001600160a01b03881680865290835293819020805460ff19169515159590951790945592518415158152919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b33610ed784610adf565b6001600160a01b031614610efe57604051634851657960e11b815260040160405180910390fd5b60008381527fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc04602090815260408083208584529091529020805460ff19168215151790557fd09cf6d215eba644959a0259fe17dd671d64293754f8fe16b2da1be2218ad5ff610f6c84610adf565b604080516001600160a01b039092168252602082018690528101849052821515606082015260800160405180910390a1505050565b610fac848484610901565b6001600160a01b0383163b15610fdc57610fc884848484611c64565b610fdc57610fdc6368d2bf6b60e11b611365565b50505050565b60408051608081018252600080825260208201819052918101829052606081019190915261100e611b38565b821015611038575b61101f82611dcf565b61102f5760001990910190611016565b61071f82611d46565b919050565b60606110488261130f565b61105c5761105c630a14c4b560e41b611365565b6000611066611def565b90508051600003611120577fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc05805461109d90612a19565b80601f01602080910402602001604051908101604052809291908181526020018280546110c990612a19565b80156111165780601f106110eb57610100808354040283529160200191611116565b820191906000526020600020905b8154815290600101906020018083116110f957829003601f168201915b5050505050610867565b8061112a84611e05565b60405160200161113b929190612b91565b6040516020818303038152906040529392505050565b611159611420565b600080516020612fa583398151915280546001600160401b0393909316600160a01b026001600160e01b03199093166001600160a01b0394851617929092179091557fb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc018054919092166001600160a01b0319909116179055565b6111db611420565b6000806111e6610deb565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114611230576040519150601f19603f3d011682016040523d82523d6000602084013e611235565b606091505b509150915081610810578060405163d351ff9b60e01b8152600401610cbb91906122a9565b6000600080516020612fa58339815191526109ba565b600061127a6112eb565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6112b5611420565b6001600160a01b0381166112df57604051631e4fbdf760e01b815260006004820152602401610cbb565b6112e8816119ff565b50565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b60006113196112eb565b548210156110385760005b61132c6112eb565b6000848152600491909101602052604081205491508190036113585761135183612bd6565b9250611324565b600160e01b161592915050565b8060005260046000fd5b600061137a83610adf565b90508180156113925750336001600160a01b03821614155b156113b5576113a18133611270565b6113b5576113b56367d9dca160e11b611365565b836113be6112eb565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b33611429610deb565b6001600160a01b031614610b5b5760405163118cdaa760e01b8152336004820152602401610cbb565b600061145d82611944565b6001600160a01b0394851694909150811684146114835761148362a1148160e81b611365565b60008061148f84611e49565b915091506114b4818761149f3390565b6001600160a01b039081169116811491141790565b6114d6576114c28633611270565b6114d6576114d6632ce44b5f60e11b611365565b80156114e157600082555b6114e96112eb565b6001600160a01b03871660009081526005919091016020526040902080546000190190556115156112eb565b6001600160a01b03861660008181526005929092016020526040909120805460010190554260a01b17600160e11b1761154c6112eb565b60008681526004919091016020526040812091909155600160e11b841690036115c2576001840161157b6112eb565b6000828152600491909101602052604081205490036115c05761159c6112eb565b5481146115c057836115ac6112eb565b600083815260049190910160205260409020555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a48060000361160c5761160c633a954ecd60e21b611365565b50505050505050565b600080516020612fa58339815191528054600091906001600160a01b038981169116141580611658575080546001600160401b03878116600160a01b9092041614155b80611673575060018101546001600160a01b03888116911614155b1561169157604051634851657960e11b815260040160405180910390fd5b805460405162c44a5160e71b81526001600160401b03871660048201526000916001600160a01b031690636225288090602401600060405180830381865afa1580156116e1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117099190810190612d00565b610100015160008151811061172057611720612b7b565b602002602001015180602001905181019061173b9190612e1f565b9050611749848601866122bc565b9250806001600160a01b031661175e84610adf565b6001600160a01b03161461178557604051635cb045db60e01b815260040160405180910390fd5b50509695505050505050565b306001600160a01b037f000000000000000000000000f398303b3e682f930b063ab093c29e50c5eb533e16148061181857507f000000000000000000000000f398303b3e682f930b063ab093c29e50c5eb533e6001600160a01b031661180c600080516020612f85833981519152546001600160a01b031690565b6001600160a01b031614155b15610b5b5760405163703e46dd60e11b815260040160405180910390fd5b6112e8611420565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611898575060408051601f3d908101601f1916820190925261189591810190612a53565b60015b6118c057604051634c9c8ce360e01b81526001600160a01b0383166004820152602401610cbb565b600080516020612f8583398151915281146118f157604051632a87526960e21b815260048101829052602401610cbb565b6108fc8383611e71565b306001600160a01b037f000000000000000000000000f398303b3e682f930b063ab093c29e50c5eb533e1614610b5b5760405163703e46dd60e11b815260040160405180910390fd5b600061194e6112eb565b600083815260049190910160205260409020549050806000036119dc576119736112eb565b54821061198a5761198a636f96cda160e11b611365565b6119926112eb565b60001990920160008181526004939093016020526040909220549050801561198a57600160e01b81166000036119c757919050565b6119d7636f96cda160e11b611365565b61198a565b600160e01b81166000036119ef57919050565b611038636f96cda160e11b611365565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b600080516020612fc583398151915254610100900460ff16611af15760405162461bcd60e51b815260206004820152603460248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604482015273206973206e6f7420696e697469616c697a696e6760601b6064820152608401610cbb565b81611afa6112eb565b60020190611b089082612e3c565b5080611b126112eb565b60030190611b209082612e3c565b506000611b2b6112eb565b555050565b6112b5611ec7565b6000611b426112eb565b54919050565b6060818310611b6157611b61631960ccad60e11b611365565b6000611b6b611b38565b905080808410611b79578093505b6000611b8487610aea565b9050848610611b91575060005b8015611c40578086860311611ba557508484035b604080516001830160051b81019182905294506000611bc388610fe2565b905060008160400151611bd4575080515b60005b611be08a611d46565b9250604083015160008114611bf85760009250611c1d565b835115611c0457835192505b8b831860601b611c1d576001820191508a8260051b8a01525b5060018a01995083604052888a1480611c3557508481145b15611bd75787525050505b5050509392505050565b610810828260405180602001604052806000815250611f10565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611c99903390899088908890600401612efb565b6020604051808303816000875af1925050508015611cd4575060408051601f3d908101601f19168201909252611cd191810190612f38565b60015b611d29573d808015611d02576040519150601f19603f3d011682016040523d82523d6000602084013e611d07565b606091505b508051600003611d2157611d216368d2bf6b60e11b611365565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60408051608081018252600080825260208201819052918101829052606081019190915261071f611d756112eb565b60008481526004919091016020526040902054604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6000611dd96112eb565b6000928352600401602052506040902054151590565b6060600080516020612fa583398151915261072f565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611e1f5750819003601f19909101908152919050565b6000806000611e566112eb565b60009485526006016020525050604090912080549092909150565b611e7a82611f7d565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a2805115611ebf576108fc8282611fe2565b61081061204f565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610b5b57604051631afcd79f60e31b815260040160405180910390fd5b611f1a838361206e565b6001600160a01b0383163b156108fc576000611f346112eb565b5490508281035b611f4e6000868380600101945086611c64565b611f6257611f626368d2bf6b60e11b611365565b818110611f3b5781611f726112eb565b54146109a157600080fd5b806001600160a01b03163b600003611fb357604051634c9c8ce360e01b81526001600160a01b0382166004820152602401610cbb565b600080516020612f8583398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6060600080846001600160a01b031684604051611fff9190612f55565b600060405180830381855af49150503d806000811461203a576040519150601f19603f3d011682016040523d82523d6000602084013e61203f565b606091505b5091509150610de28583836120ad565b3415610b5b5760405163b398979f60e01b815260040160405180910390fd5b6103e88161207a6108a9565b6120849190612f71565b11156120a357604051633bd7ad7760e21b815260040160405180910390fd5b6108108282612109565b6060826120c2576120bd826121fd565b610867565b81511580156120d957506001600160a01b0384163b155b1561210257604051639996b31560e01b81526001600160a01b0385166004820152602401610cbb565b5080610867565b60006121136112eb565b549050600082900361212f5761212f63b562e8dd60e01b611365565b6001600160a01b0383164260a01b6001841460e11b171761214e6112eb565b600083815260049190910160205260409020556801000000000000000182026121756112eb565b6001600160a01b03851660008181526005929092016020526040822080549093019092558190036121af576121af622e076360e81b611365565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a48181600101915081036121b457816121f36112eb565b55506108fc915050565b80511561220d5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160e01b0319811681146112e857600080fd5b60006020828403121561224e57600080fd5b813561086781612226565b60005b8381101561227457818101518382015260200161225c565b50506000910152565b60008151808452612295816020860160208601612259565b601f01601f19169290920160200192915050565b602081526000610867602083018461227d565b6000602082840312156122ce57600080fd5b5035919050565b6001600160a01b03811681146112e857600080fd5b600080604083850312156122fd57600080fd5b8235612308816122d5565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60405161014081016001600160401b038111828210171561234f5761234f612316565b60405290565b604051601f8201601f191681016001600160401b038111828210171561237d5761237d612316565b604052919050565b60006001600160401b0382111561239e5761239e612316565b50601f01601f191660200190565b600082601f8301126123bd57600080fd5b81356123d06123cb82612385565b612355565b8181528460208386010111156123e557600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561241757600080fd5b833592506020840135915060408401356001600160401b0381111561243b57600080fd5b612447868287016123ac565b9150509250925092565b6000806040838503121561246457600080fd5b8235915060208301356001600160401b0381111561248157600080fd5b61248d858286016123ac565b9150509250929050565b60008083601f8401126124a957600080fd5b5081356001600160401b038111156124c057600080fd5b6020830191508360208285010111156124d857600080fd5b9250929050565b600080602083850312156124f257600080fd5b82356001600160401b0381111561250857600080fd5b61251485828601612497565b90969095509350505050565b60008060006060848603121561253557600080fd5b8335612540816122d5565b92506020840135612550816122d5565b929592945050506040919091013590565b60008083601f84011261257357600080fd5b5081356001600160401b0381111561258a57600080fd5b6020830191508360208260051b85010111156124d857600080fd5b600080600080606085870312156125bb57600080fd5b84356125c6816122d5565b935060208501356125d6816122d5565b925060408501356001600160401b038111156125f157600080fd5b6125fd87828801612561565b95989497509550505050565b6001600160401b03811681146112e857600080fd5b60008060008060006080868803121561263657600080fd5b8535612641816122d5565b9450602086013561265181612609565b9350604086013561266181612609565b925060608601356001600160401b0381111561267c57600080fd5b61268888828901612497565b969995985093965092949392505050565b600080600080600080600060c0888a0312156126b457600080fd5b87356126bf816122d5565b965060208801356126cf81612609565b955060408801356126df81612609565b945060608801356126ef816122d5565b93506080880135925060a08801356001600160401b0381111561271157600080fd5b61271d8a828b01612497565b989b979a50959850939692959293505050565b6000806040838503121561274357600080fd5b823561274e816122d5565b915060208301356001600160401b0381111561248157600080fd5b6000806020838503121561277c57600080fd5b82356001600160401b0381111561279257600080fd5b61251485828601612561565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b8181101561281c5761280983855161279e565b92840192608092909201916001016127f6565b50909695505050505050565b60006020828403121561283a57600080fd5b8135610867816122d5565b6020808252825182820181905260009190848201906040850190845b8181101561281c57835183529284019291840191600101612861565b60008060006060848603121561289257600080fd5b833561289d816122d5565b95602085013595506040909401359392505050565b80151581146112e857600080fd5b600080604083850312156128d357600080fd5b82356128de816122d5565b915060208301356128ee816128b2565b809150509250929050565b60008060006060848603121561290e57600080fd5b83359250602084013591506040840135612927816128b2565b809150509250925092565b6000806000806080858703121561294857600080fd5b8435612953816122d5565b93506020850135612963816122d5565b92506040850135915060608501356001600160401b0381111561298557600080fd5b612991878288016123ac565b91505092959194509250565b6080810161071f828461279e565b6000806000606084860312156129c057600080fd5b83356129cb816122d5565b925060208401356129db81612609565b91506040840135612927816122d5565b600080604083850312156129fe57600080fd5b8235612a09816122d5565b915060208301356128ee816122d5565b600181811c90821680612a2d57607f821691505b602082108103612a4d57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215612a6557600080fd5b5051919050565b601f8211156108fc576000816000526020600020601f850160051c81016020861015612a955750805b601f850160051c820191505b81811015612ab457828155600101612aa1565b505050505050565b6001600160401b03831115612ad357612ad3612316565b612ae783612ae18354612a19565b83612a6c565b6000601f841160018114612b1b5760008515612b035750838201355b600019600387901b1c1916600186901b1783556109a1565b600083815260209020601f19861690835b82811015612b4c5786850135825560209485019460019092019101612b2c565b5086821015612b695760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052603260045260246000fd5b60008351612ba3818460208801612259565b835190830190612bb7818360208801612259565b01949350505050565b634e487b7160e01b600052601160045260246000fd5b600081612be557612be5612bc0565b506000190190565b805161103881612609565b8051611038816122d5565b80516004811061103857600080fd5b8051611038816128b2565b600082601f830112612c2e57600080fd5b8151612c3c6123cb82612385565b818152846020838601011115612c5157600080fd5b6108a1826020830160208701612259565b600082601f830112612c7357600080fd5b815160206001600160401b0380831115612c8f57612c8f612316565b8260051b612c9e838201612355565b9384528581018301938381019088861115612cb857600080fd5b84880192505b85831015612cf457825184811115612cd65760008081fd5b612ce48a87838c0101612c1d565b8352509184019190840190612cbe565b98975050505050505050565b600060208284031215612d1257600080fd5b81516001600160401b0380821115612d2957600080fd5b908301906101408286031215612d3e57600080fd5b612d4661232c565b612d4f83612bed565b8152612d5d60208401612bed565b6020820152612d6e60408401612bed565b6040820152612d7f60608401612bed565b6060820152612d9060808401612bf8565b6080820152612da160a08401612bed565b60a0820152612db260c08401612c03565b60c0820152612dc360e08401612c12565b60e08201526101008084015183811115612ddc57600080fd5b612de888828701612c62565b8284015250506101208084015183811115612e0257600080fd5b612e0e88828701612c1d565b918301919091525095945050505050565b600060208284031215612e3157600080fd5b8151610867816122d5565b81516001600160401b03811115612e5557612e55612316565b612e6981612e638454612a19565b84612a6c565b602080601f831160018114612e9e5760008415612e865750858301515b600019600386901b1c1916600185901b178555612ab4565b600085815260208120601f198616915b82811015612ecd57888601518255948401946001909101908401612eae565b5085821015612eeb5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612f2e9083018461227d565b9695505050505050565b600060208284031215612f4a57600080fd5b815161086781612226565b60008251612f67818460208701612259565b9190910192915050565b8082018082111561071f5761071f612bc056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbcb9b3abae6ccc863f7f9206c4853133fd420450b77b02f95a306191ef8077bc00ee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85fa26469706673582212201536c628a6d4f444810d0fdbf306925fc6b24cf263213566b811731b3ea247b864736f6c63430008180033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.