ETH Price: $2,665.87 (+0.33%)

Transaction Decoder

Block:
17403580 at Jun-04-2023 12:04:59 AM +UTC
Transaction Fee:
0.001651912146150752 ETH $4.40
Gas Used:
74,224 Gas / 22.255768298 Gwei

Account State Difference:

  Address   Before After State Difference Code
0x25aF3A23...7e25107D9
0.108632090296558759 Eth
Nonce: 152
0.106980178150408007 Eth
Nonce: 153
0.001651912146150752
(Faith Builder)
2.984544044757010672 Eth2.984618268757010672 Eth0.000074224

Execution Trace

UnchainedMilady.CALL( )
  • Miladys.balanceOf( owner=0x25aF3A23b395E1699d8422C45623F6d7e25107D9 ) => ( 0 )
  • SSRWives.balanceOf( owner=0x25aF3A23b395E1699d8422C45623F6d7e25107D9 ) => ( 0 )
  • Archetype.balanceOf( owner=0x25aF3A23b395E1699d8422C45623F6d7e25107D9 ) => ( 0 )
    • Archetype.balanceOf( owner=0x25aF3A23b395E1699d8422C45623F6d7e25107D9 ) => ( 0 )
    • MiladyAura.balanceOf( owner=0x25aF3A23b395E1699d8422C45623F6d7e25107D9 ) => ( 0 )
    • WHITEHEARTS.balanceOf( owner=0x25aF3A23b395E1699d8422C45623F6d7e25107D9 ) => ( 0 )
    • SIM2.balanceOf( owner=0x25aF3A23b395E1699d8422C45623F6d7e25107D9 ) => ( 0 )
    • SIMCARD1.balanceOf( owner=0x25aF3A23b395E1699d8422C45623F6d7e25107D9 ) => ( 0 )
    • Dropicall.balanceOf( owner=0x25aF3A23b395E1699d8422C45623F6d7e25107D9 ) => ( 0 )
      File 1 of 10: UnchainedMilady
      // Sources flattened with hardhat v2.12.6 https://hardhat.org
      
      // File @openzeppelin/contracts/utils/[email protected]
      // SPDX-License-Identifier: MIT
      
      
      // OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Provides information about the current execution context, including the
       * sender of the transaction and its data. While these are generally available
       * via msg.sender and msg.data, they should not be accessed in such a direct
       * manner, since when dealing with meta-transactions the account sending and
       * paying for execution may not be the actual sender (as far as an application
       * is concerned).
       *
       * This contract is only required for intermediate, library-like contracts.
       */
      abstract contract Context {
          function _msgSender() internal view virtual returns (address) {
              return msg.sender;
          }
      
          function _msgData() internal view virtual returns (bytes calldata) {
              return msg.data;
          }
      }
      
      
      // File @openzeppelin/contracts/access/[email protected]
      
      
      // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract Ownable is Context {
          address private _owner;
      
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
      
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          constructor() {
              _transferOwnership(_msgSender());
          }
      
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              _checkOwner();
              _;
          }
      
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
      
          /**
           * @dev Throws if the sender is not the owner.
           */
          function _checkOwner() internal view virtual {
              require(owner() == _msgSender(), "Ownable: caller is not the owner");
          }
      
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              _transferOwnership(address(0));
          }
      
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              _transferOwnership(newOwner);
          }
      
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Internal function without access restriction.
           */
          function _transferOwnership(address newOwner) internal virtual {
              address oldOwner = _owner;
              _owner = newOwner;
              emit OwnershipTransferred(oldOwner, newOwner);
          }
      }
      
      
      // File @openzeppelin/contracts/utils/introspection/[email protected]
      
      
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165 {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      
      
      // File @openzeppelin/contracts/token/ERC721/[email protected]
      
      
      // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Required interface of an ERC721 compliant contract.
       */
      interface IERC721 is IERC165 {
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
      
          /**
           * @dev Returns the number of tokens in ``owner``'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
      
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes calldata data
          ) external;
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
           * are aware of the ERC721 protocol to prevent tokens from being forever locked.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external;
      
          /**
           * @dev Transfers `tokenId` token from `from` to `to`.
           *
           * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
           * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
           * understand this adds an external call which potentially creates a reentrancy vulnerability.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           *
           * Emits a {Transfer} event.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external;
      
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external;
      
          /**
           * @dev Approve or remove `operator` as an operator for the caller.
           * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
           *
           * Requirements:
           *
           * - The `operator` cannot be the caller.
           *
           * Emits an {ApprovalForAll} event.
           */
          function setApprovalForAll(address operator, bool _approved) external;
      
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
      
          /**
           * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
           *
           * See {setApprovalForAll}
           */
          function isApprovedForAll(address owner, address operator) external view returns (bool);
      }
      
      
      // File erc721a/contracts/[email protected]
      
      
      // ERC721A Contracts v4.2.3
      // Creator: Chiru Labs
      
      pragma solidity ^0.8.4;
      
      /**
       * @dev Interface of ERC721A.
       */
      interface IERC721A {
          /**
           * The caller must own the token or be an approved operator.
           */
          error ApprovalCallerNotOwnerNorApproved();
      
          /**
           * The token does not exist.
           */
          error ApprovalQueryForNonexistentToken();
      
          /**
           * Cannot query the balance for the zero address.
           */
          error BalanceQueryForZeroAddress();
      
          /**
           * Cannot mint to the zero address.
           */
          error MintToZeroAddress();
      
          /**
           * The quantity of tokens minted must be more than zero.
           */
          error MintZeroQuantity();
      
          /**
           * The token does not exist.
           */
          error OwnerQueryForNonexistentToken();
      
          /**
           * The caller must own the token or be an approved operator.
           */
          error TransferCallerNotOwnerNorApproved();
      
          /**
           * The token must be owned by `from`.
           */
          error TransferFromIncorrectOwner();
      
          /**
           * Cannot safely transfer to a contract that does not implement the
           * ERC721Receiver interface.
           */
          error TransferToNonERC721ReceiverImplementer();
      
          /**
           * Cannot transfer to the zero address.
           */
          error TransferToZeroAddress();
      
          /**
           * The token does not exist.
           */
          error URIQueryForNonexistentToken();
      
          /**
           * The `quantity` minted with ERC2309 exceeds the safety limit.
           */
          error MintERC2309QuantityExceedsLimit();
      
          /**
           * The `extraData` cannot be set on an unintialized ownership slot.
           */
          error OwnershipNotInitializedForExtraData();
      
          // =============================================================
          //                            STRUCTS
          // =============================================================
      
          struct TokenOwnership {
              // The address of the owner.
              address addr;
              // Stores the start time of ownership with minimal overhead for tokenomics.
              uint64 startTimestamp;
              // Whether the token has been burned.
              bool burned;
              // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
              uint24 extraData;
          }
      
          // =============================================================
          //                         TOKEN COUNTERS
          // =============================================================
      
          /**
           * @dev Returns the total number of tokens in existence.
           * Burned tokens will reduce the count.
           * To get the total number of tokens minted, please see {_totalMinted}.
           */
          function totalSupply() external view returns (uint256);
      
          // =============================================================
          //                            IERC165
          // =============================================================
      
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      
          // =============================================================
          //                            IERC721
          // =============================================================
      
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables or disables
           * (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
      
          /**
           * @dev Returns the number of tokens in `owner`'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
      
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`,
           * checking first that contract recipients are aware of the ERC721 protocol
           * to prevent tokens from being forever locked.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be have been allowed to move
           * this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement
           * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes calldata data
          ) external payable;
      
          /**
           * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external payable;
      
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *
           * WARNING: Usage of this method is discouraged, use {safeTransferFrom}
           * whenever possible.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token
           * by either {approve} or {setApprovalForAll}.
           *
           * Emits a {Transfer} event.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external payable;
      
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the
           * zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external payable;
      
          /**
           * @dev Approve or remove `operator` as an operator for the caller.
           * Operators can call {transferFrom} or {safeTransferFrom}
           * for any token owned by the caller.
           *
           * Requirements:
           *
           * - The `operator` cannot be the caller.
           *
           * Emits an {ApprovalForAll} event.
           */
          function setApprovalForAll(address operator, bool _approved) external;
      
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
      
          /**
           * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
           *
           * See {setApprovalForAll}.
           */
          function isApprovedForAll(address owner, address operator) external view returns (bool);
      
          // =============================================================
          //                        IERC721Metadata
          // =============================================================
      
          /**
           * @dev Returns the token collection name.
           */
          function name() external view returns (string memory);
      
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() external view returns (string memory);
      
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) external view returns (string memory);
      
          // =============================================================
          //                           IERC2309
          // =============================================================
      
          /**
           * @dev Emitted when tokens in `fromTokenId` to `toTokenId`
           * (inclusive) is transferred from `from` to `to`, as defined in the
           * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
           *
           * See {_mintERC2309} for more details.
           */
          event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
      }
      
      
      // File erc721a/contracts/[email protected]
      
      
      // ERC721A Contracts v4.2.3
      // Creator: Chiru Labs
      
      pragma solidity ^0.8.4;
      
      /**
       * @dev Interface of ERC721 token receiver.
       */
      interface ERC721A__IERC721Receiver {
          function onERC721Received(
              address operator,
              address from,
              uint256 tokenId,
              bytes calldata data
          ) external returns (bytes4);
      }
      
      /**
       * @title ERC721A
       *
       * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
       * Non-Fungible Token Standard, including the Metadata extension.
       * Optimized for lower gas during batch mints.
       *
       * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
       * starting from `_startTokenId()`.
       *
       * Assumptions:
       *
       * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
       * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
       */
      contract ERC721A is IERC721A {
          // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
          struct TokenApprovalRef {
              address value;
          }
      
          // =============================================================
          //                           CONSTANTS
          // =============================================================
      
          // Mask of an entry in packed address data.
          uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
      
          // The bit position of `numberMinted` in packed address data.
          uint256 private constant _BITPOS_NUMBER_MINTED = 64;
      
          // The bit position of `numberBurned` in packed address data.
          uint256 private constant _BITPOS_NUMBER_BURNED = 128;
      
          // The bit position of `aux` in packed address data.
          uint256 private constant _BITPOS_AUX = 192;
      
          // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
          uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
      
          // The bit position of `startTimestamp` in packed ownership.
          uint256 private constant _BITPOS_START_TIMESTAMP = 160;
      
          // The bit mask of the `burned` bit in packed ownership.
          uint256 private constant _BITMASK_BURNED = 1 << 224;
      
          // The bit position of the `nextInitialized` bit in packed ownership.
          uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
      
          // The bit mask of the `nextInitialized` bit in packed ownership.
          uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
      
          // The bit position of `extraData` in packed ownership.
          uint256 private constant _BITPOS_EXTRA_DATA = 232;
      
          // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
          uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
      
          // The mask of the lower 160 bits for addresses.
          uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
      
          // The maximum `quantity` that can be minted with {_mintERC2309}.
          // This limit is to prevent overflows on the address data entries.
          // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
          // is required to cause an overflow, which is unrealistic.
          uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
      
          // The `Transfer` event signature is given by:
          // `keccak256(bytes("Transfer(address,address,uint256)"))`.
          bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
              0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
      
          // =============================================================
          //                            STORAGE
          // =============================================================
      
          // The next token ID to be minted.
          uint256 private _currentIndex;
      
          // The number of tokens burned.
          uint256 private _burnCounter;
      
          // Token name
          string private _name;
      
          // Token symbol
          string private _symbol;
      
          // Mapping from token ID to ownership details
          // An empty struct value does not necessarily mean the token is unowned.
          // See {_packedOwnershipOf} implementation for details.
          //
          // Bits Layout:
          // - [0..159]   `addr`
          // - [160..223] `startTimestamp`
          // - [224]      `burned`
          // - [225]      `nextInitialized`
          // - [232..255] `extraData`
          mapping(uint256 => uint256) private _packedOwnerships;
      
          // Mapping owner address to address data.
          //
          // Bits Layout:
          // - [0..63]    `balance`
          // - [64..127]  `numberMinted`
          // - [128..191] `numberBurned`
          // - [192..255] `aux`
          mapping(address => uint256) private _packedAddressData;
      
          // Mapping from token ID to approved address.
          mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
      
          // Mapping from owner to operator approvals
          mapping(address => mapping(address => bool)) private _operatorApprovals;
      
          // =============================================================
          //                          CONSTRUCTOR
          // =============================================================
      
          constructor(string memory name_, string memory symbol_) {
              _name = name_;
              _symbol = symbol_;
              _currentIndex = _startTokenId();
          }
      
          // =============================================================
          //                   TOKEN COUNTING OPERATIONS
          // =============================================================
      
          /**
           * @dev Returns the starting token ID.
           * To change the starting token ID, please override this function.
           */
          function _startTokenId() internal view virtual returns (uint256) {
              return 0;
          }
      
          /**
           * @dev Returns the next token ID to be minted.
           */
          function _nextTokenId() internal view virtual returns (uint256) {
              return _currentIndex;
          }
      
          /**
           * @dev Returns the total number of tokens in existence.
           * Burned tokens will reduce the count.
           * To get the total number of tokens minted, please see {_totalMinted}.
           */
          function totalSupply() public view virtual override returns (uint256) {
              // Counter underflow is impossible as _burnCounter cannot be incremented
              // more than `_currentIndex - _startTokenId()` times.
              unchecked {
                  return _currentIndex - _burnCounter - _startTokenId();
              }
          }
      
          /**
           * @dev Returns the total amount of tokens minted in the contract.
           */
          function _totalMinted() internal view virtual returns (uint256) {
              // Counter underflow is impossible as `_currentIndex` does not decrement,
              // and it is initialized to `_startTokenId()`.
              unchecked {
                  return _currentIndex - _startTokenId();
              }
          }
      
          /**
           * @dev Returns the total number of tokens burned.
           */
          function _totalBurned() internal view virtual returns (uint256) {
              return _burnCounter;
          }
      
          // =============================================================
          //                    ADDRESS DATA OPERATIONS
          // =============================================================
      
          /**
           * @dev Returns the number of tokens in `owner`'s account.
           */
          function balanceOf(address owner) public view virtual override returns (uint256) {
              if (owner == address(0)) revert BalanceQueryForZeroAddress();
              return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
          }
      
          /**
           * Returns the number of tokens minted by `owner`.
           */
          function _numberMinted(address owner) internal view returns (uint256) {
              return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
          }
      
          /**
           * Returns the number of tokens burned by or on behalf of `owner`.
           */
          function _numberBurned(address owner) internal view returns (uint256) {
              return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
          }
      
          /**
           * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
           */
          function _getAux(address owner) internal view returns (uint64) {
              return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
          }
      
          /**
           * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
           * If there are multiple variables, please pack them into a uint64.
           */
          function _setAux(address owner, uint64 aux) internal virtual {
              uint256 packed = _packedAddressData[owner];
              uint256 auxCasted;
              // Cast `aux` with assembly to avoid redundant masking.
              assembly {
                  auxCasted := aux
              }
              packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
              _packedAddressData[owner] = packed;
          }
      
          // =============================================================
          //                            IERC165
          // =============================================================
      
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30000 gas.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              // The interface IDs are constants representing the first 4 bytes
              // of the XOR of all function selectors in the interface.
              // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
              // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
              return
                  interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
                  interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
                  interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
          }
      
          // =============================================================
          //                        IERC721Metadata
          // =============================================================
      
          /**
           * @dev Returns the token collection name.
           */
          function name() public view virtual override returns (string memory) {
              return _name;
          }
      
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() public view virtual override returns (string memory) {
              return _symbol;
          }
      
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
              if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
      
              string memory baseURI = _baseURI();
              return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
          }
      
          /**
           * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
           * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
           * by default, it can be overridden in child contracts.
           */
          function _baseURI() internal view virtual returns (string memory) {
              return '';
          }
      
          // =============================================================
          //                     OWNERSHIPS OPERATIONS
          // =============================================================
      
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) public view virtual override returns (address) {
              return address(uint160(_packedOwnershipOf(tokenId)));
          }
      
          /**
           * @dev Gas spent here starts off proportional to the maximum mint batch size.
           * It gradually moves to O(1) as tokens get transferred around over time.
           */
          function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
              return _unpackedOwnership(_packedOwnershipOf(tokenId));
          }
      
          /**
           * @dev Returns the unpacked `TokenOwnership` struct at `index`.
           */
          function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
              return _unpackedOwnership(_packedOwnerships[index]);
          }
      
          /**
           * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
           */
          function _initializeOwnershipAt(uint256 index) internal virtual {
              if (_packedOwnerships[index] == 0) {
                  _packedOwnerships[index] = _packedOwnershipOf(index);
              }
          }
      
          /**
           * Returns the packed ownership data of `tokenId`.
           */
          function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
              uint256 curr = tokenId;
      
              unchecked {
                  if (_startTokenId() <= curr)
                      if (curr < _currentIndex) {
                          uint256 packed = _packedOwnerships[curr];
                          // If not burned.
                          if (packed & _BITMASK_BURNED == 0) {
                              // Invariant:
                              // There will always be an initialized ownership slot
                              // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                              // before an unintialized ownership slot
                              // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                              // Hence, `curr` will not underflow.
                              //
                              // We can directly compare the packed value.
                              // If the address is zero, packed will be zero.
                              while (packed == 0) {
                                  packed = _packedOwnerships[--curr];
                              }
                              return packed;
                          }
                      }
              }
              revert OwnerQueryForNonexistentToken();
          }
      
          /**
           * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
           */
          function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
              ownership.addr = address(uint160(packed));
              ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
              ownership.burned = packed & _BITMASK_BURNED != 0;
              ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
          }
      
          /**
           * @dev Packs ownership data into a single uint256.
           */
          function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
              assembly {
                  // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  owner := and(owner, _BITMASK_ADDRESS)
                  // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
                  result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
              }
          }
      
          /**
           * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
           */
          function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
              // For branchless setting of the `nextInitialized` flag.
              assembly {
                  // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
                  result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
              }
          }
      
          // =============================================================
          //                      APPROVAL OPERATIONS
          // =============================================================
      
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the
           * zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) public payable virtual override {
              address owner = ownerOf(tokenId);
      
              if (_msgSenderERC721A() != owner)
                  if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                      revert ApprovalCallerNotOwnerNorApproved();
                  }
      
              _tokenApprovals[tokenId].value = to;
              emit Approval(owner, to, tokenId);
          }
      
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) public view virtual override returns (address) {
              if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
      
              return _tokenApprovals[tokenId].value;
          }
      
          /**
           * @dev Approve or remove `operator` as an operator for the caller.
           * Operators can call {transferFrom} or {safeTransferFrom}
           * for any token owned by the caller.
           *
           * Requirements:
           *
           * - The `operator` cannot be the caller.
           *
           * Emits an {ApprovalForAll} event.
           */
          function setApprovalForAll(address operator, bool approved) public virtual override {
              _operatorApprovals[_msgSenderERC721A()][operator] = approved;
              emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
          }
      
          /**
           * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
           *
           * See {setApprovalForAll}.
           */
          function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
              return _operatorApprovals[owner][operator];
          }
      
          /**
           * @dev Returns whether `tokenId` exists.
           *
           * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
           *
           * Tokens start existing when they are minted. See {_mint}.
           */
          function _exists(uint256 tokenId) internal view virtual returns (bool) {
              return
                  _startTokenId() <= tokenId &&
                  tokenId < _currentIndex && // If within bounds,
                  _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
          }
      
          /**
           * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
           */
          function _isSenderApprovedOrOwner(
              address approvedAddress,
              address owner,
              address msgSender
          ) private pure returns (bool result) {
              assembly {
                  // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  owner := and(owner, _BITMASK_ADDRESS)
                  // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  msgSender := and(msgSender, _BITMASK_ADDRESS)
                  // `msgSender == owner || msgSender == approvedAddress`.
                  result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
              }
          }
      
          /**
           * @dev Returns the storage slot and value for the approved address of `tokenId`.
           */
          function _getApprovedSlotAndAddress(uint256 tokenId)
              private
              view
              returns (uint256 approvedAddressSlot, address approvedAddress)
          {
              TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
              // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
              assembly {
                  approvedAddressSlot := tokenApproval.slot
                  approvedAddress := sload(approvedAddressSlot)
              }
          }
      
          // =============================================================
          //                      TRANSFER OPERATIONS
          // =============================================================
      
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token
           * by either {approve} or {setApprovalForAll}.
           *
           * Emits a {Transfer} event.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public payable virtual override {
              uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
      
              if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
      
              (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
      
              // The nested ifs save around 20+ gas over a compound boolean condition.
              if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                  if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
      
              if (to == address(0)) revert TransferToZeroAddress();
      
              _beforeTokenTransfers(from, to, tokenId, 1);
      
              // Clear approvals from the previous owner.
              assembly {
                  if approvedAddress {
                      // This is equivalent to `delete _tokenApprovals[tokenId]`.
                      sstore(approvedAddressSlot, 0)
                  }
              }
      
              // Underflow of the sender's balance is impossible because we check for
              // ownership above and the recipient's balance can't realistically overflow.
              // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
              unchecked {
                  // We can directly increment and decrement the balances.
                  --_packedAddressData[from]; // Updates: `balance -= 1`.
                  ++_packedAddressData[to]; // Updates: `balance += 1`.
      
                  // Updates:
                  // - `address` to the next owner.
                  // - `startTimestamp` to the timestamp of transfering.
                  // - `burned` to `false`.
                  // - `nextInitialized` to `true`.
                  _packedOwnerships[tokenId] = _packOwnershipData(
                      to,
                      _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
                  );
      
                  // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
                  if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                      uint256 nextTokenId = tokenId + 1;
                      // If the next slot's address is zero and not burned (i.e. packed value is zero).
                      if (_packedOwnerships[nextTokenId] == 0) {
                          // If the next slot is within bounds.
                          if (nextTokenId != _currentIndex) {
                              // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                              _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                          }
                      }
                  }
              }
      
              emit Transfer(from, to, tokenId);
              _afterTokenTransfers(from, to, tokenId, 1);
          }
      
          /**
           * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public payable virtual override {
              safeTransferFrom(from, to, tokenId, '');
          }
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token
           * by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement
           * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) public payable virtual override {
              transferFrom(from, to, tokenId);
              if (to.code.length != 0)
                  if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                      revert TransferToNonERC721ReceiverImplementer();
                  }
          }
      
          /**
           * @dev Hook that is called before a set of serially-ordered token IDs
           * are about to be transferred. This includes minting.
           * And also called before burning one token.
           *
           * `startTokenId` - the first token ID to be transferred.
           * `quantity` - the amount to be transferred.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
           * transferred to `to`.
           * - When `from` is zero, `tokenId` will be minted for `to`.
           * - When `to` is zero, `tokenId` will be burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _beforeTokenTransfers(
              address from,
              address to,
              uint256 startTokenId,
              uint256 quantity
          ) internal virtual {}
      
          /**
           * @dev Hook that is called after a set of serially-ordered token IDs
           * have been transferred. This includes minting.
           * And also called after one token has been burned.
           *
           * `startTokenId` - the first token ID to be transferred.
           * `quantity` - the amount to be transferred.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
           * transferred to `to`.
           * - When `from` is zero, `tokenId` has been minted for `to`.
           * - When `to` is zero, `tokenId` has been burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _afterTokenTransfers(
              address from,
              address to,
              uint256 startTokenId,
              uint256 quantity
          ) internal virtual {}
      
          /**
           * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
           *
           * `from` - Previous owner of the given token ID.
           * `to` - Target address that will receive the token.
           * `tokenId` - Token ID to be transferred.
           * `_data` - Optional data to send along with the call.
           *
           * Returns whether the call correctly returned the expected magic value.
           */
          function _checkContractOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) private returns (bool) {
              try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
                  bytes4 retval
              ) {
                  return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
              } catch (bytes memory reason) {
                  if (reason.length == 0) {
                      revert TransferToNonERC721ReceiverImplementer();
                  } else {
                      assembly {
                          revert(add(32, reason), mload(reason))
                      }
                  }
              }
          }
      
          // =============================================================
          //                        MINT OPERATIONS
          // =============================================================
      
          /**
           * @dev Mints `quantity` tokens and transfers them to `to`.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `quantity` must be greater than 0.
           *
           * Emits a {Transfer} event for each mint.
           */
          function _mint(address to, uint256 quantity) internal virtual {
              uint256 startTokenId = _currentIndex;
              if (quantity == 0) revert MintZeroQuantity();
      
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
      
              // Overflows are incredibly unrealistic.
              // `balance` and `numberMinted` have a maximum limit of 2**64.
              // `tokenId` has a maximum limit of 2**256.
              unchecked {
                  // Updates:
                  // - `balance += quantity`.
                  // - `numberMinted += quantity`.
                  //
                  // We can directly add to the `balance` and `numberMinted`.
                  _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
      
                  // Updates:
                  // - `address` to the owner.
                  // - `startTimestamp` to the timestamp of minting.
                  // - `burned` to `false`.
                  // - `nextInitialized` to `quantity == 1`.
                  _packedOwnerships[startTokenId] = _packOwnershipData(
                      to,
                      _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
                  );
      
                  uint256 toMasked;
                  uint256 end = startTokenId + quantity;
      
                  // Use assembly to loop and emit the `Transfer` event for gas savings.
                  // The duplicated `log4` removes an extra check and reduces stack juggling.
                  // The assembly, together with the surrounding Solidity code, have been
                  // delicately arranged to nudge the compiler into producing optimized opcodes.
                  assembly {
                      // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                      toMasked := and(to, _BITMASK_ADDRESS)
                      // Emit the `Transfer` event.
                      log4(
                          0, // Start of data (0, since no data).
                          0, // End of data (0, since no data).
                          _TRANSFER_EVENT_SIGNATURE, // Signature.
                          0, // `address(0)`.
                          toMasked, // `to`.
                          startTokenId // `tokenId`.
                      )
      
                      // The `iszero(eq(,))` check ensures that large values of `quantity`
                      // that overflows uint256 will make the loop run out of gas.
                      // The compiler will optimize the `iszero` away for performance.
                      for {
                          let tokenId := add(startTokenId, 1)
                      } iszero(eq(tokenId, end)) {
                          tokenId := add(tokenId, 1)
                      } {
                          // Emit the `Transfer` event. Similar to above.
                          log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                      }
                  }
                  if (toMasked == 0) revert MintToZeroAddress();
      
                  _currentIndex = end;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
      
          /**
           * @dev Mints `quantity` tokens and transfers them to `to`.
           *
           * This function is intended for efficient minting only during contract creation.
           *
           * It emits only one {ConsecutiveTransfer} as defined in
           * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
           * instead of a sequence of {Transfer} event(s).
           *
           * Calling this function outside of contract creation WILL make your contract
           * non-compliant with the ERC721 standard.
           * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
           * {ConsecutiveTransfer} event is only permissible during contract creation.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `quantity` must be greater than 0.
           *
           * Emits a {ConsecutiveTransfer} event.
           */
          function _mintERC2309(address to, uint256 quantity) internal virtual {
              uint256 startTokenId = _currentIndex;
              if (to == address(0)) revert MintToZeroAddress();
              if (quantity == 0) revert MintZeroQuantity();
              if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
      
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
      
              // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
              unchecked {
                  // Updates:
                  // - `balance += quantity`.
                  // - `numberMinted += quantity`.
                  //
                  // We can directly add to the `balance` and `numberMinted`.
                  _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
      
                  // Updates:
                  // - `address` to the owner.
                  // - `startTimestamp` to the timestamp of minting.
                  // - `burned` to `false`.
                  // - `nextInitialized` to `quantity == 1`.
                  _packedOwnerships[startTokenId] = _packOwnershipData(
                      to,
                      _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
                  );
      
                  emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
      
                  _currentIndex = startTokenId + quantity;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
      
          /**
           * @dev Safely mints `quantity` tokens and transfers them to `to`.
           *
           * Requirements:
           *
           * - If `to` refers to a smart contract, it must implement
           * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
           * - `quantity` must be greater than 0.
           *
           * See {_mint}.
           *
           * Emits a {Transfer} event for each mint.
           */
          function _safeMint(
              address to,
              uint256 quantity,
              bytes memory _data
          ) internal virtual {
              _mint(to, quantity);
      
              unchecked {
                  if (to.code.length != 0) {
                      uint256 end = _currentIndex;
                      uint256 index = end - quantity;
                      do {
                          if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                              revert TransferToNonERC721ReceiverImplementer();
                          }
                      } while (index < end);
                      // Reentrancy protection.
                      if (_currentIndex != end) revert();
                  }
              }
          }
      
          /**
           * @dev Equivalent to `_safeMint(to, quantity, '')`.
           */
          function _safeMint(address to, uint256 quantity) internal virtual {
              _safeMint(to, quantity, '');
          }
      
          // =============================================================
          //                        BURN OPERATIONS
          // =============================================================
      
          /**
           * @dev Equivalent to `_burn(tokenId, false)`.
           */
          function _burn(uint256 tokenId) internal virtual {
              _burn(tokenId, false);
          }
      
          /**
           * @dev Destroys `tokenId`.
           * The approval is cleared when the token is burned.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           *
           * Emits a {Transfer} event.
           */
          function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
              uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
      
              address from = address(uint160(prevOwnershipPacked));
      
              (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
      
              if (approvalCheck) {
                  // The nested ifs save around 20+ gas over a compound boolean condition.
                  if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                      if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
              }
      
              _beforeTokenTransfers(from, address(0), tokenId, 1);
      
              // Clear approvals from the previous owner.
              assembly {
                  if approvedAddress {
                      // This is equivalent to `delete _tokenApprovals[tokenId]`.
                      sstore(approvedAddressSlot, 0)
                  }
              }
      
              // Underflow of the sender's balance is impossible because we check for
              // ownership above and the recipient's balance can't realistically overflow.
              // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
              unchecked {
                  // Updates:
                  // - `balance -= 1`.
                  // - `numberBurned += 1`.
                  //
                  // We can directly decrement the balance, and increment the number burned.
                  // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
                  _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
      
                  // Updates:
                  // - `address` to the last owner.
                  // - `startTimestamp` to the timestamp of burning.
                  // - `burned` to `true`.
                  // - `nextInitialized` to `true`.
                  _packedOwnerships[tokenId] = _packOwnershipData(
                      from,
                      (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
                  );
      
                  // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
                  if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                      uint256 nextTokenId = tokenId + 1;
                      // If the next slot's address is zero and not burned (i.e. packed value is zero).
                      if (_packedOwnerships[nextTokenId] == 0) {
                          // If the next slot is within bounds.
                          if (nextTokenId != _currentIndex) {
                              // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                              _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                          }
                      }
                  }
              }
      
              emit Transfer(from, address(0), tokenId);
              _afterTokenTransfers(from, address(0), tokenId, 1);
      
              // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
              unchecked {
                  _burnCounter++;
              }
          }
      
          // =============================================================
          //                     EXTRA DATA OPERATIONS
          // =============================================================
      
          /**
           * @dev Directly sets the extra data for the ownership data `index`.
           */
          function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
              uint256 packed = _packedOwnerships[index];
              if (packed == 0) revert OwnershipNotInitializedForExtraData();
              uint256 extraDataCasted;
              // Cast `extraData` with assembly to avoid redundant masking.
              assembly {
                  extraDataCasted := extraData
              }
              packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
              _packedOwnerships[index] = packed;
          }
      
          /**
           * @dev Called during each token transfer to set the 24bit `extraData` field.
           * Intended to be overridden by the cosumer contract.
           *
           * `previousExtraData` - the value of `extraData` before transfer.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
           * transferred to `to`.
           * - When `from` is zero, `tokenId` will be minted for `to`.
           * - When `to` is zero, `tokenId` will be burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _extraData(
              address from,
              address to,
              uint24 previousExtraData
          ) internal view virtual returns (uint24) {}
      
          /**
           * @dev Returns the next extra data for the packed ownership data.
           * The returned result is shifted into position.
           */
          function _nextExtraData(
              address from,
              address to,
              uint256 prevOwnershipPacked
          ) private view returns (uint256) {
              uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
              return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
          }
      
          // =============================================================
          //                       OTHER OPERATIONS
          // =============================================================
      
          /**
           * @dev Returns the message sender (defaults to `msg.sender`).
           *
           * If you are writing GSN compatible contracts, you need to override this function.
           */
          function _msgSenderERC721A() internal view virtual returns (address) {
              return msg.sender;
          }
      
          /**
           * @dev Converts a uint256 to its ASCII string decimal representation.
           */
          function _toString(uint256 value) internal pure virtual returns (string memory str) {
              assembly {
                  // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
                  // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
                  // We will need 1 word for the trailing zeros padding, 1 word for the length,
                  // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
                  let m := add(mload(0x40), 0xa0)
                  // Update the free memory pointer to allocate.
                  mstore(0x40, m)
                  // Assign the `str` to the end.
                  str := sub(m, 0x20)
                  // Zeroize the slot after the string.
                  mstore(str, 0)
      
                  // Cache the end of the memory to calculate the length later.
                  let end := str
      
                  // We write the string from rightmost digit to leftmost digit.
                  // The following is essentially a do-while loop that also handles the zero case.
                  // prettier-ignore
                  for { let temp := value } 1 {} {
                      str := sub(str, 1)
                      // Write the character to the pointer.
                      // The ASCII index of the '0' character is 48.
                      mstore8(str, add(48, mod(temp, 10)))
                      // Keep dividing `temp` until zero.
                      temp := div(temp, 10)
                      // prettier-ignore
                      if iszero(temp) { break }
                  }
      
                  let length := sub(end, str)
                  // Move the pointer 32 bytes leftwards to make room for the length.
                  str := sub(str, 0x20)
                  // Store the length.
                  mstore(str, length)
              }
          }
      }
      
      
      // File contracts/UnchainedMilady.sol
      
      
      
      pragma solidity ^0.8.17;
      
      
      
      contract UnchainedMilady is ERC721A, Ownable {
          uint256 public mintPrice = 0.044 ether;
      
          bool public saleIsActive = false;
      
          uint256 public maxPerAddressDuringMint = 100;
          string private _baseTokenURI;
          uint256 public maxSupply = 8888;
      
          mapping(address => bool) public mintedFree;
      
          address mezzanotteWallet = 0x4dDAc376f28BE60e1F7642A4D302C6Cf6CAe1D92;
          address devWallet = 0x67c724f54EEeaF679a62149AbeA6f067187731cd;
      
          modifier onlyDev() {
              require(msg.sender == devWallet, "Caller is not the dev");
              _;
          }
      
          constructor() ERC721A("Unchained Milady", "UNMIL") {}
      
          function mintReserveTokens(uint256 numberOfTokens) public onlyDev {
              _safeMint(msg.sender, numberOfTokens);
              require(totalSupply() <= maxSupply, "Limit reached");
          }
      
          function flipSaleState() public onlyDev {
              saleIsActive = !saleIsActive;
          }
      
          function setMintPrice(uint256 newPrice) public onlyDev {
              mintPrice = newPrice;
          }
      
          function setMaxSupply(uint256 newAmount) public onlyDev {
              maxSupply = newAmount;
          }
      
          function _baseURI() internal view virtual override returns (string memory) {
              return _baseTokenURI;
          }
      
          function setBaseURI(string calldata baseURI) external onlyDev {
              _baseTokenURI = baseURI;
          }
      
          function mint(uint256 quantity) external payable {
              require(saleIsActive, "Sale must be active to mint");
              require(
                  quantity <= maxPerAddressDuringMint,
                  "You can't mint that many at once"
              );
      
              require(
                  mintPrice * quantity <= msg.value,
                  "Ether value sent is not correct"
              );
      
              _mint(msg.sender, quantity);
              require(totalSupply() <= maxSupply, "Limit reached");
          }
      
          function freeMint() external payable {
              require(saleIsActive, "Sale must be active to mint");
      
              require(
                  isAFriend(msg.sender),
                  "This wallet doesn't hold any friend NFTs"
              );
              require(
                  mintedFree[msg.sender] == false,
                  "You can only mint 1 for free"
              );
      
              mintedFree[msg.sender] = true;
              _mint(msg.sender, 1);
      
              require(totalSupply() <= maxSupply, "Limit reached");
          }
      
          function isAFriend(address addr) public view returns (bool) {
              address milady = 0x5Af0D9827E0c53E4799BB226655A1de152A425a5;
              address ssrwives = 0x64256b6409150e8B2B25A456A17DCf171209542a;
              address angelbanners = 0xB1224F5E241424458E87c14652CFe59662BF3A9A;
              address aura = 0x2fC722C1c77170A61F17962CC4D039692f033b43;
      
              // Mezzanotte projects:
              address whitehearts = 0x4577fcfB0642afD21b5f2502753ED6D497B830E9;
              address simPackTwo = 0x243d558472eF7030aFe3675Bb0a6f9Fb7cE39E13;
              address simPackOne = 0x8b6DCfB251bef4953cF3f3A8C66Af870e6b7466e;
              address dropicall = 0x8b82D758a95c84Bc5476244f91e9AC6478d2a8B0;
      
              return
                  IERC721(milady).balanceOf(addr) > 0 ||
                  IERC721(ssrwives).balanceOf(addr) > 0 ||
                  IERC721(angelbanners).balanceOf(addr) > 0 ||
                  IERC721(aura).balanceOf(addr) > 0 ||
                  IERC721(whitehearts).balanceOf(addr) > 0 ||
                  IERC721(simPackTwo).balanceOf(addr) > 0 ||
                  IERC721(simPackOne).balanceOf(addr) > 0 ||
                  IERC721(dropicall).balanceOf(addr) > 0;
          }
      
          function withdrawMoney() external onlyDev {
              (bool success, ) = devWallet.call{value: address(this).balance}("");
              require(success, "Transfer failed.");
          }
      
          function withdrawSplit() public payable onlyOwner {
              uint256 tenth = address(this).balance / 10;
      
              require(payable(devWallet).send(tenth));
              require(payable(mezzanotteWallet).send(9 * tenth));
          }
      }

      File 2 of 10: Miladys
      // File: @openzeppelin/contracts/utils/Context.sol
      // SPDX-License-Identifier: MIT
      pragma solidity >=0.6.0 <0.8.0;
      /*
       * @dev Provides information about the current execution context, including the
       * sender of the transaction and its data. While these are generally available
       * via msg.sender and msg.data, they should not be accessed in such a direct
       * manner, since when dealing with GSN meta-transactions the account sending and
       * paying for execution may not be the actual sender (as far as an application
       * is concerned).
       *
       * This contract is only required for intermediate, library-like contracts.
       */
      abstract contract Context {
          function _msgSender() internal view virtual returns (address payable) {
              return msg.sender;
          }
          function _msgData() internal view virtual returns (bytes memory) {
              this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
              return msg.data;
          }
      }
      // File: @openzeppelin/contracts/introspection/IERC165.sol
      pragma solidity >=0.6.0 <0.8.0;
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165 {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      // File: @openzeppelin/contracts/token/ERC721/IERC721.sol
      pragma solidity >=0.6.2 <0.8.0;
      /**
       * @dev Required interface of an ERC721 compliant contract.
       */
      interface IERC721 is IERC165 {
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
          /**
           * @dev Returns the number of tokens in ``owner``'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, 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) external;
          /**
           * @dev Transfers `tokenId` token 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;
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external;
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
          /**
           * @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 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);
          /**
            * @dev Safely transfers `tokenId` token from `from` to `to`.
            *
            * Requirements:
            *
            * - `from` cannot be the zero address.
            * - `to` cannot be the zero address.
            * - `tokenId` token must exist and be owned by `from`.
            * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
            * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
            *
            * Emits a {Transfer} event.
            */
          function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
      }
      // File: @openzeppelin/contracts/token/ERC721/IERC721Metadata.sol
      pragma solidity >=0.6.2 <0.8.0;
      /**
       * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
       * @dev See https://eips.ethereum.org/EIPS/eip-721
       */
      interface IERC721Metadata is IERC721 {
          /**
           * @dev Returns the token collection name.
           */
          function name() external view returns (string memory);
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() external view returns (string memory);
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) external view returns (string memory);
      }
      // File: @openzeppelin/contracts/token/ERC721/IERC721Enumerable.sol
      pragma solidity >=0.6.2 <0.8.0;
      /**
       * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
       * @dev See https://eips.ethereum.org/EIPS/eip-721
       */
      interface IERC721Enumerable is IERC721 {
          /**
           * @dev Returns the total amount of tokens stored by the contract.
           */
          function totalSupply() external view returns (uint256);
          /**
           * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
           * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
           */
          function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
          /**
           * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
           * Use along with {totalSupply} to enumerate all tokens.
           */
          function tokenByIndex(uint256 index) external view returns (uint256);
      }
      // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
      pragma solidity >=0.6.0 <0.8.0;
      /**
       * @title ERC721 token receiver interface
       * @dev Interface for any contract that wants to support safeTransfers
       * from ERC721 asset contracts.
       */
      interface IERC721Receiver {
          /**
           * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
           * by `operator` from `from`, this function is called.
           *
           * It must return its Solidity selector to confirm the token transfer.
           * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
           *
           * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
           */
          function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
      }
      // File: @openzeppelin/contracts/introspection/ERC165.sol
      pragma solidity >=0.6.0 <0.8.0;
      /**
       * @dev Implementation of the {IERC165} interface.
       *
       * Contracts may inherit from this and call {_registerInterface} to declare
       * their support of an interface.
       */
      abstract contract ERC165 is IERC165 {
          /*
           * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
           */
          bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;
          /**
           * @dev Mapping of interface ids to whether or not it's supported.
           */
          mapping(bytes4 => bool) private _supportedInterfaces;
          constructor () internal {
              // Derived contracts need only register support for their own interfaces,
              // we register support for ERC165 itself here
              _registerInterface(_INTERFACE_ID_ERC165);
          }
          /**
           * @dev See {IERC165-supportsInterface}.
           *
           * Time complexity O(1), guaranteed to always use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              return _supportedInterfaces[interfaceId];
          }
          /**
           * @dev Registers the contract as an implementer of the interface defined by
           * `interfaceId`. Support of the actual ERC165 interface is automatic and
           * registering its interface id is not required.
           *
           * See {IERC165-supportsInterface}.
           *
           * Requirements:
           *
           * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
           */
          function _registerInterface(bytes4 interfaceId) internal virtual {
              require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
              _supportedInterfaces[interfaceId] = true;
          }
      }
      // File: @openzeppelin/contracts/math/SafeMath.sol
      pragma solidity >=0.6.0 <0.8.0;
      /**
       * @dev Wrappers over Solidity's arithmetic operations with added overflow
       * checks.
       *
       * Arithmetic operations in Solidity wrap on overflow. This can easily result
       * in bugs, because programmers usually assume that an overflow raises an
       * error, which is the standard behavior in high level programming languages.
       * `SafeMath` restores this intuition by reverting the transaction when an
       * operation overflows.
       *
       * Using this library instead of the unchecked operations eliminates an entire
       * class of bugs, so it's recommended to use it always.
       */
      library SafeMath {
          /**
           * @dev Returns the addition of two unsigned integers, with an overflow flag.
           *
           * _Available since v3.4._
           */
          function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
              uint256 c = a + b;
              if (c < a) return (false, 0);
              return (true, c);
          }
          /**
           * @dev Returns the substraction of two unsigned integers, with an overflow flag.
           *
           * _Available since v3.4._
           */
          function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
              if (b > a) return (false, 0);
              return (true, a - b);
          }
          /**
           * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
           *
           * _Available since v3.4._
           */
          function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
              // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
              // benefit is lost if 'b' is also tested.
              // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
              if (a == 0) return (true, 0);
              uint256 c = a * b;
              if (c / a != b) return (false, 0);
              return (true, c);
          }
          /**
           * @dev Returns the division of two unsigned integers, with a division by zero flag.
           *
           * _Available since v3.4._
           */
          function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
              if (b == 0) return (false, 0);
              return (true, a / b);
          }
          /**
           * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
           *
           * _Available since v3.4._
           */
          function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
              if (b == 0) return (false, 0);
              return (true, a % b);
          }
          /**
           * @dev Returns the addition of two unsigned integers, reverting on
           * overflow.
           *
           * Counterpart to Solidity's `+` operator.
           *
           * Requirements:
           *
           * - Addition cannot overflow.
           */
          function add(uint256 a, uint256 b) internal pure returns (uint256) {
              uint256 c = a + b;
              require(c >= a, "SafeMath: addition overflow");
              return c;
          }
          /**
           * @dev Returns the subtraction of two unsigned integers, reverting on
           * overflow (when the result is negative).
           *
           * Counterpart to Solidity's `-` operator.
           *
           * Requirements:
           *
           * - Subtraction cannot overflow.
           */
          function sub(uint256 a, uint256 b) internal pure returns (uint256) {
              require(b <= a, "SafeMath: subtraction overflow");
              return a - b;
          }
          /**
           * @dev Returns the multiplication of two unsigned integers, reverting on
           * overflow.
           *
           * Counterpart to Solidity's `*` operator.
           *
           * Requirements:
           *
           * - Multiplication cannot overflow.
           */
          function mul(uint256 a, uint256 b) internal pure returns (uint256) {
              if (a == 0) return 0;
              uint256 c = a * b;
              require(c / a == b, "SafeMath: multiplication overflow");
              return c;
          }
          /**
           * @dev Returns the integer division of two unsigned integers, reverting on
           * division by zero. The result is rounded towards zero.
           *
           * Counterpart to Solidity's `/` operator. Note: this function uses a
           * `revert` opcode (which leaves remaining gas untouched) while Solidity
           * uses an invalid opcode to revert (consuming all remaining gas).
           *
           * Requirements:
           *
           * - The divisor cannot be zero.
           */
          function div(uint256 a, uint256 b) internal pure returns (uint256) {
              require(b > 0, "SafeMath: division by zero");
              return a / b;
          }
          /**
           * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
           * reverting when dividing by zero.
           *
           * Counterpart to Solidity's `%` operator. This function uses a `revert`
           * opcode (which leaves remaining gas untouched) while Solidity uses an
           * invalid opcode to revert (consuming all remaining gas).
           *
           * Requirements:
           *
           * - The divisor cannot be zero.
           */
          function mod(uint256 a, uint256 b) internal pure returns (uint256) {
              require(b > 0, "SafeMath: modulo by zero");
              return a % b;
          }
          /**
           * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
           * overflow (when the result is negative).
           *
           * CAUTION: This function is deprecated because it requires allocating memory for the error
           * message unnecessarily. For custom revert reasons use {trySub}.
           *
           * Counterpart to Solidity's `-` operator.
           *
           * Requirements:
           *
           * - Subtraction cannot overflow.
           */
          function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
              require(b <= a, errorMessage);
              return a - b;
          }
          /**
           * @dev Returns the integer division of two unsigned integers, reverting with custom message on
           * division by zero. The result is rounded towards zero.
           *
           * CAUTION: This function is deprecated because it requires allocating memory for the error
           * message unnecessarily. For custom revert reasons use {tryDiv}.
           *
           * Counterpart to Solidity's `/` operator. Note: this function uses a
           * `revert` opcode (which leaves remaining gas untouched) while Solidity
           * uses an invalid opcode to revert (consuming all remaining gas).
           *
           * Requirements:
           *
           * - The divisor cannot be zero.
           */
          function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
              require(b > 0, errorMessage);
              return a / b;
          }
          /**
           * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
           * reverting with custom message when dividing by zero.
           *
           * CAUTION: This function is deprecated because it requires allocating memory for the error
           * message unnecessarily. For custom revert reasons use {tryMod}.
           *
           * Counterpart to Solidity's `%` operator. This function uses a `revert`
           * opcode (which leaves remaining gas untouched) while Solidity uses an
           * invalid opcode to revert (consuming all remaining gas).
           *
           * Requirements:
           *
           * - The divisor cannot be zero.
           */
          function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
              require(b > 0, errorMessage);
              return a % b;
          }
      }
      // File: @openzeppelin/contracts/utils/Address.sol
      pragma solidity >=0.6.2 <0.8.0;
      /**
       * @dev Collection of functions related to the address type
       */
      library Address {
          /**
           * @dev Returns true if `account` is a contract.
           *
           * [IMPORTANT]
           * ====
           * It is unsafe to assume that an address for which this function returns
           * false is an externally-owned account (EOA) and not a contract.
           *
           * Among others, `isContract` will return false for the following
           * types of addresses:
           *
           *  - an externally-owned account
           *  - a contract in construction
           *  - an address where a contract will be created
           *  - an address where a contract lived, but was destroyed
           * ====
           */
          function isContract(address account) internal view returns (bool) {
              // This method relies on extcodesize, which returns 0 for contracts in
              // construction, since the code is only stored at the end of the
              // constructor execution.
              uint256 size;
              // solhint-disable-next-line no-inline-assembly
              assembly { size := extcodesize(account) }
              return size > 0;
          }
          /**
           * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
           * `recipient`, forwarding all available gas and reverting on errors.
           *
           * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
           * of certain opcodes, possibly making contracts go over the 2300 gas limit
           * imposed by `transfer`, making them unable to receive funds via
           * `transfer`. {sendValue} removes this limitation.
           *
           * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
           *
           * IMPORTANT: because control is transferred to `recipient`, care must be
           * taken to not create reentrancy vulnerabilities. Consider using
           * {ReentrancyGuard} or the
           * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
           */
          function sendValue(address payable recipient, uint256 amount) internal {
              require(address(this).balance >= amount, "Address: insufficient balance");
              // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
              (bool success, ) = recipient.call{ value: amount }("");
              require(success, "Address: unable to send value, recipient may have reverted");
          }
          /**
           * @dev Performs a Solidity function call using a low level `call`. A
           * plain`call` is an unsafe replacement for a function call: use this
           * function instead.
           *
           * If `target` reverts with a revert reason, it is bubbled up by this
           * function (like regular Solidity function calls).
           *
           * Returns the raw returned data. To convert to the expected return value,
           * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
           *
           * Requirements:
           *
           * - `target` must be a contract.
           * - calling `target` with `data` must not revert.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data) internal returns (bytes memory) {
            return functionCall(target, data, "Address: low-level call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
           * `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but also transferring `value` wei to `target`.
           *
           * Requirements:
           *
           * - the calling contract must have an ETH balance of at least `value`.
           * - the called Solidity function must be `payable`.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
              return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
          }
          /**
           * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
           * with `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
              require(address(this).balance >= value, "Address: insufficient balance for call");
              require(isContract(target), "Address: call to non-contract");
              // solhint-disable-next-line avoid-low-level-calls
              (bool success, bytes memory returndata) = target.call{ value: value }(data);
              return _verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
              return functionStaticCall(target, data, "Address: low-level static call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
              require(isContract(target), "Address: static call to non-contract");
              // solhint-disable-next-line avoid-low-level-calls
              (bool success, bytes memory returndata) = target.staticcall(data);
              return _verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionDelegateCall(target, data, "Address: low-level delegate call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
              require(isContract(target), "Address: delegate call to non-contract");
              // solhint-disable-next-line avoid-low-level-calls
              (bool success, bytes memory returndata) = target.delegatecall(data);
              return _verifyCallResult(success, returndata, errorMessage);
          }
          function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
              if (success) {
                  return returndata;
              } else {
                  // Look for revert reason and bubble it up if present
                  if (returndata.length > 0) {
                      // The easiest way to bubble the revert reason is using memory via assembly
                      // solhint-disable-next-line no-inline-assembly
                      assembly {
                          let returndata_size := mload(returndata)
                          revert(add(32, returndata), returndata_size)
                      }
                  } else {
                      revert(errorMessage);
                  }
              }
          }
      }
      // File: @openzeppelin/contracts/utils/EnumerableSet.sol
      pragma solidity >=0.6.0 <0.8.0;
      /**
       * @dev Library for managing
       * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
       * types.
       *
       * Sets have the following properties:
       *
       * - Elements are added, removed, and checked for existence in constant time
       * (O(1)).
       * - Elements are enumerated in O(n). No guarantees are made on the ordering.
       *
       * ```
       * contract Example {
       *     // Add the library methods
       *     using EnumerableSet for EnumerableSet.AddressSet;
       *
       *     // Declare a set state variable
       *     EnumerableSet.AddressSet private mySet;
       * }
       * ```
       *
       * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
       * and `uint256` (`UintSet`) are supported.
       */
      library EnumerableSet {
          // To implement this library for multiple types with as little code
          // repetition as possible, we write it in terms of a generic Set type with
          // bytes32 values.
          // The Set implementation uses private functions, and user-facing
          // implementations (such as AddressSet) are just wrappers around the
          // underlying Set.
          // This means that we can only create new EnumerableSets for types that fit
          // in bytes32.
          struct Set {
              // Storage of set values
              bytes32[] _values;
              // Position of the value in the `values` array, plus 1 because index 0
              // means a value is not in the set.
              mapping (bytes32 => uint256) _indexes;
          }
          /**
           * @dev Add a value to a set. O(1).
           *
           * Returns true if the value was added to the set, that is if it was not
           * already present.
           */
          function _add(Set storage set, bytes32 value) private returns (bool) {
              if (!_contains(set, value)) {
                  set._values.push(value);
                  // The value is stored at length-1, but we add 1 to all indexes
                  // and use 0 as a sentinel value
                  set._indexes[value] = set._values.length;
                  return true;
              } else {
                  return false;
              }
          }
          /**
           * @dev Removes a value from a set. O(1).
           *
           * Returns true if the value was removed from the set, that is if it was
           * present.
           */
          function _remove(Set storage set, bytes32 value) private returns (bool) {
              // We read and store the value's index to prevent multiple reads from the same storage slot
              uint256 valueIndex = set._indexes[value];
              if (valueIndex != 0) { // Equivalent to contains(set, value)
                  // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
                  // the array, and then remove the last element (sometimes called as 'swap and pop').
                  // This modifies the order of the array, as noted in {at}.
                  uint256 toDeleteIndex = valueIndex - 1;
                  uint256 lastIndex = set._values.length - 1;
                  // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
                  // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
                  bytes32 lastvalue = set._values[lastIndex];
                  // Move the last value to the index where the value to delete is
                  set._values[toDeleteIndex] = lastvalue;
                  // Update the index for the moved value
                  set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
                  // Delete the slot where the moved value was stored
                  set._values.pop();
                  // Delete the index for the deleted slot
                  delete set._indexes[value];
                  return true;
              } else {
                  return false;
              }
          }
          /**
           * @dev Returns true if the value is in the set. O(1).
           */
          function _contains(Set storage set, bytes32 value) private view returns (bool) {
              return set._indexes[value] != 0;
          }
          /**
           * @dev Returns the number of values on the set. O(1).
           */
          function _length(Set storage set) private view returns (uint256) {
              return set._values.length;
          }
         /**
          * @dev Returns the value stored at position `index` in the set. O(1).
          *
          * Note that there are no guarantees on the ordering of values inside the
          * array, and it may change when more values are added or removed.
          *
          * Requirements:
          *
          * - `index` must be strictly less than {length}.
          */
          function _at(Set storage set, uint256 index) private view returns (bytes32) {
              require(set._values.length > index, "EnumerableSet: index out of bounds");
              return set._values[index];
          }
          // Bytes32Set
          struct Bytes32Set {
              Set _inner;
          }
          /**
           * @dev Add a value to a set. O(1).
           *
           * Returns true if the value was added to the set, that is if it was not
           * already present.
           */
          function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
              return _add(set._inner, value);
          }
          /**
           * @dev Removes a value from a set. O(1).
           *
           * Returns true if the value was removed from the set, that is if it was
           * present.
           */
          function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
              return _remove(set._inner, value);
          }
          /**
           * @dev Returns true if the value is in the set. O(1).
           */
          function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
              return _contains(set._inner, value);
          }
          /**
           * @dev Returns the number of values in the set. O(1).
           */
          function length(Bytes32Set storage set) internal view returns (uint256) {
              return _length(set._inner);
          }
         /**
          * @dev Returns the value stored at position `index` in the set. O(1).
          *
          * Note that there are no guarantees on the ordering of values inside the
          * array, and it may change when more values are added or removed.
          *
          * Requirements:
          *
          * - `index` must be strictly less than {length}.
          */
          function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
              return _at(set._inner, index);
          }
          // AddressSet
          struct AddressSet {
              Set _inner;
          }
          /**
           * @dev Add a value to a set. O(1).
           *
           * Returns true if the value was added to the set, that is if it was not
           * already present.
           */
          function add(AddressSet storage set, address value) internal returns (bool) {
              return _add(set._inner, bytes32(uint256(uint160(value))));
          }
          /**
           * @dev Removes a value from a set. O(1).
           *
           * Returns true if the value was removed from the set, that is if it was
           * present.
           */
          function remove(AddressSet storage set, address value) internal returns (bool) {
              return _remove(set._inner, bytes32(uint256(uint160(value))));
          }
          /**
           * @dev Returns true if the value is in the set. O(1).
           */
          function contains(AddressSet storage set, address value) internal view returns (bool) {
              return _contains(set._inner, bytes32(uint256(uint160(value))));
          }
          /**
           * @dev Returns the number of values in the set. O(1).
           */
          function length(AddressSet storage set) internal view returns (uint256) {
              return _length(set._inner);
          }
         /**
          * @dev Returns the value stored at position `index` in the set. O(1).
          *
          * Note that there are no guarantees on the ordering of values inside the
          * array, and it may change when more values are added or removed.
          *
          * Requirements:
          *
          * - `index` must be strictly less than {length}.
          */
          function at(AddressSet storage set, uint256 index) internal view returns (address) {
              return address(uint160(uint256(_at(set._inner, index))));
          }
          // UintSet
          struct UintSet {
              Set _inner;
          }
          /**
           * @dev Add a value to a set. O(1).
           *
           * Returns true if the value was added to the set, that is if it was not
           * already present.
           */
          function add(UintSet storage set, uint256 value) internal returns (bool) {
              return _add(set._inner, bytes32(value));
          }
          /**
           * @dev Removes a value from a set. O(1).
           *
           * Returns true if the value was removed from the set, that is if it was
           * present.
           */
          function remove(UintSet storage set, uint256 value) internal returns (bool) {
              return _remove(set._inner, bytes32(value));
          }
          /**
           * @dev Returns true if the value is in the set. O(1).
           */
          function contains(UintSet storage set, uint256 value) internal view returns (bool) {
              return _contains(set._inner, bytes32(value));
          }
          /**
           * @dev Returns the number of values on the set. O(1).
           */
          function length(UintSet storage set) internal view returns (uint256) {
              return _length(set._inner);
          }
         /**
          * @dev Returns the value stored at position `index` in the set. O(1).
          *
          * Note that there are no guarantees on the ordering of values inside the
          * array, and it may change when more values are added or removed.
          *
          * Requirements:
          *
          * - `index` must be strictly less than {length}.
          */
          function at(UintSet storage set, uint256 index) internal view returns (uint256) {
              return uint256(_at(set._inner, index));
          }
      }
      // File: @openzeppelin/contracts/utils/EnumerableMap.sol
      pragma solidity >=0.6.0 <0.8.0;
      /**
       * @dev Library for managing an enumerable variant of Solidity's
       * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
       * type.
       *
       * Maps have the following properties:
       *
       * - Entries are added, removed, and checked for existence in constant time
       * (O(1)).
       * - Entries are enumerated in O(n). No guarantees are made on the ordering.
       *
       * ```
       * contract Example {
       *     // Add the library methods
       *     using EnumerableMap for EnumerableMap.UintToAddressMap;
       *
       *     // Declare a set state variable
       *     EnumerableMap.UintToAddressMap private myMap;
       * }
       * ```
       *
       * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
       * supported.
       */
      library EnumerableMap {
          // To implement this library for multiple types with as little code
          // repetition as possible, we write it in terms of a generic Map type with
          // bytes32 keys and values.
          // The Map implementation uses private functions, and user-facing
          // implementations (such as Uint256ToAddressMap) are just wrappers around
          // the underlying Map.
          // This means that we can only create new EnumerableMaps for types that fit
          // in bytes32.
          struct MapEntry {
              bytes32 _key;
              bytes32 _value;
          }
          struct Map {
              // Storage of map keys and values
              MapEntry[] _entries;
              // Position of the entry defined by a key in the `entries` array, plus 1
              // because index 0 means a key is not in the map.
              mapping (bytes32 => uint256) _indexes;
          }
          /**
           * @dev Adds a key-value pair to a map, or updates the value for an existing
           * key. O(1).
           *
           * Returns true if the key was added to the map, that is if it was not
           * already present.
           */
          function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
              // We read and store the key's index to prevent multiple reads from the same storage slot
              uint256 keyIndex = map._indexes[key];
              if (keyIndex == 0) { // Equivalent to !contains(map, key)
                  map._entries.push(MapEntry({ _key: key, _value: value }));
                  // The entry is stored at length-1, but we add 1 to all indexes
                  // and use 0 as a sentinel value
                  map._indexes[key] = map._entries.length;
                  return true;
              } else {
                  map._entries[keyIndex - 1]._value = value;
                  return false;
              }
          }
          /**
           * @dev Removes a key-value pair from a map. O(1).
           *
           * Returns true if the key was removed from the map, that is if it was present.
           */
          function _remove(Map storage map, bytes32 key) private returns (bool) {
              // We read and store the key's index to prevent multiple reads from the same storage slot
              uint256 keyIndex = map._indexes[key];
              if (keyIndex != 0) { // Equivalent to contains(map, key)
                  // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
                  // in the array, and then remove the last entry (sometimes called as 'swap and pop').
                  // This modifies the order of the array, as noted in {at}.
                  uint256 toDeleteIndex = keyIndex - 1;
                  uint256 lastIndex = map._entries.length - 1;
                  // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
                  // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
                  MapEntry storage lastEntry = map._entries[lastIndex];
                  // Move the last entry to the index where the entry to delete is
                  map._entries[toDeleteIndex] = lastEntry;
                  // Update the index for the moved entry
                  map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based
                  // Delete the slot where the moved entry was stored
                  map._entries.pop();
                  // Delete the index for the deleted slot
                  delete map._indexes[key];
                  return true;
              } else {
                  return false;
              }
          }
          /**
           * @dev Returns true if the key is in the map. O(1).
           */
          function _contains(Map storage map, bytes32 key) private view returns (bool) {
              return map._indexes[key] != 0;
          }
          /**
           * @dev Returns the number of key-value pairs in the map. O(1).
           */
          function _length(Map storage map) private view returns (uint256) {
              return map._entries.length;
          }
         /**
          * @dev Returns the key-value pair stored at position `index` in the map. O(1).
          *
          * Note that there are no guarantees on the ordering of entries inside the
          * array, and it may change when more entries are added or removed.
          *
          * Requirements:
          *
          * - `index` must be strictly less than {length}.
          */
          function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
              require(map._entries.length > index, "EnumerableMap: index out of bounds");
              MapEntry storage entry = map._entries[index];
              return (entry._key, entry._value);
          }
          /**
           * @dev Tries to returns the value associated with `key`.  O(1).
           * Does not revert if `key` is not in the map.
           */
          function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
              uint256 keyIndex = map._indexes[key];
              if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
              return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
          }
          /**
           * @dev Returns the value associated with `key`.  O(1).
           *
           * Requirements:
           *
           * - `key` must be in the map.
           */
          function _get(Map storage map, bytes32 key) private view returns (bytes32) {
              uint256 keyIndex = map._indexes[key];
              require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
              return map._entries[keyIndex - 1]._value; // All indexes are 1-based
          }
          /**
           * @dev Same as {_get}, with a custom error message when `key` is not in the map.
           *
           * CAUTION: This function is deprecated because it requires allocating memory for the error
           * message unnecessarily. For custom revert reasons use {_tryGet}.
           */
          function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
              uint256 keyIndex = map._indexes[key];
              require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
              return map._entries[keyIndex - 1]._value; // All indexes are 1-based
          }
          // UintToAddressMap
          struct UintToAddressMap {
              Map _inner;
          }
          /**
           * @dev Adds a key-value pair to a map, or updates the value for an existing
           * key. O(1).
           *
           * Returns true if the key was added to the map, that is if it was not
           * already present.
           */
          function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
              return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
          }
          /**
           * @dev Removes a value from a set. O(1).
           *
           * Returns true if the key was removed from the map, that is if it was present.
           */
          function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
              return _remove(map._inner, bytes32(key));
          }
          /**
           * @dev Returns true if the key is in the map. O(1).
           */
          function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
              return _contains(map._inner, bytes32(key));
          }
          /**
           * @dev Returns the number of elements in the map. O(1).
           */
          function length(UintToAddressMap storage map) internal view returns (uint256) {
              return _length(map._inner);
          }
         /**
          * @dev Returns the element stored at position `index` in the set. O(1).
          * Note that there are no guarantees on the ordering of values inside the
          * array, and it may change when more values are added or removed.
          *
          * Requirements:
          *
          * - `index` must be strictly less than {length}.
          */
          function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
              (bytes32 key, bytes32 value) = _at(map._inner, index);
              return (uint256(key), address(uint160(uint256(value))));
          }
          /**
           * @dev Tries to returns the value associated with `key`.  O(1).
           * Does not revert if `key` is not in the map.
           *
           * _Available since v3.4._
           */
          function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
              (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
              return (success, address(uint160(uint256(value))));
          }
          /**
           * @dev Returns the value associated with `key`.  O(1).
           *
           * Requirements:
           *
           * - `key` must be in the map.
           */
          function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
              return address(uint160(uint256(_get(map._inner, bytes32(key)))));
          }
          /**
           * @dev Same as {get}, with a custom error message when `key` is not in the map.
           *
           * CAUTION: This function is deprecated because it requires allocating memory for the error
           * message unnecessarily. For custom revert reasons use {tryGet}.
           */
          function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
              return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
          }
      }
      // File: @openzeppelin/contracts/utils/Strings.sol
      pragma solidity >=0.6.0 <0.8.0;
      /**
       * @dev String operations.
       */
      library Strings {
          /**
           * @dev Converts a `uint256` to its ASCII `string` representation.
           */
          function toString(uint256 value) internal pure returns (string memory) {
              // Inspired by OraclizeAPI's implementation - MIT licence
              // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
              if (value == 0) {
                  return "0";
              }
              uint256 temp = value;
              uint256 digits;
              while (temp != 0) {
                  digits++;
                  temp /= 10;
              }
              bytes memory buffer = new bytes(digits);
              uint256 index = digits - 1;
              temp = value;
              while (temp != 0) {
                  buffer[index--] = bytes1(uint8(48 + temp % 10));
                  temp /= 10;
              }
              return string(buffer);
          }
      }
      // File: @openzeppelin/contracts/token/ERC721/ERC721.sol
      pragma solidity >=0.6.0 <0.8.0;
      /**
       * @title ERC721 Non-Fungible Token Standard basic implementation
       * @dev see https://eips.ethereum.org/EIPS/eip-721
       */
      contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
          using SafeMath for uint256;
          using Address for address;
          using EnumerableSet for EnumerableSet.UintSet;
          using EnumerableMap for EnumerableMap.UintToAddressMap;
          using Strings for uint256;
          // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
          // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
          bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
          // Mapping from holder address to their (enumerable) set of owned tokens
          mapping (address => EnumerableSet.UintSet) private _holderTokens;
          // Enumerable mapping from token ids to their owners
          EnumerableMap.UintToAddressMap private _tokenOwners;
          // Mapping from token ID to approved address
          mapping (uint256 => address) private _tokenApprovals;
          // Mapping from owner to operator approvals
          mapping (address => mapping (address => bool)) private _operatorApprovals;
          // Token name
          string private _name;
          // Token symbol
          string private _symbol;
          // Optional mapping for token URIs
          mapping (uint256 => string) private _tokenURIs;
          // Base URI
          string private _baseURI;
          /*
           *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
           *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
           *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
           *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
           *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
           *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
           *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
           *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
           *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
           *
           *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
           *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
           */
          bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
          /*
           *     bytes4(keccak256('name()')) == 0x06fdde03
           *     bytes4(keccak256('symbol()')) == 0x95d89b41
           *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
           *
           *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
           */
          bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;
          /*
           *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
           *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
           *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
           *
           *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
           */
          bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;
          /**
           * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
           */
          constructor (string memory name_, string memory symbol_) public {
              _name = name_;
              _symbol = symbol_;
              // register the supported interfaces to conform to ERC721 via ERC165
              _registerInterface(_INTERFACE_ID_ERC721);
              _registerInterface(_INTERFACE_ID_ERC721_METADATA);
              _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
          }
          /**
           * @dev See {IERC721-balanceOf}.
           */
          function balanceOf(address owner) public view virtual override returns (uint256) {
              require(owner != address(0), "ERC721: balance query for the zero address");
              return _holderTokens[owner].length();
          }
          /**
           * @dev See {IERC721-ownerOf}.
           */
          function ownerOf(uint256 tokenId) public view virtual override returns (address) {
              return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
          }
          /**
           * @dev See {IERC721Metadata-name}.
           */
          function name() public view virtual override returns (string memory) {
              return _name;
          }
          /**
           * @dev See {IERC721Metadata-symbol}.
           */
          function symbol() public view virtual override returns (string memory) {
              return _symbol;
          }
          /**
           * @dev See {IERC721Metadata-tokenURI}.
           */
          function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
              require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
              string memory _tokenURI = _tokenURIs[tokenId];
              string memory base = baseURI();
              // If there is no base URI, return the token URI.
              if (bytes(base).length == 0) {
                  return _tokenURI;
              }
              // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
              if (bytes(_tokenURI).length > 0) {
                  return string(abi.encodePacked(base, _tokenURI));
              }
              // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
              return string(abi.encodePacked(base, tokenId.toString()));
          }
          /**
          * @dev Returns the base URI set via {_setBaseURI}. This will be
          * automatically added as a prefix in {tokenURI} to each token's URI, or
          * to the token ID if no specific URI is set for that token ID.
          */
          function baseURI() public view virtual returns (string memory) {
              return _baseURI;
          }
          /**
           * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
           */
          function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
              return _holderTokens[owner].at(index);
          }
          /**
           * @dev See {IERC721Enumerable-totalSupply}.
           */
          function totalSupply() public view virtual override returns (uint256) {
              // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
              return _tokenOwners.length();
          }
          /**
           * @dev See {IERC721Enumerable-tokenByIndex}.
           */
          function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
              (uint256 tokenId, ) = _tokenOwners.at(index);
              return tokenId;
          }
          /**
           * @dev See {IERC721-approve}.
           */
          function approve(address to, uint256 tokenId) public virtual override {
              address owner = ERC721.ownerOf(tokenId);
              require(to != owner, "ERC721: approval to current owner");
              require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()),
                  "ERC721: approve caller is not owner nor approved for all"
              );
              _approve(to, tokenId);
          }
          /**
           * @dev See {IERC721-getApproved}.
           */
          function getApproved(uint256 tokenId) public view virtual override returns (address) {
              require(_exists(tokenId), "ERC721: approved query for nonexistent token");
              return _tokenApprovals[tokenId];
          }
          /**
           * @dev See {IERC721-setApprovalForAll}.
           */
          function setApprovalForAll(address operator, bool approved) public virtual override {
              require(operator != _msgSender(), "ERC721: approve to caller");
              _operatorApprovals[_msgSender()][operator] = approved;
              emit ApprovalForAll(_msgSender(), operator, approved);
          }
          /**
           * @dev See {IERC721-isApprovedForAll}.
           */
          function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
              return _operatorApprovals[owner][operator];
          }
          /**
           * @dev See {IERC721-transferFrom}.
           */
          function transferFrom(address from, address to, uint256 tokenId) public virtual override {
              //solhint-disable-next-line max-line-length
              require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
              _transfer(from, to, tokenId);
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
              safeTransferFrom(from, to, tokenId, "");
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
              require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
              _safeTransfer(from, to, tokenId, _data);
          }
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
           * are aware of the ERC721 protocol to prevent tokens from being forever locked.
           *
           * `_data` is additional data, it has no specified format and it is sent in call to `to`.
           *
           * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
           * implement alternative mechanisms to perform token transfer, such as signature-based.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
              _transfer(from, to, tokenId);
              require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
          }
          /**
           * @dev Returns whether `tokenId` exists.
           *
           * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
           *
           * Tokens start existing when they are minted (`_mint`),
           * and stop existing when they are burned (`_burn`).
           */
          function _exists(uint256 tokenId) internal view virtual returns (bool) {
              return _tokenOwners.contains(tokenId);
          }
          /**
           * @dev Returns whether `spender` is allowed to manage `tokenId`.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
              require(_exists(tokenId), "ERC721: operator query for nonexistent token");
              address owner = ERC721.ownerOf(tokenId);
              return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender));
          }
          /**
           * @dev Safely mints `tokenId` and transfers it to `to`.
           *
           * Requirements:
           d*
           * - `tokenId` must not exist.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function _safeMint(address to, uint256 tokenId) internal virtual {
              _safeMint(to, tokenId, "");
          }
          /**
           * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
           * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
           */
          function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
              _mint(to, tokenId);
              require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
          }
          /**
           * @dev Mints `tokenId` and transfers it to `to`.
           *
           * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
           *
           * Requirements:
           *
           * - `tokenId` must not exist.
           * - `to` cannot be the zero address.
           *
           * Emits a {Transfer} event.
           */
          function _mint(address to, uint256 tokenId) internal virtual {
              require(to != address(0), "ERC721: mint to the zero address");
              require(!_exists(tokenId), "ERC721: token already minted");
              _beforeTokenTransfer(address(0), to, tokenId);
              _holderTokens[to].add(tokenId);
              _tokenOwners.set(tokenId, to);
              emit Transfer(address(0), to, tokenId);
          }
          /**
           * @dev Destroys `tokenId`.
           * The approval is cleared when the token is burned.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           *
           * Emits a {Transfer} event.
           */
          function _burn(uint256 tokenId) internal virtual {
              address owner = ERC721.ownerOf(tokenId); // internal owner
              _beforeTokenTransfer(owner, address(0), tokenId);
              // Clear approvals
              _approve(address(0), tokenId);
              // Clear metadata (if any)
              if (bytes(_tokenURIs[tokenId]).length != 0) {
                  delete _tokenURIs[tokenId];
              }
              _holderTokens[owner].remove(tokenId);
              _tokenOwners.remove(tokenId);
              emit Transfer(owner, address(0), tokenId);
          }
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           *
           * Emits a {Transfer} event.
           */
          function _transfer(address from, address to, uint256 tokenId) internal virtual {
              require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner
              require(to != address(0), "ERC721: transfer to the zero address");
              _beforeTokenTransfer(from, to, tokenId);
              // Clear approvals from the previous owner
              _approve(address(0), tokenId);
              _holderTokens[from].remove(tokenId);
              _holderTokens[to].add(tokenId);
              _tokenOwners.set(tokenId, to);
              emit Transfer(from, to, tokenId);
          }
          /**
           * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
              require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
              _tokenURIs[tokenId] = _tokenURI;
          }
          /**
           * @dev Internal function to set the base URI for all token IDs. It is
           * automatically added as a prefix to the value returned in {tokenURI},
           * or to the token ID if {tokenURI} is empty.
           */
          function _setBaseURI(string memory baseURI_) internal virtual {
              _baseURI = baseURI_;
          }
          /**
           * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
           * The call is not executed if the target address is not a contract.
           *
           * @param from address representing the previous owner of the given token ID
           * @param to target address that will receive the tokens
           * @param tokenId uint256 ID of the token to be transferred
           * @param _data bytes optional data to send along with the call
           * @return bool whether the call correctly returned the expected magic value
           */
          function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
              private returns (bool)
          {
              if (!to.isContract()) {
                  return true;
              }
              bytes memory returndata = to.functionCall(abi.encodeWithSelector(
                  IERC721Receiver(to).onERC721Received.selector,
                  _msgSender(),
                  from,
                  tokenId,
                  _data
              ), "ERC721: transfer to non ERC721Receiver implementer");
              bytes4 retval = abi.decode(returndata, (bytes4));
              return (retval == _ERC721_RECEIVED);
          }
          /**
           * @dev Approve `to` to operate on `tokenId`
           *
           * Emits an {Approval} event.
           */
          function _approve(address to, uint256 tokenId) internal virtual {
              _tokenApprovals[tokenId] = to;
              emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
          }
          /**
           * @dev Hook that is called before any token transfer. This includes minting
           * and burning.
           *
           * 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, ``from``'s `tokenId` will be burned.
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           *
           * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
           */
          function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
      }
      // File: @openzeppelin/contracts/access/Ownable.sol
      pragma solidity >=0.6.0 <0.8.0;
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract Ownable is Context {
          address private _owner;
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          constructor () internal {
              address msgSender = _msgSender();
              _owner = msgSender;
              emit OwnershipTransferred(address(0), msgSender);
          }
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              require(owner() == _msgSender(), "Ownable: caller is not the owner");
              _;
          }
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              emit OwnershipTransferred(_owner, address(0));
              _owner = address(0);
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              emit OwnershipTransferred(_owner, newOwner);
              _owner = newOwner;
          }
      }
      // File: contracts/StandardMilady.sol
      pragma solidity 0.7.0;
      /**
       * @title Miladys contract
       * @dev Extends ERC721 Non-Fungible Token Standard basic implementation
       */
      contract Miladys is ERC721, Ownable {
          using SafeMath for uint256;
          string public MILADY_PROVENANCE = "";
          uint public constant maxMiladyPurchase = 30;
          uint256 public constant MAX_MILADYS = 9500;
          bool public saleIsActive = false;
          uint256 public standardMiladyCount = 0;
          
          mapping(address => bool) public whitelistOneMint;
          mapping(address => bool) public whitelistTwoMint;
          constructor() ERC721("Milady", "MIL") {
          }
          
          function setProvenanceHash(string memory provenanceHash) public onlyOwner {
              MILADY_PROVENANCE = provenanceHash;
          }
          
          function withdraw() public onlyOwner {
              uint balance = address(this).balance;
              msg.sender.transfer(balance);
          }
          function editWhitelistOne(address[] memory array) public onlyOwner {
              for(uint256 i = 0; i < array.length; i++) {
                  address addressElement = array[i];
                  whitelistOneMint[addressElement] = true;
              } 
          }
          function editWhitelistTwo(address[] memory array) public onlyOwner {
              for(uint256 i = 0; i < array.length; i++) {
                  address addressElement = array[i];
                  whitelistTwoMint[addressElement] = true;
              } 
          }
          function reserveMintMiladys() public {
              require(whitelistTwoMint[msg.sender] || whitelistOneMint[msg.sender], "sender not whitelisted");
              uint mintAmount;
              if (whitelistTwoMint[msg.sender]) {
                  whitelistTwoMint[msg.sender] = false;
                  mintAmount = 2;
              } else {
                  whitelistOneMint[msg.sender] = false;
                  mintAmount = 1;
              }
              uint i;
              for (i = 0; i < mintAmount && totalSupply() < 10000; i++) {
                  uint supply = totalSupply();
                  _safeMint(msg.sender, supply);
              }
          }
          
          function flipSaleState() public onlyOwner {
              saleIsActive = !saleIsActive;
          }
          
          function setBaseURI(string memory baseURI) public onlyOwner {
              _setBaseURI(baseURI);
          }
          function mintMiladys(uint256 numberOfTokens) public payable {
              require(saleIsActive, "Sale must be active to mint Miladys");
              require(numberOfTokens <= maxMiladyPurchase, "Can only mint up to 30 tokens at a time");
              require(standardMiladyCount.add(numberOfTokens) <= MAX_MILADYS, "Purchase would exceed max supply of Miladys");
              uint256 miladyPrice;
              if (numberOfTokens == 30) {
                  miladyPrice = 60000000000000000; // 0.06 ETH
                  require(miladyPrice.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct");
              } else if (numberOfTokens >= 15) {
                  miladyPrice = 70000000000000000; // 0.07 ETH
                  require(miladyPrice.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct");
              } else if (numberOfTokens >= 5) {
                  miladyPrice = 75000000000000000; // 0.075 ETH
                  require(miladyPrice.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct");
              } else {
                  miladyPrice = 80000000000000000; // 0.08 ETH
                  require(miladyPrice.mul(numberOfTokens) <= msg.value, "Ether value sent is not correct");
              }
              for(uint i = 0; i < numberOfTokens; i++) {
                  if (standardMiladyCount < MAX_MILADYS) {
                      _safeMint(msg.sender, totalSupply());
                      standardMiladyCount++;
                  }
              }
          }
      }
      

      File 3 of 10: SSRWives
      // SPDX-License-Identifier: MIT
      
      
      // File @openzeppelin/contracts/utils/[email protected]
      
      
      // OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Provides information about the current execution context, including the
       * sender of the transaction and its data. While these are generally available
       * via msg.sender and msg.data, they should not be accessed in such a direct
       * manner, since when dealing with meta-transactions the account sending and
       * paying for execution may not be the actual sender (as far as an application
       * is concerned).
       *
       * This contract is only required for intermediate, library-like contracts.
       */
      abstract contract Context {
          function _msgSender() internal view virtual returns (address) {
              return msg.sender;
          }
      
          function _msgData() internal view virtual returns (bytes calldata) {
              return msg.data;
          }
      }
      
      
      // File @openzeppelin/contracts/access/[email protected]
      
      
      // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract Ownable is Context {
          address private _owner;
      
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
      
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          constructor() {
              _transferOwnership(_msgSender());
          }
      
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              _checkOwner();
              _;
          }
      
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
      
          /**
           * @dev Throws if the sender is not the owner.
           */
          function _checkOwner() internal view virtual {
              require(owner() == _msgSender(), "Ownable: caller is not the owner");
          }
      
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              _transferOwnership(address(0));
          }
      
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              _transferOwnership(newOwner);
          }
      
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Internal function without access restriction.
           */
          function _transferOwnership(address newOwner) internal virtual {
              address oldOwner = _owner;
              _owner = newOwner;
              emit OwnershipTransferred(oldOwner, newOwner);
          }
      }
      
      
      // File @openzeppelin/contracts/utils/introspection/[email protected]
      
      
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165 {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      
      
      // File @openzeppelin/contracts/token/ERC721/[email protected]
      
      
      // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Required interface of an ERC721 compliant contract.
       */
      interface IERC721 is IERC165 {
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
      
          /**
           * @dev Returns the number of tokens in ``owner``'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
      
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes calldata data
          ) external;
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
           * are aware of the ERC721 protocol to prevent tokens from being forever locked.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external;
      
          /**
           * @dev Transfers `tokenId` token from `from` to `to`.
           *
           * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
           * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
           * understand this adds an external call which potentially creates a reentrancy vulnerability.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           *
           * Emits a {Transfer} event.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external;
      
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external;
      
          /**
           * @dev Approve or remove `operator` as an operator for the caller.
           * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
           *
           * Requirements:
           *
           * - The `operator` cannot be the caller.
           *
           * Emits an {ApprovalForAll} event.
           */
          function setApprovalForAll(address operator, bool _approved) external;
      
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
      
          /**
           * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
           *
           * See {setApprovalForAll}
           */
          function isApprovedForAll(address owner, address operator) external view returns (bool);
      }
      
      
      // File @openzeppelin/contracts/token/ERC721/extensions/[email protected]
      
      
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
       * @dev See https://eips.ethereum.org/EIPS/eip-721
       */
      interface IERC721Metadata is IERC721 {
          /**
           * @dev Returns the token collection name.
           */
          function name() external view returns (string memory);
      
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() external view returns (string memory);
      
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) external view returns (string memory);
      }
      
      
      // File @openzeppelin/contracts/token/ERC721/[email protected]
      
      
      // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @title ERC721 token receiver interface
       * @dev Interface for any contract that wants to support safeTransfers
       * from ERC721 asset contracts.
       */
      interface IERC721Receiver {
          /**
           * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
           * by `operator` from `from`, this function is called.
           *
           * It must return its Solidity selector to confirm the token transfer.
           * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
           *
           * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
           */
          function onERC721Received(
              address operator,
              address from,
              uint256 tokenId,
              bytes calldata data
          ) external returns (bytes4);
      }
      
      
      // File @openzeppelin/contracts/utils/[email protected]
      
      
      // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
      
      pragma solidity ^0.8.1;
      
      /**
       * @dev Collection of functions related to the address type
       */
      library Address {
          /**
           * @dev Returns true if `account` is a contract.
           *
           * [IMPORTANT]
           * ====
           * It is unsafe to assume that an address for which this function returns
           * false is an externally-owned account (EOA) and not a contract.
           *
           * Among others, `isContract` will return false for the following
           * types of addresses:
           *
           *  - an externally-owned account
           *  - a contract in construction
           *  - an address where a contract will be created
           *  - an address where a contract lived, but was destroyed
           * ====
           *
           * [IMPORTANT]
           * ====
           * You shouldn't rely on `isContract` to protect against flash loan attacks!
           *
           * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
           * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
           * constructor.
           * ====
           */
          function isContract(address account) internal view returns (bool) {
              // This method relies on extcodesize/address.code.length, which returns 0
              // for contracts in construction, since the code is only stored at the end
              // of the constructor execution.
      
              return account.code.length > 0;
          }
      
          /**
           * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
           * `recipient`, forwarding all available gas and reverting on errors.
           *
           * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
           * of certain opcodes, possibly making contracts go over the 2300 gas limit
           * imposed by `transfer`, making them unable to receive funds via
           * `transfer`. {sendValue} removes this limitation.
           *
           * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
           *
           * IMPORTANT: because control is transferred to `recipient`, care must be
           * taken to not create reentrancy vulnerabilities. Consider using
           * {ReentrancyGuard} or the
           * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
           */
          function sendValue(address payable recipient, uint256 amount) internal {
              require(address(this).balance >= amount, "Address: insufficient balance");
      
              (bool success, ) = recipient.call{value: amount}("");
              require(success, "Address: unable to send value, recipient may have reverted");
          }
      
          /**
           * @dev Performs a Solidity function call using a low level `call`. A
           * plain `call` is an unsafe replacement for a function call: use this
           * function instead.
           *
           * If `target` reverts with a revert reason, it is bubbled up by this
           * function (like regular Solidity function calls).
           *
           * Returns the raw returned data. To convert to the expected return value,
           * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
           *
           * Requirements:
           *
           * - `target` must be a contract.
           * - calling `target` with `data` must not revert.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, "Address: low-level call failed");
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
           * `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, errorMessage);
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but also transferring `value` wei to `target`.
           *
           * Requirements:
           *
           * - the calling contract must have an ETH balance of at least `value`.
           * - the called Solidity function must be `payable`.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
          }
      
          /**
           * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
           * with `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(address(this).balance >= value, "Address: insufficient balance for call");
              (bool success, bytes memory returndata) = target.call{value: value}(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
              return functionStaticCall(target, data, "Address: low-level static call failed");
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              (bool success, bytes memory returndata) = target.staticcall(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionDelegateCall(target, data, "Address: low-level delegate call failed");
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              (bool success, bytes memory returndata) = target.delegatecall(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
      
          /**
           * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
           * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
           *
           * _Available since v4.8._
           */
          function verifyCallResultFromTarget(
              address target,
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              if (success) {
                  if (returndata.length == 0) {
                      // only check isContract if the call was successful and the return data is empty
                      // otherwise we already know that it was a contract
                      require(isContract(target), "Address: call to non-contract");
                  }
                  return returndata;
              } else {
                  _revert(returndata, errorMessage);
              }
          }
      
          /**
           * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
           * revert reason or using the provided one.
           *
           * _Available since v4.3._
           */
          function verifyCallResult(
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal pure returns (bytes memory) {
              if (success) {
                  return returndata;
              } else {
                  _revert(returndata, errorMessage);
              }
          }
      
          function _revert(bytes memory returndata, string memory errorMessage) private pure {
              // Look for revert reason and bubble it up if present
              if (returndata.length > 0) {
                  // The easiest way to bubble the revert reason is using memory via assembly
                  /// @solidity memory-safe-assembly
                  assembly {
                      let returndata_size := mload(returndata)
                      revert(add(32, returndata), returndata_size)
                  }
              } else {
                  revert(errorMessage);
              }
          }
      }
      
      
      // File @openzeppelin/contracts/utils/introspection/[email protected]
      
      
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Implementation of the {IERC165} interface.
       *
       * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
       * for the additional interface id that will be supported. For example:
       *
       * ```solidity
       * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
       *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
       * }
       * ```
       *
       * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
       */
      abstract contract ERC165 is IERC165 {
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              return interfaceId == type(IERC165).interfaceId;
          }
      }
      
      
      // File @openzeppelin/contracts/utils/math/[email protected]
      
      
      // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Standard math utilities missing in the Solidity language.
       */
      library Math {
          enum Rounding {
              Down, // Toward negative infinity
              Up, // Toward infinity
              Zero // Toward zero
          }
      
          /**
           * @dev Returns the largest of two numbers.
           */
          function max(uint256 a, uint256 b) internal pure returns (uint256) {
              return a > b ? a : b;
          }
      
          /**
           * @dev Returns the smallest of two numbers.
           */
          function min(uint256 a, uint256 b) internal pure returns (uint256) {
              return a < b ? a : b;
          }
      
          /**
           * @dev Returns the average of two numbers. The result is rounded towards
           * zero.
           */
          function average(uint256 a, uint256 b) internal pure returns (uint256) {
              // (a + b) / 2 can overflow.
              return (a & b) + (a ^ b) / 2;
          }
      
          /**
           * @dev Returns the ceiling of the division of two numbers.
           *
           * This differs from standard division with `/` in that it rounds up instead
           * of rounding down.
           */
          function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
              // (a + b - 1) / b can overflow on addition, so we distribute.
              return a == 0 ? 0 : (a - 1) / b + 1;
          }
      
          /**
           * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
           * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
           * with further edits by Uniswap Labs also under MIT license.
           */
          function mulDiv(
              uint256 x,
              uint256 y,
              uint256 denominator
          ) internal pure returns (uint256 result) {
              unchecked {
                  // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
                  // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
                  // variables such that product = prod1 * 2^256 + prod0.
                  uint256 prod0; // Least significant 256 bits of the product
                  uint256 prod1; // Most significant 256 bits of the product
                  assembly {
                      let mm := mulmod(x, y, not(0))
                      prod0 := mul(x, y)
                      prod1 := sub(sub(mm, prod0), lt(mm, prod0))
                  }
      
                  // Handle non-overflow cases, 256 by 256 division.
                  if (prod1 == 0) {
                      return prod0 / denominator;
                  }
      
                  // Make sure the result is less than 2^256. Also prevents denominator == 0.
                  require(denominator > prod1);
      
                  ///////////////////////////////////////////////
                  // 512 by 256 division.
                  ///////////////////////////////////////////////
      
                  // Make division exact by subtracting the remainder from [prod1 prod0].
                  uint256 remainder;
                  assembly {
                      // Compute remainder using mulmod.
                      remainder := mulmod(x, y, denominator)
      
                      // Subtract 256 bit number from 512 bit number.
                      prod1 := sub(prod1, gt(remainder, prod0))
                      prod0 := sub(prod0, remainder)
                  }
      
                  // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
                  // See https://cs.stackexchange.com/q/138556/92363.
      
                  // Does not overflow because the denominator cannot be zero at this stage in the function.
                  uint256 twos = denominator & (~denominator + 1);
                  assembly {
                      // Divide denominator by twos.
                      denominator := div(denominator, twos)
      
                      // Divide [prod1 prod0] by twos.
                      prod0 := div(prod0, twos)
      
                      // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                      twos := add(div(sub(0, twos), twos), 1)
                  }
      
                  // Shift in bits from prod1 into prod0.
                  prod0 |= prod1 * twos;
      
                  // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
                  // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
                  // four bits. That is, denominator * inv = 1 mod 2^4.
                  uint256 inverse = (3 * denominator) ^ 2;
      
                  // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
                  // in modular arithmetic, doubling the correct bits in each step.
                  inverse *= 2 - denominator * inverse; // inverse mod 2^8
                  inverse *= 2 - denominator * inverse; // inverse mod 2^16
                  inverse *= 2 - denominator * inverse; // inverse mod 2^32
                  inverse *= 2 - denominator * inverse; // inverse mod 2^64
                  inverse *= 2 - denominator * inverse; // inverse mod 2^128
                  inverse *= 2 - denominator * inverse; // inverse mod 2^256
      
                  // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
                  // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
                  // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
                  // is no longer required.
                  result = prod0 * inverse;
                  return result;
              }
          }
      
          /**
           * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
           */
          function mulDiv(
              uint256 x,
              uint256 y,
              uint256 denominator,
              Rounding rounding
          ) internal pure returns (uint256) {
              uint256 result = mulDiv(x, y, denominator);
              if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
                  result += 1;
              }
              return result;
          }
      
          /**
           * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
           *
           * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
           */
          function sqrt(uint256 a) internal pure returns (uint256) {
              if (a == 0) {
                  return 0;
              }
      
              // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
              //
              // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
              // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
              //
              // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
              // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
              // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
              //
              // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
              uint256 result = 1 << (log2(a) >> 1);
      
              // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
              // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
              // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
              // into the expected uint128 result.
              unchecked {
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  return min(result, a / result);
              }
          }
      
          /**
           * @notice Calculates sqrt(a), following the selected rounding direction.
           */
          function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
              unchecked {
                  uint256 result = sqrt(a);
                  return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
              }
          }
      
          /**
           * @dev Return the log in base 2, rounded down, of a positive value.
           * Returns 0 if given 0.
           */
          function log2(uint256 value) internal pure returns (uint256) {
              uint256 result = 0;
              unchecked {
                  if (value >> 128 > 0) {
                      value >>= 128;
                      result += 128;
                  }
                  if (value >> 64 > 0) {
                      value >>= 64;
                      result += 64;
                  }
                  if (value >> 32 > 0) {
                      value >>= 32;
                      result += 32;
                  }
                  if (value >> 16 > 0) {
                      value >>= 16;
                      result += 16;
                  }
                  if (value >> 8 > 0) {
                      value >>= 8;
                      result += 8;
                  }
                  if (value >> 4 > 0) {
                      value >>= 4;
                      result += 4;
                  }
                  if (value >> 2 > 0) {
                      value >>= 2;
                      result += 2;
                  }
                  if (value >> 1 > 0) {
                      result += 1;
                  }
              }
              return result;
          }
      
          /**
           * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
           * Returns 0 if given 0.
           */
          function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
              unchecked {
                  uint256 result = log2(value);
                  return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
              }
          }
      
          /**
           * @dev Return the log in base 10, rounded down, of a positive value.
           * Returns 0 if given 0.
           */
          function log10(uint256 value) internal pure returns (uint256) {
              uint256 result = 0;
              unchecked {
                  if (value >= 10**64) {
                      value /= 10**64;
                      result += 64;
                  }
                  if (value >= 10**32) {
                      value /= 10**32;
                      result += 32;
                  }
                  if (value >= 10**16) {
                      value /= 10**16;
                      result += 16;
                  }
                  if (value >= 10**8) {
                      value /= 10**8;
                      result += 8;
                  }
                  if (value >= 10**4) {
                      value /= 10**4;
                      result += 4;
                  }
                  if (value >= 10**2) {
                      value /= 10**2;
                      result += 2;
                  }
                  if (value >= 10**1) {
                      result += 1;
                  }
              }
              return result;
          }
      
          /**
           * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
           * Returns 0 if given 0.
           */
          function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
              unchecked {
                  uint256 result = log10(value);
                  return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
              }
          }
      
          /**
           * @dev Return the log in base 256, rounded down, of a positive value.
           * Returns 0 if given 0.
           *
           * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
           */
          function log256(uint256 value) internal pure returns (uint256) {
              uint256 result = 0;
              unchecked {
                  if (value >> 128 > 0) {
                      value >>= 128;
                      result += 16;
                  }
                  if (value >> 64 > 0) {
                      value >>= 64;
                      result += 8;
                  }
                  if (value >> 32 > 0) {
                      value >>= 32;
                      result += 4;
                  }
                  if (value >> 16 > 0) {
                      value >>= 16;
                      result += 2;
                  }
                  if (value >> 8 > 0) {
                      result += 1;
                  }
              }
              return result;
          }
      
          /**
           * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
           * Returns 0 if given 0.
           */
          function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
              unchecked {
                  uint256 result = log256(value);
                  return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
              }
          }
      }
      
      
      // File @openzeppelin/contracts/utils/[email protected]
      
      
      // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev String operations.
       */
      library Strings {
          bytes16 private constant _SYMBOLS = "0123456789abcdef";
          uint8 private constant _ADDRESS_LENGTH = 20;
      
          /**
           * @dev Converts a `uint256` to its ASCII `string` decimal representation.
           */
          function toString(uint256 value) internal pure returns (string memory) {
              unchecked {
                  uint256 length = Math.log10(value) + 1;
                  string memory buffer = new string(length);
                  uint256 ptr;
                  /// @solidity memory-safe-assembly
                  assembly {
                      ptr := add(buffer, add(32, length))
                  }
                  while (true) {
                      ptr--;
                      /// @solidity memory-safe-assembly
                      assembly {
                          mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                      }
                      value /= 10;
                      if (value == 0) break;
                  }
                  return buffer;
              }
          }
      
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
           */
          function toHexString(uint256 value) internal pure returns (string memory) {
              unchecked {
                  return toHexString(value, Math.log256(value) + 1);
              }
          }
      
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
           */
          function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
              bytes memory buffer = new bytes(2 * length + 2);
              buffer[0] = "0";
              buffer[1] = "x";
              for (uint256 i = 2 * length + 1; i > 1; --i) {
                  buffer[i] = _SYMBOLS[value & 0xf];
                  value >>= 4;
              }
              require(value == 0, "Strings: hex length insufficient");
              return string(buffer);
          }
      
          /**
           * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
           */
          function toHexString(address addr) internal pure returns (string memory) {
              return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
          }
      }
      
      
      // File @openzeppelin/contracts/token/ERC721/[email protected]
      
      
      // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)
      
      pragma solidity ^0.8.0;
      
      
      
      
      
      
      
      /**
       * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
       * the Metadata extension, but not including the Enumerable extension, which is available separately as
       * {ERC721Enumerable}.
       */
      contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
          using Address for address;
          using Strings for uint256;
      
          // Token name
          string private _name;
      
          // Token symbol
          string private _symbol;
      
          // Mapping from token ID to owner address
          mapping(uint256 => address) private _owners;
      
          // Mapping owner address to token count
          mapping(address => uint256) private _balances;
      
          // Mapping from token ID to approved address
          mapping(uint256 => address) private _tokenApprovals;
      
          // Mapping from owner to operator approvals
          mapping(address => mapping(address => bool)) private _operatorApprovals;
      
          /**
           * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
           */
          constructor(string memory name_, string memory symbol_) {
              _name = name_;
              _symbol = symbol_;
          }
      
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
              return
                  interfaceId == type(IERC721).interfaceId ||
                  interfaceId == type(IERC721Metadata).interfaceId ||
                  super.supportsInterface(interfaceId);
          }
      
          /**
           * @dev See {IERC721-balanceOf}.
           */
          function balanceOf(address owner) public view virtual override returns (uint256) {
              require(owner != address(0), "ERC721: address zero is not a valid owner");
              return _balances[owner];
          }
      
          /**
           * @dev See {IERC721-ownerOf}.
           */
          function ownerOf(uint256 tokenId) public view virtual override returns (address) {
              address owner = _ownerOf(tokenId);
              require(owner != address(0), "ERC721: invalid token ID");
              return owner;
          }
      
          /**
           * @dev See {IERC721Metadata-name}.
           */
          function name() public view virtual override returns (string memory) {
              return _name;
          }
      
          /**
           * @dev See {IERC721Metadata-symbol}.
           */
          function symbol() public view virtual override returns (string memory) {
              return _symbol;
          }
      
          /**
           * @dev See {IERC721Metadata-tokenURI}.
           */
          function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
              _requireMinted(tokenId);
      
              string memory baseURI = _baseURI();
              return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
          }
      
          /**
           * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
           * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
           * by default, can be overridden in child contracts.
           */
          function _baseURI() internal view virtual returns (string memory) {
              return "";
          }
      
          /**
           * @dev See {IERC721-approve}.
           */
          function approve(address to, uint256 tokenId) public virtual override {
              address owner = ERC721.ownerOf(tokenId);
              require(to != owner, "ERC721: approval to current owner");
      
              require(
                  _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
                  "ERC721: approve caller is not token owner or approved for all"
              );
      
              _approve(to, tokenId);
          }
      
          /**
           * @dev See {IERC721-getApproved}.
           */
          function getApproved(uint256 tokenId) public view virtual override returns (address) {
              _requireMinted(tokenId);
      
              return _tokenApprovals[tokenId];
          }
      
          /**
           * @dev See {IERC721-setApprovalForAll}.
           */
          function setApprovalForAll(address operator, bool approved) public virtual override {
              _setApprovalForAll(_msgSender(), operator, approved);
          }
      
          /**
           * @dev See {IERC721-isApprovedForAll}.
           */
          function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
              return _operatorApprovals[owner][operator];
          }
      
          /**
           * @dev See {IERC721-transferFrom}.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              //solhint-disable-next-line max-line-length
              require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
      
              _transfer(from, to, tokenId);
          }
      
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              safeTransferFrom(from, to, tokenId, "");
          }
      
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory data
          ) public virtual override {
              require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
              _safeTransfer(from, to, tokenId, data);
          }
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
           * are aware of the ERC721 protocol to prevent tokens from being forever locked.
           *
           * `data` is additional data, it has no specified format and it is sent in call to `to`.
           *
           * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
           * implement alternative mechanisms to perform token transfer, such as signature-based.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function _safeTransfer(
              address from,
              address to,
              uint256 tokenId,
              bytes memory data
          ) internal virtual {
              _transfer(from, to, tokenId);
              require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
          }
      
          /**
           * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
           */
          function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
              return _owners[tokenId];
          }
      
          /**
           * @dev Returns whether `tokenId` exists.
           *
           * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
           *
           * Tokens start existing when they are minted (`_mint`),
           * and stop existing when they are burned (`_burn`).
           */
          function _exists(uint256 tokenId) internal view virtual returns (bool) {
              return _ownerOf(tokenId) != address(0);
          }
      
          /**
           * @dev Returns whether `spender` is allowed to manage `tokenId`.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
              address owner = ERC721.ownerOf(tokenId);
              return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
          }
      
          /**
           * @dev Safely mints `tokenId` and transfers it to `to`.
           *
           * Requirements:
           *
           * - `tokenId` must not exist.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function _safeMint(address to, uint256 tokenId) internal virtual {
              _safeMint(to, tokenId, "");
          }
      
          /**
           * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
           * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
           */
          function _safeMint(
              address to,
              uint256 tokenId,
              bytes memory data
          ) internal virtual {
              _mint(to, tokenId);
              require(
                  _checkOnERC721Received(address(0), to, tokenId, data),
                  "ERC721: transfer to non ERC721Receiver implementer"
              );
          }
      
          /**
           * @dev Mints `tokenId` and transfers it to `to`.
           *
           * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
           *
           * Requirements:
           *
           * - `tokenId` must not exist.
           * - `to` cannot be the zero address.
           *
           * Emits a {Transfer} event.
           */
          function _mint(address to, uint256 tokenId) internal virtual {
              require(to != address(0), "ERC721: mint to the zero address");
              require(!_exists(tokenId), "ERC721: token already minted");
      
              _beforeTokenTransfer(address(0), to, tokenId, 1);
      
              // Check that tokenId was not minted by `_beforeTokenTransfer` hook
              require(!_exists(tokenId), "ERC721: token already minted");
      
              unchecked {
                  // Will not overflow unless all 2**256 token ids are minted to the same owner.
                  // Given that tokens are minted one by one, it is impossible in practice that
                  // this ever happens. Might change if we allow batch minting.
                  // The ERC fails to describe this case.
                  _balances[to] += 1;
              }
      
              _owners[tokenId] = to;
      
              emit Transfer(address(0), to, tokenId);
      
              _afterTokenTransfer(address(0), to, tokenId, 1);
          }
      
          /**
           * @dev Destroys `tokenId`.
           * The approval is cleared when the token is burned.
           * This is an internal function that does not check if the sender is authorized to operate on the token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           *
           * Emits a {Transfer} event.
           */
          function _burn(uint256 tokenId) internal virtual {
              address owner = ERC721.ownerOf(tokenId);
      
              _beforeTokenTransfer(owner, address(0), tokenId, 1);
      
              // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
              owner = ERC721.ownerOf(tokenId);
      
              // Clear approvals
              delete _tokenApprovals[tokenId];
      
              unchecked {
                  // Cannot overflow, as that would require more tokens to be burned/transferred
                  // out than the owner initially received through minting and transferring in.
                  _balances[owner] -= 1;
              }
              delete _owners[tokenId];
      
              emit Transfer(owner, address(0), tokenId);
      
              _afterTokenTransfer(owner, address(0), tokenId, 1);
          }
      
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           *
           * Emits a {Transfer} event.
           */
          function _transfer(
              address from,
              address to,
              uint256 tokenId
          ) internal virtual {
              require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
              require(to != address(0), "ERC721: transfer to the zero address");
      
              _beforeTokenTransfer(from, to, tokenId, 1);
      
              // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
              require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
      
              // Clear approvals from the previous owner
              delete _tokenApprovals[tokenId];
      
              unchecked {
                  // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
                  // `from`'s balance is the number of token held, which is at least one before the current
                  // transfer.
                  // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
                  // all 2**256 token ids to be minted, which in practice is impossible.
                  _balances[from] -= 1;
                  _balances[to] += 1;
              }
              _owners[tokenId] = to;
      
              emit Transfer(from, to, tokenId);
      
              _afterTokenTransfer(from, to, tokenId, 1);
          }
      
          /**
           * @dev Approve `to` to operate on `tokenId`
           *
           * Emits an {Approval} event.
           */
          function _approve(address to, uint256 tokenId) internal virtual {
              _tokenApprovals[tokenId] = to;
              emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
          }
      
          /**
           * @dev Approve `operator` to operate on all of `owner` tokens
           *
           * Emits an {ApprovalForAll} event.
           */
          function _setApprovalForAll(
              address owner,
              address operator,
              bool approved
          ) internal virtual {
              require(owner != operator, "ERC721: approve to caller");
              _operatorApprovals[owner][operator] = approved;
              emit ApprovalForAll(owner, operator, approved);
          }
      
          /**
           * @dev Reverts if the `tokenId` has not been minted yet.
           */
          function _requireMinted(uint256 tokenId) internal view virtual {
              require(_exists(tokenId), "ERC721: invalid token ID");
          }
      
          /**
           * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
           * The call is not executed if the target address is not a contract.
           *
           * @param from address representing the previous owner of the given token ID
           * @param to target address that will receive the tokens
           * @param tokenId uint256 ID of the token to be transferred
           * @param data bytes optional data to send along with the call
           * @return bool whether the call correctly returned the expected magic value
           */
          function _checkOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory data
          ) private returns (bool) {
              if (to.isContract()) {
                  try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                      return retval == IERC721Receiver.onERC721Received.selector;
                  } catch (bytes memory reason) {
                      if (reason.length == 0) {
                          revert("ERC721: transfer to non ERC721Receiver implementer");
                      } else {
                          /// @solidity memory-safe-assembly
                          assembly {
                              revert(add(32, reason), mload(reason))
                          }
                      }
                  }
              } else {
                  return true;
              }
          }
      
          /**
           * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
           * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
           * - When `from` is zero, the tokens will be minted for `to`.
           * - When `to` is zero, ``from``'s tokens will be burned.
           * - `from` and `to` are never both zero.
           * - `batchSize` is non-zero.
           *
           * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
           */
          function _beforeTokenTransfer(
              address from,
              address to,
              uint256, /* firstTokenId */
              uint256 batchSize
          ) internal virtual {
              if (batchSize > 1) {
                  if (from != address(0)) {
                      _balances[from] -= batchSize;
                  }
                  if (to != address(0)) {
                      _balances[to] += batchSize;
                  }
              }
          }
      
          /**
           * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
           * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
           * - When `from` is zero, the tokens were minted for `to`.
           * - When `to` is zero, ``from``'s tokens were burned.
           * - `from` and `to` are never both zero.
           * - `batchSize` is non-zero.
           *
           * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
           */
          function _afterTokenTransfer(
              address from,
              address to,
              uint256 firstTokenId,
              uint256 batchSize
          ) internal virtual {}
      }
      
      
      // File erc721a/contracts/[email protected]
      
      
      // ERC721A Contracts v4.2.3
      // Creator: Chiru Labs
      
      pragma solidity ^0.8.4;
      
      /**
       * @dev Interface of ERC721A.
       */
      interface IERC721A {
          /**
           * The caller must own the token or be an approved operator.
           */
          error ApprovalCallerNotOwnerNorApproved();
      
          /**
           * The token does not exist.
           */
          error ApprovalQueryForNonexistentToken();
      
          /**
           * Cannot query the balance for the zero address.
           */
          error BalanceQueryForZeroAddress();
      
          /**
           * Cannot mint to the zero address.
           */
          error MintToZeroAddress();
      
          /**
           * The quantity of tokens minted must be more than zero.
           */
          error MintZeroQuantity();
      
          /**
           * The token does not exist.
           */
          error OwnerQueryForNonexistentToken();
      
          /**
           * The caller must own the token or be an approved operator.
           */
          error TransferCallerNotOwnerNorApproved();
      
          /**
           * The token must be owned by `from`.
           */
          error TransferFromIncorrectOwner();
      
          /**
           * Cannot safely transfer to a contract that does not implement the
           * ERC721Receiver interface.
           */
          error TransferToNonERC721ReceiverImplementer();
      
          /**
           * Cannot transfer to the zero address.
           */
          error TransferToZeroAddress();
      
          /**
           * The token does not exist.
           */
          error URIQueryForNonexistentToken();
      
          /**
           * The `quantity` minted with ERC2309 exceeds the safety limit.
           */
          error MintERC2309QuantityExceedsLimit();
      
          /**
           * The `extraData` cannot be set on an unintialized ownership slot.
           */
          error OwnershipNotInitializedForExtraData();
      
          // =============================================================
          //                            STRUCTS
          // =============================================================
      
          struct TokenOwnership {
              // The address of the owner.
              address addr;
              // Stores the start time of ownership with minimal overhead for tokenomics.
              uint64 startTimestamp;
              // Whether the token has been burned.
              bool burned;
              // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
              uint24 extraData;
          }
      
          // =============================================================
          //                         TOKEN COUNTERS
          // =============================================================
      
          /**
           * @dev Returns the total number of tokens in existence.
           * Burned tokens will reduce the count.
           * To get the total number of tokens minted, please see {_totalMinted}.
           */
          function totalSupply() external view returns (uint256);
      
          // =============================================================
          //                            IERC165
          // =============================================================
      
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      
          // =============================================================
          //                            IERC721
          // =============================================================
      
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables or disables
           * (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
      
          /**
           * @dev Returns the number of tokens in `owner`'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
      
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`,
           * checking first that contract recipients are aware of the ERC721 protocol
           * to prevent tokens from being forever locked.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be have been allowed to move
           * this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement
           * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes calldata data
          ) external payable;
      
          /**
           * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external payable;
      
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *
           * WARNING: Usage of this method is discouraged, use {safeTransferFrom}
           * whenever possible.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token
           * by either {approve} or {setApprovalForAll}.
           *
           * Emits a {Transfer} event.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external payable;
      
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the
           * zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external payable;
      
          /**
           * @dev Approve or remove `operator` as an operator for the caller.
           * Operators can call {transferFrom} or {safeTransferFrom}
           * for any token owned by the caller.
           *
           * Requirements:
           *
           * - The `operator` cannot be the caller.
           *
           * Emits an {ApprovalForAll} event.
           */
          function setApprovalForAll(address operator, bool _approved) external;
      
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
      
          /**
           * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
           *
           * See {setApprovalForAll}.
           */
          function isApprovedForAll(address owner, address operator) external view returns (bool);
      
          // =============================================================
          //                        IERC721Metadata
          // =============================================================
      
          /**
           * @dev Returns the token collection name.
           */
          function name() external view returns (string memory);
      
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() external view returns (string memory);
      
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) external view returns (string memory);
      
          // =============================================================
          //                           IERC2309
          // =============================================================
      
          /**
           * @dev Emitted when tokens in `fromTokenId` to `toTokenId`
           * (inclusive) is transferred from `from` to `to`, as defined in the
           * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
           *
           * See {_mintERC2309} for more details.
           */
          event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
      }
      
      
      // File erc721a/contracts/[email protected]
      
      
      // ERC721A Contracts v4.2.3
      // Creator: Chiru Labs
      
      pragma solidity ^0.8.4;
      
      /**
       * @dev Interface of ERC721 token receiver.
       */
      interface ERC721A__IERC721Receiver {
          function onERC721Received(
              address operator,
              address from,
              uint256 tokenId,
              bytes calldata data
          ) external returns (bytes4);
      }
      
      /**
       * @title ERC721A
       *
       * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
       * Non-Fungible Token Standard, including the Metadata extension.
       * Optimized for lower gas during batch mints.
       *
       * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
       * starting from `_startTokenId()`.
       *
       * Assumptions:
       *
       * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
       * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
       */
      contract ERC721A is IERC721A {
          // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
          struct TokenApprovalRef {
              address value;
          }
      
          // =============================================================
          //                           CONSTANTS
          // =============================================================
      
          // Mask of an entry in packed address data.
          uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
      
          // The bit position of `numberMinted` in packed address data.
          uint256 private constant _BITPOS_NUMBER_MINTED = 64;
      
          // The bit position of `numberBurned` in packed address data.
          uint256 private constant _BITPOS_NUMBER_BURNED = 128;
      
          // The bit position of `aux` in packed address data.
          uint256 private constant _BITPOS_AUX = 192;
      
          // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
          uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
      
          // The bit position of `startTimestamp` in packed ownership.
          uint256 private constant _BITPOS_START_TIMESTAMP = 160;
      
          // The bit mask of the `burned` bit in packed ownership.
          uint256 private constant _BITMASK_BURNED = 1 << 224;
      
          // The bit position of the `nextInitialized` bit in packed ownership.
          uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
      
          // The bit mask of the `nextInitialized` bit in packed ownership.
          uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
      
          // The bit position of `extraData` in packed ownership.
          uint256 private constant _BITPOS_EXTRA_DATA = 232;
      
          // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
          uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
      
          // The mask of the lower 160 bits for addresses.
          uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
      
          // The maximum `quantity` that can be minted with {_mintERC2309}.
          // This limit is to prevent overflows on the address data entries.
          // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
          // is required to cause an overflow, which is unrealistic.
          uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
      
          // The `Transfer` event signature is given by:
          // `keccak256(bytes("Transfer(address,address,uint256)"))`.
          bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
              0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
      
          // =============================================================
          //                            STORAGE
          // =============================================================
      
          // The next token ID to be minted.
          uint256 private _currentIndex;
      
          // The number of tokens burned.
          uint256 private _burnCounter;
      
          // Token name
          string private _name;
      
          // Token symbol
          string private _symbol;
      
          // Mapping from token ID to ownership details
          // An empty struct value does not necessarily mean the token is unowned.
          // See {_packedOwnershipOf} implementation for details.
          //
          // Bits Layout:
          // - [0..159]   `addr`
          // - [160..223] `startTimestamp`
          // - [224]      `burned`
          // - [225]      `nextInitialized`
          // - [232..255] `extraData`
          mapping(uint256 => uint256) private _packedOwnerships;
      
          // Mapping owner address to address data.
          //
          // Bits Layout:
          // - [0..63]    `balance`
          // - [64..127]  `numberMinted`
          // - [128..191] `numberBurned`
          // - [192..255] `aux`
          mapping(address => uint256) private _packedAddressData;
      
          // Mapping from token ID to approved address.
          mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
      
          // Mapping from owner to operator approvals
          mapping(address => mapping(address => bool)) private _operatorApprovals;
      
          // =============================================================
          //                          CONSTRUCTOR
          // =============================================================
      
          constructor(string memory name_, string memory symbol_) {
              _name = name_;
              _symbol = symbol_;
              _currentIndex = _startTokenId();
          }
      
          // =============================================================
          //                   TOKEN COUNTING OPERATIONS
          // =============================================================
      
          /**
           * @dev Returns the starting token ID.
           * To change the starting token ID, please override this function.
           */
          function _startTokenId() internal view virtual returns (uint256) {
              return 0;
          }
      
          /**
           * @dev Returns the next token ID to be minted.
           */
          function _nextTokenId() internal view virtual returns (uint256) {
              return _currentIndex;
          }
      
          /**
           * @dev Returns the total number of tokens in existence.
           * Burned tokens will reduce the count.
           * To get the total number of tokens minted, please see {_totalMinted}.
           */
          function totalSupply() public view virtual override returns (uint256) {
              // Counter underflow is impossible as _burnCounter cannot be incremented
              // more than `_currentIndex - _startTokenId()` times.
              unchecked {
                  return _currentIndex - _burnCounter - _startTokenId();
              }
          }
      
          /**
           * @dev Returns the total amount of tokens minted in the contract.
           */
          function _totalMinted() internal view virtual returns (uint256) {
              // Counter underflow is impossible as `_currentIndex` does not decrement,
              // and it is initialized to `_startTokenId()`.
              unchecked {
                  return _currentIndex - _startTokenId();
              }
          }
      
          /**
           * @dev Returns the total number of tokens burned.
           */
          function _totalBurned() internal view virtual returns (uint256) {
              return _burnCounter;
          }
      
          // =============================================================
          //                    ADDRESS DATA OPERATIONS
          // =============================================================
      
          /**
           * @dev Returns the number of tokens in `owner`'s account.
           */
          function balanceOf(address owner) public view virtual override returns (uint256) {
              if (owner == address(0)) revert BalanceQueryForZeroAddress();
              return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
          }
      
          /**
           * Returns the number of tokens minted by `owner`.
           */
          function _numberMinted(address owner) internal view returns (uint256) {
              return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
          }
      
          /**
           * Returns the number of tokens burned by or on behalf of `owner`.
           */
          function _numberBurned(address owner) internal view returns (uint256) {
              return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
          }
      
          /**
           * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
           */
          function _getAux(address owner) internal view returns (uint64) {
              return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
          }
      
          /**
           * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
           * If there are multiple variables, please pack them into a uint64.
           */
          function _setAux(address owner, uint64 aux) internal virtual {
              uint256 packed = _packedAddressData[owner];
              uint256 auxCasted;
              // Cast `aux` with assembly to avoid redundant masking.
              assembly {
                  auxCasted := aux
              }
              packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
              _packedAddressData[owner] = packed;
          }
      
          // =============================================================
          //                            IERC165
          // =============================================================
      
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30000 gas.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              // The interface IDs are constants representing the first 4 bytes
              // of the XOR of all function selectors in the interface.
              // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
              // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
              return
                  interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
                  interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
                  interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
          }
      
          // =============================================================
          //                        IERC721Metadata
          // =============================================================
      
          /**
           * @dev Returns the token collection name.
           */
          function name() public view virtual override returns (string memory) {
              return _name;
          }
      
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() public view virtual override returns (string memory) {
              return _symbol;
          }
      
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
              if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
      
              string memory baseURI = _baseURI();
              return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
          }
      
          /**
           * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
           * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
           * by default, it can be overridden in child contracts.
           */
          function _baseURI() internal view virtual returns (string memory) {
              return '';
          }
      
          // =============================================================
          //                     OWNERSHIPS OPERATIONS
          // =============================================================
      
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) public view virtual override returns (address) {
              return address(uint160(_packedOwnershipOf(tokenId)));
          }
      
          /**
           * @dev Gas spent here starts off proportional to the maximum mint batch size.
           * It gradually moves to O(1) as tokens get transferred around over time.
           */
          function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
              return _unpackedOwnership(_packedOwnershipOf(tokenId));
          }
      
          /**
           * @dev Returns the unpacked `TokenOwnership` struct at `index`.
           */
          function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
              return _unpackedOwnership(_packedOwnerships[index]);
          }
      
          /**
           * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
           */
          function _initializeOwnershipAt(uint256 index) internal virtual {
              if (_packedOwnerships[index] == 0) {
                  _packedOwnerships[index] = _packedOwnershipOf(index);
              }
          }
      
          /**
           * Returns the packed ownership data of `tokenId`.
           */
          function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
              uint256 curr = tokenId;
      
              unchecked {
                  if (_startTokenId() <= curr)
                      if (curr < _currentIndex) {
                          uint256 packed = _packedOwnerships[curr];
                          // If not burned.
                          if (packed & _BITMASK_BURNED == 0) {
                              // Invariant:
                              // There will always be an initialized ownership slot
                              // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                              // before an unintialized ownership slot
                              // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                              // Hence, `curr` will not underflow.
                              //
                              // We can directly compare the packed value.
                              // If the address is zero, packed will be zero.
                              while (packed == 0) {
                                  packed = _packedOwnerships[--curr];
                              }
                              return packed;
                          }
                      }
              }
              revert OwnerQueryForNonexistentToken();
          }
      
          /**
           * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
           */
          function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
              ownership.addr = address(uint160(packed));
              ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
              ownership.burned = packed & _BITMASK_BURNED != 0;
              ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
          }
      
          /**
           * @dev Packs ownership data into a single uint256.
           */
          function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
              assembly {
                  // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  owner := and(owner, _BITMASK_ADDRESS)
                  // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
                  result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
              }
          }
      
          /**
           * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
           */
          function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
              // For branchless setting of the `nextInitialized` flag.
              assembly {
                  // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
                  result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
              }
          }
      
          // =============================================================
          //                      APPROVAL OPERATIONS
          // =============================================================
      
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the
           * zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) public payable virtual override {
              address owner = ownerOf(tokenId);
      
              if (_msgSenderERC721A() != owner)
                  if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                      revert ApprovalCallerNotOwnerNorApproved();
                  }
      
              _tokenApprovals[tokenId].value = to;
              emit Approval(owner, to, tokenId);
          }
      
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) public view virtual override returns (address) {
              if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
      
              return _tokenApprovals[tokenId].value;
          }
      
          /**
           * @dev Approve or remove `operator` as an operator for the caller.
           * Operators can call {transferFrom} or {safeTransferFrom}
           * for any token owned by the caller.
           *
           * Requirements:
           *
           * - The `operator` cannot be the caller.
           *
           * Emits an {ApprovalForAll} event.
           */
          function setApprovalForAll(address operator, bool approved) public virtual override {
              _operatorApprovals[_msgSenderERC721A()][operator] = approved;
              emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
          }
      
          /**
           * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
           *
           * See {setApprovalForAll}.
           */
          function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
              return _operatorApprovals[owner][operator];
          }
      
          /**
           * @dev Returns whether `tokenId` exists.
           *
           * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
           *
           * Tokens start existing when they are minted. See {_mint}.
           */
          function _exists(uint256 tokenId) internal view virtual returns (bool) {
              return
                  _startTokenId() <= tokenId &&
                  tokenId < _currentIndex && // If within bounds,
                  _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
          }
      
          /**
           * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
           */
          function _isSenderApprovedOrOwner(
              address approvedAddress,
              address owner,
              address msgSender
          ) private pure returns (bool result) {
              assembly {
                  // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  owner := and(owner, _BITMASK_ADDRESS)
                  // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  msgSender := and(msgSender, _BITMASK_ADDRESS)
                  // `msgSender == owner || msgSender == approvedAddress`.
                  result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
              }
          }
      
          /**
           * @dev Returns the storage slot and value for the approved address of `tokenId`.
           */
          function _getApprovedSlotAndAddress(uint256 tokenId)
              private
              view
              returns (uint256 approvedAddressSlot, address approvedAddress)
          {
              TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
              // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
              assembly {
                  approvedAddressSlot := tokenApproval.slot
                  approvedAddress := sload(approvedAddressSlot)
              }
          }
      
          // =============================================================
          //                      TRANSFER OPERATIONS
          // =============================================================
      
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token
           * by either {approve} or {setApprovalForAll}.
           *
           * Emits a {Transfer} event.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public payable virtual override {
              uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
      
              if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
      
              (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
      
              // The nested ifs save around 20+ gas over a compound boolean condition.
              if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                  if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
      
              if (to == address(0)) revert TransferToZeroAddress();
      
              _beforeTokenTransfers(from, to, tokenId, 1);
      
              // Clear approvals from the previous owner.
              assembly {
                  if approvedAddress {
                      // This is equivalent to `delete _tokenApprovals[tokenId]`.
                      sstore(approvedAddressSlot, 0)
                  }
              }
      
              // Underflow of the sender's balance is impossible because we check for
              // ownership above and the recipient's balance can't realistically overflow.
              // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
              unchecked {
                  // We can directly increment and decrement the balances.
                  --_packedAddressData[from]; // Updates: `balance -= 1`.
                  ++_packedAddressData[to]; // Updates: `balance += 1`.
      
                  // Updates:
                  // - `address` to the next owner.
                  // - `startTimestamp` to the timestamp of transfering.
                  // - `burned` to `false`.
                  // - `nextInitialized` to `true`.
                  _packedOwnerships[tokenId] = _packOwnershipData(
                      to,
                      _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
                  );
      
                  // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
                  if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                      uint256 nextTokenId = tokenId + 1;
                      // If the next slot's address is zero and not burned (i.e. packed value is zero).
                      if (_packedOwnerships[nextTokenId] == 0) {
                          // If the next slot is within bounds.
                          if (nextTokenId != _currentIndex) {
                              // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                              _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                          }
                      }
                  }
              }
      
              emit Transfer(from, to, tokenId);
              _afterTokenTransfers(from, to, tokenId, 1);
          }
      
          /**
           * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public payable virtual override {
              safeTransferFrom(from, to, tokenId, '');
          }
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token
           * by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement
           * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) public payable virtual override {
              transferFrom(from, to, tokenId);
              if (to.code.length != 0)
                  if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                      revert TransferToNonERC721ReceiverImplementer();
                  }
          }
      
          /**
           * @dev Hook that is called before a set of serially-ordered token IDs
           * are about to be transferred. This includes minting.
           * And also called before burning one token.
           *
           * `startTokenId` - the first token ID to be transferred.
           * `quantity` - the amount to be transferred.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
           * transferred to `to`.
           * - When `from` is zero, `tokenId` will be minted for `to`.
           * - When `to` is zero, `tokenId` will be burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _beforeTokenTransfers(
              address from,
              address to,
              uint256 startTokenId,
              uint256 quantity
          ) internal virtual {}
      
          /**
           * @dev Hook that is called after a set of serially-ordered token IDs
           * have been transferred. This includes minting.
           * And also called after one token has been burned.
           *
           * `startTokenId` - the first token ID to be transferred.
           * `quantity` - the amount to be transferred.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
           * transferred to `to`.
           * - When `from` is zero, `tokenId` has been minted for `to`.
           * - When `to` is zero, `tokenId` has been burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _afterTokenTransfers(
              address from,
              address to,
              uint256 startTokenId,
              uint256 quantity
          ) internal virtual {}
      
          /**
           * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
           *
           * `from` - Previous owner of the given token ID.
           * `to` - Target address that will receive the token.
           * `tokenId` - Token ID to be transferred.
           * `_data` - Optional data to send along with the call.
           *
           * Returns whether the call correctly returned the expected magic value.
           */
          function _checkContractOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) private returns (bool) {
              try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
                  bytes4 retval
              ) {
                  return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
              } catch (bytes memory reason) {
                  if (reason.length == 0) {
                      revert TransferToNonERC721ReceiverImplementer();
                  } else {
                      assembly {
                          revert(add(32, reason), mload(reason))
                      }
                  }
              }
          }
      
          // =============================================================
          //                        MINT OPERATIONS
          // =============================================================
      
          /**
           * @dev Mints `quantity` tokens and transfers them to `to`.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `quantity` must be greater than 0.
           *
           * Emits a {Transfer} event for each mint.
           */
          function _mint(address to, uint256 quantity) internal virtual {
              uint256 startTokenId = _currentIndex;
              if (quantity == 0) revert MintZeroQuantity();
      
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
      
              // Overflows are incredibly unrealistic.
              // `balance` and `numberMinted` have a maximum limit of 2**64.
              // `tokenId` has a maximum limit of 2**256.
              unchecked {
                  // Updates:
                  // - `balance += quantity`.
                  // - `numberMinted += quantity`.
                  //
                  // We can directly add to the `balance` and `numberMinted`.
                  _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
      
                  // Updates:
                  // - `address` to the owner.
                  // - `startTimestamp` to the timestamp of minting.
                  // - `burned` to `false`.
                  // - `nextInitialized` to `quantity == 1`.
                  _packedOwnerships[startTokenId] = _packOwnershipData(
                      to,
                      _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
                  );
      
                  uint256 toMasked;
                  uint256 end = startTokenId + quantity;
      
                  // Use assembly to loop and emit the `Transfer` event for gas savings.
                  // The duplicated `log4` removes an extra check and reduces stack juggling.
                  // The assembly, together with the surrounding Solidity code, have been
                  // delicately arranged to nudge the compiler into producing optimized opcodes.
                  assembly {
                      // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                      toMasked := and(to, _BITMASK_ADDRESS)
                      // Emit the `Transfer` event.
                      log4(
                          0, // Start of data (0, since no data).
                          0, // End of data (0, since no data).
                          _TRANSFER_EVENT_SIGNATURE, // Signature.
                          0, // `address(0)`.
                          toMasked, // `to`.
                          startTokenId // `tokenId`.
                      )
      
                      // The `iszero(eq(,))` check ensures that large values of `quantity`
                      // that overflows uint256 will make the loop run out of gas.
                      // The compiler will optimize the `iszero` away for performance.
                      for {
                          let tokenId := add(startTokenId, 1)
                      } iszero(eq(tokenId, end)) {
                          tokenId := add(tokenId, 1)
                      } {
                          // Emit the `Transfer` event. Similar to above.
                          log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                      }
                  }
                  if (toMasked == 0) revert MintToZeroAddress();
      
                  _currentIndex = end;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
      
          /**
           * @dev Mints `quantity` tokens and transfers them to `to`.
           *
           * This function is intended for efficient minting only during contract creation.
           *
           * It emits only one {ConsecutiveTransfer} as defined in
           * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
           * instead of a sequence of {Transfer} event(s).
           *
           * Calling this function outside of contract creation WILL make your contract
           * non-compliant with the ERC721 standard.
           * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
           * {ConsecutiveTransfer} event is only permissible during contract creation.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `quantity` must be greater than 0.
           *
           * Emits a {ConsecutiveTransfer} event.
           */
          function _mintERC2309(address to, uint256 quantity) internal virtual {
              uint256 startTokenId = _currentIndex;
              if (to == address(0)) revert MintToZeroAddress();
              if (quantity == 0) revert MintZeroQuantity();
              if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
      
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
      
              // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
              unchecked {
                  // Updates:
                  // - `balance += quantity`.
                  // - `numberMinted += quantity`.
                  //
                  // We can directly add to the `balance` and `numberMinted`.
                  _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
      
                  // Updates:
                  // - `address` to the owner.
                  // - `startTimestamp` to the timestamp of minting.
                  // - `burned` to `false`.
                  // - `nextInitialized` to `quantity == 1`.
                  _packedOwnerships[startTokenId] = _packOwnershipData(
                      to,
                      _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
                  );
      
                  emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
      
                  _currentIndex = startTokenId + quantity;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
      
          /**
           * @dev Safely mints `quantity` tokens and transfers them to `to`.
           *
           * Requirements:
           *
           * - If `to` refers to a smart contract, it must implement
           * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
           * - `quantity` must be greater than 0.
           *
           * See {_mint}.
           *
           * Emits a {Transfer} event for each mint.
           */
          function _safeMint(
              address to,
              uint256 quantity,
              bytes memory _data
          ) internal virtual {
              _mint(to, quantity);
      
              unchecked {
                  if (to.code.length != 0) {
                      uint256 end = _currentIndex;
                      uint256 index = end - quantity;
                      do {
                          if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                              revert TransferToNonERC721ReceiverImplementer();
                          }
                      } while (index < end);
                      // Reentrancy protection.
                      if (_currentIndex != end) revert();
                  }
              }
          }
      
          /**
           * @dev Equivalent to `_safeMint(to, quantity, '')`.
           */
          function _safeMint(address to, uint256 quantity) internal virtual {
              _safeMint(to, quantity, '');
          }
      
          // =============================================================
          //                        BURN OPERATIONS
          // =============================================================
      
          /**
           * @dev Equivalent to `_burn(tokenId, false)`.
           */
          function _burn(uint256 tokenId) internal virtual {
              _burn(tokenId, false);
          }
      
          /**
           * @dev Destroys `tokenId`.
           * The approval is cleared when the token is burned.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           *
           * Emits a {Transfer} event.
           */
          function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
              uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
      
              address from = address(uint160(prevOwnershipPacked));
      
              (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
      
              if (approvalCheck) {
                  // The nested ifs save around 20+ gas over a compound boolean condition.
                  if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                      if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
              }
      
              _beforeTokenTransfers(from, address(0), tokenId, 1);
      
              // Clear approvals from the previous owner.
              assembly {
                  if approvedAddress {
                      // This is equivalent to `delete _tokenApprovals[tokenId]`.
                      sstore(approvedAddressSlot, 0)
                  }
              }
      
              // Underflow of the sender's balance is impossible because we check for
              // ownership above and the recipient's balance can't realistically overflow.
              // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
              unchecked {
                  // Updates:
                  // - `balance -= 1`.
                  // - `numberBurned += 1`.
                  //
                  // We can directly decrement the balance, and increment the number burned.
                  // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
                  _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
      
                  // Updates:
                  // - `address` to the last owner.
                  // - `startTimestamp` to the timestamp of burning.
                  // - `burned` to `true`.
                  // - `nextInitialized` to `true`.
                  _packedOwnerships[tokenId] = _packOwnershipData(
                      from,
                      (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
                  );
      
                  // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
                  if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                      uint256 nextTokenId = tokenId + 1;
                      // If the next slot's address is zero and not burned (i.e. packed value is zero).
                      if (_packedOwnerships[nextTokenId] == 0) {
                          // If the next slot is within bounds.
                          if (nextTokenId != _currentIndex) {
                              // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                              _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                          }
                      }
                  }
              }
      
              emit Transfer(from, address(0), tokenId);
              _afterTokenTransfers(from, address(0), tokenId, 1);
      
              // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
              unchecked {
                  _burnCounter++;
              }
          }
      
          // =============================================================
          //                     EXTRA DATA OPERATIONS
          // =============================================================
      
          /**
           * @dev Directly sets the extra data for the ownership data `index`.
           */
          function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
              uint256 packed = _packedOwnerships[index];
              if (packed == 0) revert OwnershipNotInitializedForExtraData();
              uint256 extraDataCasted;
              // Cast `extraData` with assembly to avoid redundant masking.
              assembly {
                  extraDataCasted := extraData
              }
              packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
              _packedOwnerships[index] = packed;
          }
      
          /**
           * @dev Called during each token transfer to set the 24bit `extraData` field.
           * Intended to be overridden by the cosumer contract.
           *
           * `previousExtraData` - the value of `extraData` before transfer.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
           * transferred to `to`.
           * - When `from` is zero, `tokenId` will be minted for `to`.
           * - When `to` is zero, `tokenId` will be burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _extraData(
              address from,
              address to,
              uint24 previousExtraData
          ) internal view virtual returns (uint24) {}
      
          /**
           * @dev Returns the next extra data for the packed ownership data.
           * The returned result is shifted into position.
           */
          function _nextExtraData(
              address from,
              address to,
              uint256 prevOwnershipPacked
          ) private view returns (uint256) {
              uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
              return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
          }
      
          // =============================================================
          //                       OTHER OPERATIONS
          // =============================================================
      
          /**
           * @dev Returns the message sender (defaults to `msg.sender`).
           *
           * If you are writing GSN compatible contracts, you need to override this function.
           */
          function _msgSenderERC721A() internal view virtual returns (address) {
              return msg.sender;
          }
      
          /**
           * @dev Converts a uint256 to its ASCII string decimal representation.
           */
          function _toString(uint256 value) internal pure virtual returns (string memory str) {
              assembly {
                  // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
                  // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
                  // We will need 1 word for the trailing zeros padding, 1 word for the length,
                  // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
                  let m := add(mload(0x40), 0xa0)
                  // Update the free memory pointer to allocate.
                  mstore(0x40, m)
                  // Assign the `str` to the end.
                  str := sub(m, 0x20)
                  // Zeroize the slot after the string.
                  mstore(str, 0)
      
                  // Cache the end of the memory to calculate the length later.
                  let end := str
      
                  // We write the string from rightmost digit to leftmost digit.
                  // The following is essentially a do-while loop that also handles the zero case.
                  // prettier-ignore
                  for { let temp := value } 1 {} {
                      str := sub(str, 1)
                      // Write the character to the pointer.
                      // The ASCII index of the '0' character is 48.
                      mstore8(str, add(48, mod(temp, 10)))
                      // Keep dividing `temp` until zero.
                      temp := div(temp, 10)
                      // prettier-ignore
                      if iszero(temp) { break }
                  }
      
                  let length := sub(end, str)
                  // Move the pointer 32 bytes leftwards to make room for the length.
                  str := sub(str, 0x20)
                  // Store the length.
                  mstore(str, length)
              }
          }
      }
      
      
      // File contracts/SSRWives.sol
      
      
      
      pragma solidity ^0.8.17;
      
      
      
      contract SSRWives is ERC721A, Ownable {
          uint256 public mintPrice = 0.07 ether;
          uint256 public friendMintPrice = 0.06 ether;
          bool public saleIsActive = false;
          bool public friendMintIsActive = false;
      
          uint256 public maxPerAddressDuringMint = 10;
          string private _baseTokenURI;
          uint256 public maxSupply = 3210;
      
          uint256 public amountClaimed = 0;
          uint256 public amountFreeMint = 250;
      
          uint256 public amountFriendClaimed = 0;
          uint256 public amountFriendMint = 250;
      
          mapping(address => bool) public mintedFree;
      
          address kyokoWallet = 0x3893E707eF23AD48C89d4af55d289a61f42A2535;
          address artWallet = 0xf7fb1039790311032c153cC65dbfD2A9FB0d84E5;
          address devWallet = 0xaA642262bdf212D7a111c16D7a9691F9cC1dDe37;
      
          constructor() ERC721A("SSR Wives", "SSRWIVES") {}
      
          function mintReserveTokens(uint256 numberOfTokens) public onlyOwner {
              _safeMint(msg.sender, numberOfTokens);
              require(totalSupply() <= maxSupply, "Limit reached");
          }
      
          function flipSaleState() public onlyOwner {
              saleIsActive = !saleIsActive;
          }
      
          function flipFreeMintState() public onlyOwner {
              friendMintIsActive = !friendMintIsActive;
          }
      
          function setMintPrice(uint256 newPrice) public onlyOwner {
              mintPrice = newPrice;
          }
      
          function setAmountFreeMint(uint256 newAmount) public onlyOwner {
              amountFreeMint = newAmount;
          }
      
          function setMaxSupply(uint256 newAmount) public onlyOwner {
              maxSupply = newAmount;
          }
      
          function _baseURI() internal view virtual override returns (string memory) {
              return _baseTokenURI;
          }
      
          function setBaseURI(string calldata baseURI) external onlyOwner {
              _baseTokenURI = baseURI;
          }
      
          function mint(uint256 quantity) external payable {
              require(saleIsActive, "Sale must be active to mint");
              require(
                  quantity <= maxPerAddressDuringMint,
                  "You can't mint that many at once"
              );
      
              require(
                  mintPrice * quantity <= msg.value,
                  "Ether value sent is not correct"
              );
      
              _mint(msg.sender, quantity);
              require(totalSupply() <= maxSupply, "Limit reached");
          }
      
          function friendMint(uint256 quantity) external payable {
              require(saleIsActive, "Sale must be active to mint");
              require(
                  amountFriendClaimed < amountFriendMint,
                  "No more free mints available"
              );
              require(
                  isAFriend(msg.sender),
                  "This wallet doesn't hold any friend NFTs"
              );
      
              amountFriendClaimed += 1;
      
              require(
                  friendMintPrice * quantity <= msg.value,
                  "Ether value sent is not correct"
              );
      
              _mint(msg.sender, quantity);
              require(totalSupply() <= maxSupply, "Limit reached");
          }
      
          function friendFreeMint() external payable {
              require(friendMintIsActive, "Sale must be active to mint");
      
              require(
                  amountClaimed < amountFreeMint,
                  "No more discounted mints available"
              );
      
              require(
                  isAFriend(msg.sender),
                  "This wallet doesn't hold any friend NFTs"
              );
              require(
                  mintedFree[msg.sender] == false,
                  "You can only mint 1 for free"
              );
      
              amountClaimed += 1;
              mintedFree[msg.sender] = true;
              _mint(msg.sender, 1);
      
              require(totalSupply() <= maxSupply, "Limit reached");
          }
      
          function isAFriend(address addr) public view returns (bool) {
              address milady = 0x5Af0D9827E0c53E4799BB226655A1de152A425a5;
              address pfpplus = 0x181cde16170fac94c27584492cc9842e2Cb3BD54;
              address remilio = 0xD3D9ddd0CF0A5F0BFB8f7fcEAe075DF687eAEBaB;
              address pixelady = 0x8Fc0D90f2C45a5e7f94904075c952e0943CFCCfd;
              address radbro = 0xABCDB5710B88f456fED1e99025379e2969F29610;
              address schizo = 0xBfE47D6D4090940D1c7a0066B63d23875E3e2Ac5;
              address mifairy = 0x67B5eE6e29a4230177Dda07AD7848e42d89cF9a0;
      
              return
                  ERC721(milady).balanceOf(addr) > 0 ||
                  ERC721(pfpplus).balanceOf(addr) > 0 ||
                  ERC721(remilio).balanceOf(addr) > 0 ||
                  ERC721(pixelady).balanceOf(addr) > 0 ||
                  ERC721(radbro).balanceOf(addr) > 0 ||
                  ERC721(milady).balanceOf(addr) > 0 ||
                  ERC721(schizo).balanceOf(addr) > 0 ||
                  ERC721(mifairy).balanceOf(addr) > 0;
          }
      
          function withdrawMoney() external onlyOwner {
              (bool success, ) = owner().call{value: address(this).balance}("");
              require(success, "Transfer failed.");
          }
      
          function withdrawAll() public payable onlyOwner {
              uint256 third = address(this).balance / 3;
      
              require(payable(devWallet).send(third));
              require(payable(kyokoWallet).send(third));
              require(payable(artWallet).send(third));
          }
      }

      File 4 of 10: Archetype
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
      pragma solidity ^0.8.0;
      import "../utils/introspection/IERC165Upgradeable.sol";
      /**
       * @dev Interface for the NFT Royalty Standard.
       *
       * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
       * support for royalty payments across all NFT marketplaces and ecosystem participants.
       *
       * _Available since v4.5._
       */
      interface IERC2981Upgradeable is IERC165Upgradeable {
          /**
           * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
           * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
           */
          function royaltyInfo(uint256 tokenId, uint256 salePrice)
              external
              view
              returns (address receiver, uint256 royaltyAmount);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)
      pragma solidity ^0.8.2;
      import "../../utils/AddressUpgradeable.sol";
      /**
       * @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]
       * ```
       * 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 Indicates that the contract has been initialized.
           * @custom:oz-retyped-from bool
           */
          uint8 private _initialized;
          /**
           * @dev Indicates that the contract is in the process of being initialized.
           */
          bool private _initializing;
          /**
           * @dev Triggered when the contract has been initialized or reinitialized.
           */
          event Initialized(uint8 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 functions marked with `initializer` can be nested in the context of a
           * constructor.
           *
           * Emits an {Initialized} event.
           */
          modifier initializer() {
              bool isTopLevelCall = !_initializing;
              require(
                  (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
                  "Initializable: contract is already initialized"
              );
              _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 255 will prevent any future reinitialization.
           *
           * Emits an {Initialized} event.
           */
          modifier reinitializer(uint8 version) {
              require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
              _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() {
              require(_initializing, "Initializable: contract is not initializing");
              _;
          }
          /**
           * @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 {
              require(!_initializing, "Initializable: contract is initializing");
              if (_initialized < type(uint8).max) {
                  _initialized = type(uint8).max;
                  emit Initialized(type(uint8).max);
              }
          }
          /**
           * @dev Internal function that returns the initialized version. Returns `_initialized`
           */
          function _getInitializedVersion() internal view returns (uint8) {
              return _initialized;
          }
          /**
           * @dev Internal function that returns the initialized version. Returns `_initializing`
           */
          function _isInitializing() internal view returns (bool) {
              return _initializing;
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)
      pragma solidity ^0.8.0;
      import "../../interfaces/IERC2981Upgradeable.sol";
      import "../../utils/introspection/ERC165Upgradeable.sol";
      import "../../proxy/utils/Initializable.sol";
      /**
       * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
       *
       * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
       * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
       *
       * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
       * fee is specified in basis points by default.
       *
       * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
       * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
       * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
       *
       * _Available since v4.5._
       */
      abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {
          function __ERC2981_init() internal onlyInitializing {
          }
          function __ERC2981_init_unchained() internal onlyInitializing {
          }
          struct RoyaltyInfo {
              address receiver;
              uint96 royaltyFraction;
          }
          RoyaltyInfo private _defaultRoyaltyInfo;
          mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {
              return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);
          }
          /**
           * @inheritdoc IERC2981Upgradeable
           */
          function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
              RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
              if (royalty.receiver == address(0)) {
                  royalty = _defaultRoyaltyInfo;
              }
              uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
              return (royalty.receiver, royaltyAmount);
          }
          /**
           * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
           * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
           * override.
           */
          function _feeDenominator() internal pure virtual returns (uint96) {
              return 10000;
          }
          /**
           * @dev Sets the royalty information that all ids in this contract will default to.
           *
           * Requirements:
           *
           * - `receiver` cannot be the zero address.
           * - `feeNumerator` cannot be greater than the fee denominator.
           */
          function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
              require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
              require(receiver != address(0), "ERC2981: invalid receiver");
              _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
          }
          /**
           * @dev Removes default royalty information.
           */
          function _deleteDefaultRoyalty() internal virtual {
              delete _defaultRoyaltyInfo;
          }
          /**
           * @dev Sets the royalty information for a specific token id, overriding the global default.
           *
           * Requirements:
           *
           * - `receiver` cannot be the zero address.
           * - `feeNumerator` cannot be greater than the fee denominator.
           */
          function _setTokenRoyalty(
              uint256 tokenId,
              address receiver,
              uint96 feeNumerator
          ) internal virtual {
              require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
              require(receiver != address(0), "ERC2981: Invalid parameters");
              _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
          }
          /**
           * @dev Resets royalty information for the token id back to the global default.
           */
          function _resetTokenRoyalty(uint256 tokenId) internal virtual {
              delete _tokenRoyaltyInfo[tokenId];
          }
          /**
           * @dev This empty reserved space is put in place to allow future versions to add new
           * variables without shifting down storage in the inheritance chain.
           * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
           */
          uint256[48] private __gap;
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Interface of the ERC20 standard as defined in the EIP.
       */
      interface IERC20Upgradeable {
          /**
           * @dev Emitted when `value` tokens are moved from one account (`from`) to
           * another (`to`).
           *
           * Note that `value` may be zero.
           */
          event Transfer(address indexed from, address indexed to, uint256 value);
          /**
           * @dev Emitted when the allowance of a `spender` for an `owner` is set by
           * a call to {approve}. `value` is the new allowance.
           */
          event Approval(address indexed owner, address indexed spender, uint256 value);
          /**
           * @dev Returns the amount of tokens in existence.
           */
          function totalSupply() external view returns (uint256);
          /**
           * @dev Returns the amount of tokens owned by `account`.
           */
          function balanceOf(address account) external view returns (uint256);
          /**
           * @dev Moves `amount` tokens from the caller's account to `to`.
           *
           * Returns a boolean value indicating whether the operation succeeded.
           *
           * Emits a {Transfer} event.
           */
          function transfer(address to, uint256 amount) external returns (bool);
          /**
           * @dev Returns the remaining number of tokens that `spender` will be
           * allowed to spend on behalf of `owner` through {transferFrom}. This is
           * zero by default.
           *
           * This value changes when {approve} or {transferFrom} are called.
           */
          function allowance(address owner, address spender) external view returns (uint256);
          /**
           * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
           *
           * Returns a boolean value indicating whether the operation succeeded.
           *
           * IMPORTANT: Beware that changing an allowance with this method brings the risk
           * that someone may use both the old and the new allowance by unfortunate
           * transaction ordering. One possible solution to mitigate this race
           * condition is to first reduce the spender's allowance to 0 and set the
           * desired value afterwards:
           * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
           *
           * Emits an {Approval} event.
           */
          function approve(address spender, uint256 amount) external returns (bool);
          /**
           * @dev Moves `amount` tokens from `from` to `to` using the
           * allowance mechanism. `amount` is then deducted from the caller's
           * allowance.
           *
           * Returns a boolean value indicating whether the operation succeeded.
           *
           * Emits a {Transfer} event.
           */
          function transferFrom(
              address from,
              address to,
              uint256 amount
          ) external returns (bool);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
      pragma solidity ^0.8.1;
      /**
       * @dev Collection of functions related to the address type
       */
      library AddressUpgradeable {
          /**
           * @dev Returns true if `account` is a contract.
           *
           * [IMPORTANT]
           * ====
           * It is unsafe to assume that an address for which this function returns
           * false is an externally-owned account (EOA) and not a contract.
           *
           * Among others, `isContract` will return false for the following
           * types of addresses:
           *
           *  - an externally-owned account
           *  - a contract in construction
           *  - an address where a contract will be created
           *  - an address where a contract lived, but was destroyed
           * ====
           *
           * [IMPORTANT]
           * ====
           * You shouldn't rely on `isContract` to protect against flash loan attacks!
           *
           * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
           * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
           * constructor.
           * ====
           */
          function isContract(address account) internal view returns (bool) {
              // This method relies on extcodesize/address.code.length, which returns 0
              // for contracts in construction, since the code is only stored at the end
              // of the constructor execution.
              return account.code.length > 0;
          }
          /**
           * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
           * `recipient`, forwarding all available gas and reverting on errors.
           *
           * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
           * of certain opcodes, possibly making contracts go over the 2300 gas limit
           * imposed by `transfer`, making them unable to receive funds via
           * `transfer`. {sendValue} removes this limitation.
           *
           * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
           *
           * IMPORTANT: because control is transferred to `recipient`, care must be
           * taken to not create reentrancy vulnerabilities. Consider using
           * {ReentrancyGuard} or the
           * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
           */
          function sendValue(address payable recipient, uint256 amount) internal {
              require(address(this).balance >= amount, "Address: insufficient balance");
              (bool success, ) = recipient.call{value: amount}("");
              require(success, "Address: unable to send value, recipient may have reverted");
          }
          /**
           * @dev Performs a Solidity function call using a low level `call`. A
           * plain `call` is an unsafe replacement for a function call: use this
           * function instead.
           *
           * If `target` reverts with a revert reason, it is bubbled up by this
           * function (like regular Solidity function calls).
           *
           * Returns the raw returned data. To convert to the expected return value,
           * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
           *
           * Requirements:
           *
           * - `target` must be a contract.
           * - calling `target` with `data` must not revert.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, "Address: low-level call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
           * `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but also transferring `value` wei to `target`.
           *
           * Requirements:
           *
           * - the calling contract must have an ETH balance of at least `value`.
           * - the called Solidity function must be `payable`.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
          }
          /**
           * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
           * with `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(address(this).balance >= value, "Address: insufficient balance for call");
              (bool success, bytes memory returndata) = target.call{value: value}(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
              return functionStaticCall(target, data, "Address: low-level static call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              (bool success, bytes memory returndata) = target.staticcall(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
          /**
           * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
           * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
           *
           * _Available since v4.8._
           */
          function verifyCallResultFromTarget(
              address target,
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              if (success) {
                  if (returndata.length == 0) {
                      // only check isContract if the call was successful and the return data is empty
                      // otherwise we already know that it was a contract
                      require(isContract(target), "Address: call to non-contract");
                  }
                  return returndata;
              } else {
                  _revert(returndata, errorMessage);
              }
          }
          /**
           * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
           * revert reason or using the provided one.
           *
           * _Available since v4.3._
           */
          function verifyCallResult(
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal pure returns (bytes memory) {
              if (success) {
                  return returndata;
              } else {
                  _revert(returndata, errorMessage);
              }
          }
          function _revert(bytes memory returndata, string memory errorMessage) private pure {
              // Look for revert reason and bubble it up if present
              if (returndata.length > 0) {
                  // The easiest way to bubble the revert reason is using memory via assembly
                  /// @solidity memory-safe-assembly
                  assembly {
                      let returndata_size := mload(returndata)
                      revert(add(32, returndata), returndata_size)
                  }
              } else {
                  revert(errorMessage);
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
      pragma solidity ^0.8.0;
      import "./IERC165Upgradeable.sol";
      import "../../proxy/utils/Initializable.sol";
      /**
       * @dev Implementation of the {IERC165} interface.
       *
       * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
       * for the additional interface id that will be supported. For example:
       *
       * ```solidity
       * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
       *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
       * }
       * ```
       *
       * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
       */
      abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
          function __ERC165_init() internal onlyInitializing {
          }
          function __ERC165_init_unchained() internal onlyInitializing {
          }
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              return interfaceId == type(IERC165Upgradeable).interfaceId;
          }
          /**
           * @dev This empty reserved space is put in place to allow future versions to add new
           * variables without shifting down storage in the inheritance chain.
           * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
           */
          uint256[50] private __gap;
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165Upgradeable {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      // SPDX-License-Identifier: MIT
      pragma solidity ^0.8.4;
      /// @notice Optimized and flexible operator filterer to abide to OpenSea's
      /// mandatory on-chain royalty enforcement in order for new collections to
      /// receive royalties.
      /// For more information, see:
      /// See: https://github.com/ProjectOpenSea/operator-filter-registry
      abstract contract OperatorFilterer {
          /// @dev The default OpenSea operator blocklist subscription.
          address internal constant _DEFAULT_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
          /// @dev The OpenSea operator filter registry.
          address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
          /// @dev Registers the current contract to OpenSea's operator filter,
          /// and subscribe to the default OpenSea operator blocklist.
          /// Note: Will not revert nor update existing settings for repeated registration.
          function _registerForOperatorFiltering() internal virtual {
              _registerForOperatorFiltering(_DEFAULT_SUBSCRIPTION, true);
          }
          /// @dev Registers the current contract to OpenSea's operator filter.
          /// Note: Will not revert nor update existing settings for repeated registration.
          function _registerForOperatorFiltering(address subscriptionOrRegistrantToCopy, bool subscribe)
              internal
              virtual
          {
              /// @solidity memory-safe-assembly
              assembly {
                  let functionSelector := 0x7d3e3dbe // `registerAndSubscribe(address,address)`.
                  // Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty.
                  subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
                  for {} iszero(subscribe) {} {
                      if iszero(subscriptionOrRegistrantToCopy) {
                          functionSelector := 0x4420e486 // `register(address)`.
                          break
                      }
                      functionSelector := 0xa0af2903 // `registerAndCopyEntries(address,address)`.
                      break
                  }
                  // Store the function selector.
                  mstore(0x00, shl(224, functionSelector))
                  // Store the `address(this)`.
                  mstore(0x04, address())
                  // Store the `subscriptionOrRegistrantToCopy`.
                  mstore(0x24, subscriptionOrRegistrantToCopy)
                  // Register into the registry.
                  if iszero(call(gas(), _OPERATOR_FILTER_REGISTRY, 0, 0x00, 0x44, 0x00, 0x04)) {
                      // If the function selector has not been overwritten,
                      // it is an out-of-gas error.
                      if eq(shr(224, mload(0x00)), functionSelector) {
                          // To prevent gas under-estimation.
                          revert(0, 0)
                      }
                  }
                  // Restore the part of the free memory pointer that was overwritten,
                  // which is guaranteed to be zero, because of Solidity's memory size limits.
                  mstore(0x24, 0)
              }
          }
          /// @dev Modifier to guard a function and revert if the caller is a blocked operator.
          modifier onlyAllowedOperator(address from) virtual {
              if (from != msg.sender) {
                  if (!_isPriorityOperator(msg.sender)) {
                      if (_operatorFilteringEnabled()) _revertIfBlocked(msg.sender);
                  }
              }
              _;
          }
          /// @dev Modifier to guard a function from approving a blocked operator..
          modifier onlyAllowedOperatorApproval(address operator) virtual {
              if (!_isPriorityOperator(operator)) {
                  if (_operatorFilteringEnabled()) _revertIfBlocked(operator);
              }
              _;
          }
          /// @dev Helper function that reverts if the `operator` is blocked by the registry.
          function _revertIfBlocked(address operator) private view {
              /// @solidity memory-safe-assembly
              assembly {
                  // Store the function selector of `isOperatorAllowed(address,address)`,
                  // shifted left by 6 bytes, which is enough for 8tb of memory.
                  // We waste 6-3 = 3 bytes to save on 6 runtime gas (PUSH1 0x224 SHL).
                  mstore(0x00, 0xc6171134001122334455)
                  // Store the `address(this)`.
                  mstore(0x1a, address())
                  // Store the `operator`.
                  mstore(0x3a, operator)
                  // `isOperatorAllowed` always returns true if it does not revert.
                  if iszero(staticcall(gas(), _OPERATOR_FILTER_REGISTRY, 0x16, 0x44, 0x00, 0x00)) {
                      // Bubble up the revert if the staticcall reverts.
                      returndatacopy(0x00, 0x00, returndatasize())
                      revert(0x00, returndatasize())
                  }
                  // We'll skip checking if `from` is inside the blacklist.
                  // Even though that can block transferring out of wrapper contracts,
                  // we don't want tokens to be stuck.
                  // Restore the part of the free memory pointer that was overwritten,
                  // which is guaranteed to be zero, if less than 8tb of memory is used.
                  mstore(0x3a, 0)
              }
          }
          /// @dev For deriving contracts to override, so that operator filtering
          /// can be turned on / off.
          /// Returns true by default.
          function _operatorFilteringEnabled() internal view virtual returns (bool) {
              return true;
          }
          /// @dev For deriving contracts to override, so that preferred marketplaces can
          /// skip operator filtering, helping users save gas.
          /// Returns false for all inputs by default.
          function _isPriorityOperator(address) internal view virtual returns (bool) {
              return false;
          }
      }
      // SPDX-License-Identifier: MIT
      // Archetype v0.5.1
      //
      //        d8888                 888               888
      //       d88888                 888               888
      //      d88P888                 888               888
      //     d88P 888 888d888 .d8888b 88888b.   .d88b.  888888 888  888 88888b.   .d88b.
      //    d88P  888 888P"  d88P"    888 "88b d8P  Y8b 888    888  888 888 "88b d8P  Y8b
      //   d88P   888 888    888      888  888 88888888 888    888  888 888  888 88888888
      //  d8888888888 888    Y88b.    888  888 Y8b.     Y88b.  Y88b 888 888 d88P Y8b.
      // d88P     888 888     "Y8888P 888  888  "Y8888   "Y888  "Y88888 88888P"   "Y8888
      //                                                            888 888
      //                                                       Y8b d88P 888
      //                                                        "Y88P"  888
      pragma solidity ^0.8.4;
      import "./ArchetypeLogic.sol";
      import "erc721a-upgradeable/contracts/ERC721AUpgradeable.sol";
      import "erc721a-upgradeable/contracts/ERC721A__Initializable.sol";
      import "./ERC721A__OwnableUpgradeable.sol";
      import "solady/src/utils/LibString.sol";
      import "closedsea/src/OperatorFilterer.sol";
      import "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
      contract Archetype is
        ERC721A__Initializable,
        ERC721AUpgradeable,
        OperatorFilterer,
        ERC721A__OwnableUpgradeable,
        ERC2981Upgradeable
      {
        //
        // EVENTS
        //
        event Invited(bytes32 indexed key, bytes32 indexed cid);
        event Referral(address indexed affiliate, address token, uint128 wad, uint256 numMints);
        event Withdrawal(address indexed src, address token, uint128 wad);
        //
        // VARIABLES
        //
        mapping(bytes32 => DutchInvite) public invites;
        mapping(address => mapping(bytes32 => uint256)) private _minted;
        mapping(bytes32 => uint256) private _listSupply;
        mapping(address => OwnerBalance) private _ownerBalance;
        mapping(address => mapping(address => uint128)) private _affiliateBalance;
        mapping(uint256 => bytes) private _tokenMsg;
        Config public config;
        BurnConfig public burnConfig;
        Options public options;
        string public provenance;
        //
        // METHODS
        //
        function initialize(
          string memory name,
          string memory symbol,
          Config calldata config_,
          address _receiver
        ) external initializerERC721A {
          __ERC721A_init(name, symbol);
          // check max bps not reached and min platform fee.
          if (
            config_.affiliateFee > MAXBPS ||
            config_.platformFee > MAXBPS ||
            config_.platformFee < 500 ||
            config_.discounts.affiliateDiscount > MAXBPS ||
            config_.affiliateSigner == address(0) ||
            config_.maxBatchSize == 0
          ) {
            revert InvalidConfig();
          }
          // ensure mint tiers are correctly ordered from highest to lowest.
          for (uint256 i = 1; i < config_.discounts.mintTiers.length; i++) {
            if (
              config_.discounts.mintTiers[i].mintDiscount > MAXBPS ||
              config_.discounts.mintTiers[i].numMints > config_.discounts.mintTiers[i - 1].numMints
            ) {
              revert InvalidConfig();
            }
          }
          config = config_;
          __Ownable_init();
          if (config.ownerAltPayout != address(0)) {
            setDefaultRoyalty(config.ownerAltPayout, config.defaultRoyalty);
          } else {
            setDefaultRoyalty(_receiver, config.defaultRoyalty);
          }
        }
        //
        // PUBLIC
        //
        function mint(
          Auth calldata auth,
          uint256 quantity,
          address affiliate,
          bytes calldata signature
        ) external payable {
          mintTo(auth, quantity, msg.sender, affiliate, signature);
        }
        function batchMintTo(
          Auth calldata auth,
          address[] calldata toList,
          uint256[] calldata quantityList,
          address affiliate,
          bytes calldata signature
        ) external payable {
          if (quantityList.length != toList.length) {
            revert InvalidConfig();
          }
          DutchInvite storage invite = invites[auth.key];
          uint256 quantity = 0;
          {
            uint32 unitSize = invite.unitSize;
            for (uint256 i = 0; i < quantityList.length; i++) {
              if (unitSize > 1) {
                quantity += quantityList[i] * unitSize;
              } else {
                quantity += quantityList[i];
              }
            }
          }
          uint256 curSupply = _totalMinted();
          ArchetypeLogic.validateMint(
            invite,
            config,
            auth,
            quantity,
            owner(),
            affiliate,
            curSupply,
            _minted,
            _listSupply,
            signature
          );
          {
            uint32 unitSize = invite.unitSize;
            for (uint256 i = 0; i < toList.length; i++) {
              if (unitSize > 1) {
                _mint(toList[i], quantityList[i] * unitSize);
              } else {
                _mint(toList[i], quantityList[i]);
              }
            }
          }
          if (invite.limit < invite.maxSupply) {
            _minted[msg.sender][auth.key] += quantity;
          }
          if (invite.maxSupply < config.maxSupply) {
            _listSupply[auth.key] += quantity;
          }
          ArchetypeLogic.updateBalances(
            invite,
            config,
            _ownerBalance,
            _affiliateBalance,
            affiliate,
            quantity
          );
        }
        function mintTo(
          Auth calldata auth,
          uint256 quantity,
          address to,
          address affiliate,
          bytes calldata signature
        ) public payable {
          DutchInvite storage i = invites[auth.key];
          if (i.unitSize > 1) {
            quantity = quantity * i.unitSize;
          }
          uint256 curSupply = _totalMinted();
          ArchetypeLogic.validateMint(
            i,
            config,
            auth,
            quantity,
            owner(),
            affiliate,
            curSupply,
            _minted,
            _listSupply,
            signature
          );
          _mint(to, quantity);
          if (i.limit < i.maxSupply) {
            _minted[msg.sender][auth.key] += quantity;
          }
          if (i.maxSupply < config.maxSupply) {
            _listSupply[auth.key] += quantity;
          }
          ArchetypeLogic.updateBalances(i, config, _ownerBalance, _affiliateBalance, affiliate, quantity);
        }
        function burnToMint(uint256[] calldata tokenIds) external {
          uint256 curSupply = _totalMinted();
          ArchetypeLogic.validateBurnToMint(config, burnConfig, tokenIds, curSupply, _minted);
          for (uint256 i = 0; i < tokenIds.length; i++) {
            burnConfig.archetype.transferFrom(
              msg.sender,
              address(0x000000000000000000000000000000000000dEaD),
              tokenIds[i]
            );
          }
          uint256 quantity = burnConfig.reversed
            ? tokenIds.length * burnConfig.ratio
            : tokenIds.length / burnConfig.ratio;
          _mint(msg.sender, quantity);
          if (burnConfig.limit < config.maxSupply) {
            _minted[msg.sender][bytes32("burn")] += quantity;
          }
        }
        function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
          if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
          return
            bytes(config.baseUri).length != 0
              ? string(abi.encodePacked(config.baseUri, LibString.toString(tokenId)))
              : "";
        }
        function withdraw() external {
          address[] memory tokens = new address[](1);
          tokens[0] = address(0);
          withdrawTokens(tokens);
        }
        function withdrawTokens(address[] memory tokens) public {
          ArchetypeLogic.withdrawTokens(config, _ownerBalance, _affiliateBalance, owner(), tokens);
        }
        function setTokenMsg(uint256 tokenId, string calldata message) external {
          if (msg.sender != ownerOf(tokenId)) {
            revert NotTokenOwner();
          }
          _tokenMsg[tokenId] = bytes(message);
        }
        function getTokenMsg(uint256 tokenId) external view returns (string memory) {
          if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
          return string(_tokenMsg[tokenId]);
        }
        function ownerBalance() external view returns (OwnerBalance memory) {
          return _ownerBalance[address(0)];
        }
        function ownerBalanceToken(address token) external view returns (OwnerBalance memory) {
          return _ownerBalance[token];
        }
        function affiliateBalance(address affiliate) external view returns (uint128) {
          return _affiliateBalance[affiliate][address(0)];
        }
        function affiliateBalanceToken(address affiliate, address token) external view returns (uint128) {
          return _affiliateBalance[affiliate][token];
        }
        function minted(address minter, bytes32 key) external view returns (uint256) {
          return _minted[minter][key];
        }
        function listSupply(bytes32 key) external view returns (uint256) {
          return _listSupply[key];
        }
        function platform() external pure returns (address) {
          return PLATFORM;
        }
        //
        // OWNER ONLY
        //
        function setBaseURI(string memory baseUri) external onlyOwner {
          if (options.uriLocked) {
            revert LockedForever();
          }
          config.baseUri = baseUri;
        }
        /// @notice the password is "forever"
        function lockURI(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.uriLocked = true;
        }
        /// @notice the password is "forever"
        // max supply cannot subceed total supply. Be careful changing.
        function setMaxSupply(uint32 maxSupply, string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          if (options.maxSupplyLocked) {
            revert LockedForever();
          }
          if (maxSupply < _totalMinted()) {
            revert MaxSupplyExceeded();
          }
          config.maxSupply = maxSupply;
        }
        /// @notice the password is "forever"
        function lockMaxSupply(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.maxSupplyLocked = true;
        }
        function setAffiliateFee(uint16 affiliateFee) external onlyOwner {
          if (options.affiliateFeeLocked) {
            revert LockedForever();
          }
          if (affiliateFee > MAXBPS) {
            revert InvalidConfig();
          }
          config.affiliateFee = affiliateFee;
        }
        /// @notice the password is "forever"
        function lockAffiliateFee(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.affiliateFeeLocked = true;
        }
        function setDiscounts(Discount calldata discounts) external onlyOwner {
          if (options.discountsLocked) {
            revert LockedForever();
          }
          if (discounts.affiliateDiscount > MAXBPS) {
            revert InvalidConfig();
          }
          // ensure mint tiers are correctly ordered from highest to lowest.
          for (uint256 i = 1; i < discounts.mintTiers.length; i++) {
            if (
              discounts.mintTiers[i].mintDiscount > MAXBPS ||
              discounts.mintTiers[i].numMints > discounts.mintTiers[i - 1].numMints
            ) {
              revert InvalidConfig();
            }
          }
          config.discounts = discounts;
        }
        /// @notice the password is "forever"
        function lockDiscounts(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.discountsLocked = true;
        }
        /// @notice Set BAYC-style provenance once it's calculated
        function setProvenanceHash(string memory provenanceHash) external onlyOwner {
          if (options.provenanceHashLocked) {
            revert LockedForever();
          }
          provenance = provenanceHash;
        }
        /// @notice the password is "forever"
        function lockProvenanceHash(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.provenanceHashLocked = true;
        }
        function setOwnerAltPayout(address ownerAltPayout) external onlyOwner {
          if (options.ownerAltPayoutLocked) {
            revert LockedForever();
          }
          config.ownerAltPayout = ownerAltPayout;
        }
        /// @notice the password is "forever"
        function lockOwnerAltPayout(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.ownerAltPayoutLocked = true;
        }
        function setMaxBatchSize(uint32 maxBatchSize) external onlyOwner {
          config.maxBatchSize = maxBatchSize;
        }
        function setInvite(
          bytes32 _key,
          bytes32 _cid,
          Invite calldata _invite
        ) external onlyOwner {
          invites[_key] = DutchInvite({
            price: _invite.price,
            reservePrice: _invite.price,
            delta: 0,
            start: _invite.start,
            end: _invite.end,
            limit: _invite.limit,
            maxSupply: _invite.maxSupply,
            interval: 0,
            unitSize: _invite.unitSize,
            tokenAddress: _invite.tokenAddress
          });
          emit Invited(_key, _cid);
        }
        function setDutchInvite(
          bytes32 _key,
          bytes32 _cid,
          DutchInvite memory _dutchInvite
        ) external onlyOwner {
          if (_dutchInvite.start < block.timestamp) {
            _dutchInvite.start = uint32(block.timestamp);
          }
          invites[_key] = _dutchInvite;
          emit Invited(_key, _cid);
        }
        function enableBurnToMint(
          address archetype,
          bool reversed,
          uint16 ratio,
          uint64 start,
          uint64 limit
        ) external onlyOwner {
          burnConfig = BurnConfig({
            archetype: IERC721AUpgradeable(archetype),
            enabled: true,
            reversed: reversed,
            ratio: ratio,
            start: start,
            limit: limit
          });
        }
        function disableBurnToMint() external onlyOwner {
          burnConfig = BurnConfig({
            enabled: false,
            reversed: false,
            ratio: 0,
            archetype: IERC721AUpgradeable(address(0)),
            start: 0,
            limit: 0
          });
        }
        //
        // PLATFORM ONLY
        //
        function setSuperAffiliatePayout(address superAffiliatePayout) external onlyPlatform {
          config.superAffiliatePayout = superAffiliatePayout;
        }
        //
        // INTERNAL
        //
        function _startTokenId() internal view virtual override returns (uint256) {
          return 1;
        }
        modifier onlyPlatform() {
          if (msg.sender != PLATFORM) {
            revert NotPlatform();
          }
          _;
        }
        // OPTIONAL ROYALTY ENFORCEMENT WITH OPENSEA
        function enableRoyaltyEnforcement() external onlyOwner {
          if (options.royaltyEnforcementLocked) {
            revert LockedForever();
          }
          _registerForOperatorFiltering();
          options.royaltyEnforcementEnabled = true;
        }
        function disableRoyaltyEnforcement() external onlyOwner {
          if (options.royaltyEnforcementLocked) {
            revert LockedForever();
          }
          options.royaltyEnforcementEnabled = false;
        }
        /// @notice the password is "forever"
        function lockRoyaltyEnforcement(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.royaltyEnforcementLocked = true;
        }
        function setApprovalForAll(address operator, bool approved)
          public
          override
          onlyAllowedOperatorApproval(operator)
        {
          super.setApprovalForAll(operator, approved);
        }
        function approve(address operator, uint256 tokenId)
          public
          payable
          override
          onlyAllowedOperatorApproval(operator)
        {
          super.approve(operator, tokenId);
        }
        function transferFrom(
          address from,
          address to,
          uint256 tokenId
        ) public payable override onlyAllowedOperator(from) {
          super.transferFrom(from, to, tokenId);
        }
        function safeTransferFrom(
          address from,
          address to,
          uint256 tokenId
        ) public payable override onlyAllowedOperator(from) {
          super.safeTransferFrom(from, to, tokenId);
        }
        function safeTransferFrom(
          address from,
          address to,
          uint256 tokenId,
          bytes memory data
        ) public payable override onlyAllowedOperator(from) {
          super.safeTransferFrom(from, to, tokenId, data);
        }
        function _operatorFilteringEnabled() internal view override returns (bool) {
          return options.royaltyEnforcementEnabled;
        }
        //ERC2981 ROYALTY
        function supportsInterface(bytes4 interfaceId)
          public
          view
          virtual
          override(ERC721AUpgradeable, ERC2981Upgradeable)
          returns (bool)
        {
          // Supports the following `interfaceId`s:
          // - IERC165: 0x01ffc9a7
          // - IERC721: 0x80ac58cd
          // - IERC721Metadata: 0x5b5e139f
          // - IERC2981: 0x2a55205a
          return
            ERC721AUpgradeable.supportsInterface(interfaceId) ||
            ERC2981Upgradeable.supportsInterface(interfaceId);
        }
        function setDefaultRoyalty(address receiver, uint16 feeNumerator) public onlyOwner {
          config.defaultRoyalty = feeNumerator;
          _setDefaultRoyalty(receiver, feeNumerator);
        }
      }
      // SPDX-License-Identifier: MIT
      // ArchetypeLogic v0.5.1
      //
      //        d8888                 888               888
      //       d88888                 888               888
      //      d88P888                 888               888
      //     d88P 888 888d888 .d8888b 88888b.   .d88b.  888888 888  888 88888b.   .d88b.
      //    d88P  888 888P"  d88P"    888 "88b d8P  Y8b 888    888  888 888 "88b d8P  Y8b
      //   d88P   888 888    888      888  888 88888888 888    888  888 888  888 88888888
      //  d8888888888 888    Y88b.    888  888 Y8b.     Y88b.  Y88b 888 888 d88P Y8b.
      // d88P     888 888     "Y8888P 888  888  "Y8888   "Y888  "Y88888 88888P"   "Y8888
      //                                                            888 888
      //                                                       Y8b d88P 888
      //                                                        "Y88P"  888
      pragma solidity ^0.8.4;
      import "erc721a-upgradeable/contracts/ERC721AUpgradeable.sol";
      import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
      import "solady/src/utils/MerkleProofLib.sol";
      import "solady/src/utils/ECDSA.sol";
      error InvalidConfig();
      error MintNotYetStarted();
      error MintEnded();
      error WalletUnauthorizedToMint();
      error InsufficientEthSent();
      error ExcessiveEthSent();
      error Erc20BalanceTooLow();
      error MaxSupplyExceeded();
      error ListMaxSupplyExceeded();
      error NumberOfMintsExceeded();
      error MintingPaused();
      error InvalidReferral();
      error InvalidSignature();
      error BalanceEmpty();
      error TransferFailed();
      error MaxBatchSizeExceeded();
      error BurnToMintDisabled();
      error NotTokenOwner();
      error NotPlatform();
      error NotApprovedToTransfer();
      error InvalidAmountOfTokens();
      error WrongPassword();
      error LockedForever();
      //
      // STRUCTS
      //
      struct Auth {
        bytes32 key;
        bytes32[] proof;
      }
      struct MintTier {
        uint16 numMints;
        uint16 mintDiscount; //BPS
      }
      struct Discount {
        uint16 affiliateDiscount; //BPS
        MintTier[] mintTiers;
      }
      struct Config {
        string baseUri;
        address affiliateSigner;
        address ownerAltPayout; // optional alternative address for owner withdrawals.
        address superAffiliatePayout; // optional super affiliate address, will receive half of platform fee if set.
        uint32 maxSupply;
        uint32 maxBatchSize;
        uint16 affiliateFee; //BPS
        uint16 platformFee; //BPS
        uint16 defaultRoyalty; //BPS
        Discount discounts;
      }
      struct Options {
        bool uriLocked;
        bool maxSupplyLocked;
        bool affiliateFeeLocked;
        bool discountsLocked;
        bool ownerAltPayoutLocked;
        bool royaltyEnforcementEnabled;
        bool royaltyEnforcementLocked;
        bool provenanceHashLocked;
      }
      struct DutchInvite {
        uint128 price;
        uint128 reservePrice;
        uint128 delta;
        uint32 start;
        uint32 end;
        uint32 limit;
        uint32 maxSupply;
        uint32 interval;
        uint32 unitSize; // mint 1 get x
        address tokenAddress;
      }
      struct Invite {
        uint128 price;
        uint32 start;
        uint32 end;
        uint32 limit;
        uint32 maxSupply;
        uint32 unitSize; // mint 1 get x
        address tokenAddress;
      }
      struct OwnerBalance {
        uint128 owner;
        uint128 platform;
      }
      struct BurnConfig {
        IERC721AUpgradeable archetype;
        bool enabled;
        bool reversed; // side of the ratio (false=burn {ratio} get 1, true=burn 1 get {ratio})
        uint16 ratio;
        uint64 start;
        uint64 limit;
      }
      // address constant PLATFORM = 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC; // TEST (account[2])
      address constant PLATFORM = 0x86B82972282Dd22348374bC63fd21620F7ED847B;
      uint16 constant MAXBPS = 5000; // max fee or discount is 50%
      library ArchetypeLogic {
        //
        // EVENTS
        //
        event Invited(bytes32 indexed key, bytes32 indexed cid);
        event Referral(address indexed affiliate, address token, uint128 wad, uint256 numMints);
        event Withdrawal(address indexed src, address token, uint128 wad);
        // calculate price based on affiliate usage and mint discounts
        function computePrice(
          DutchInvite storage invite,
          Discount storage discounts,
          uint256 numTokens,
          bool affiliateUsed
        ) public view returns (uint256) {
          uint256 price = invite.price;
          if (invite.interval != 0) {
            uint256 diff = (((block.timestamp - invite.start) / invite.interval) * invite.delta);
            if (price > invite.reservePrice) {
              if (diff > price - invite.reservePrice) {
                price = invite.reservePrice;
              } else {
                price = price - diff;
              }
            } else if (price < invite.reservePrice) {
              if (diff > invite.reservePrice - price) {
                price = invite.reservePrice;
              } else {
                price = price + diff;
              }
            }
          }
          uint256 cost = price * numTokens;
          if (affiliateUsed) {
            cost = cost - ((cost * discounts.affiliateDiscount) / 10000);
          }
          for (uint256 i = 0; i < discounts.mintTiers.length; i++) {
            if (numTokens >= discounts.mintTiers[i].numMints) {
              return cost = cost - ((cost * discounts.mintTiers[i].mintDiscount) / 10000);
            }
          }
          return cost;
        }
        function validateMint(
          DutchInvite storage i,
          Config storage config,
          Auth calldata auth,
          uint256 quantity,
          address owner,
          address affiliate,
          uint256 curSupply,
          mapping(address => mapping(bytes32 => uint256)) storage minted,
          mapping(bytes32 => uint256) storage listSupply,
          bytes calldata signature
        ) public view {
          if (affiliate != address(0)) {
            if (affiliate == PLATFORM || affiliate == owner || affiliate == msg.sender) {
              revert InvalidReferral();
            }
            validateAffiliate(affiliate, signature, config.affiliateSigner);
          }
          if (i.limit == 0) {
            revert MintingPaused();
          }
          if (!verify(auth, i.tokenAddress, msg.sender)) {
            revert WalletUnauthorizedToMint();
          }
          if (block.timestamp < i.start) {
            revert MintNotYetStarted();
          }
          if (i.end > i.start && block.timestamp > i.end) {
            revert MintEnded();
          }
          if (i.limit < i.maxSupply) {
            uint256 totalAfterMint = minted[msg.sender][auth.key] + quantity;
            if (totalAfterMint > i.limit) {
              revert NumberOfMintsExceeded();
            }
          }
          if (i.maxSupply < config.maxSupply) {
            uint256 totalAfterMint = listSupply[auth.key] + quantity;
            if (totalAfterMint > i.maxSupply) {
              revert ListMaxSupplyExceeded();
            }
          }
          if (quantity > config.maxBatchSize) {
            revert MaxBatchSizeExceeded();
          }
          if ((curSupply + quantity) > config.maxSupply) {
            revert MaxSupplyExceeded();
          }
          uint256 cost = computePrice(i, config.discounts, quantity, affiliate != address(0));
          if (i.tokenAddress != address(0)) {
            IERC20Upgradeable erc20Token = IERC20Upgradeable(i.tokenAddress);
            if (erc20Token.allowance(msg.sender, address(this)) < cost) {
              revert NotApprovedToTransfer();
            }
            if (erc20Token.balanceOf(msg.sender) < cost) {
              revert Erc20BalanceTooLow();
            }
            if (msg.value != 0) {
              revert ExcessiveEthSent();
            }
          } else {
            if (msg.value < cost) {
              revert InsufficientEthSent();
            }
            if (msg.value > cost) {
              revert ExcessiveEthSent();
            }
          }
        }
        function validateBurnToMint(
          Config storage config,
          BurnConfig storage burnConfig,
          uint256[] calldata tokenIds,
          uint256 curSupply,
          mapping(address => mapping(bytes32 => uint256)) storage minted
        ) public view {
          if (!burnConfig.enabled) {
            revert BurnToMintDisabled();
          }
          if (block.timestamp < burnConfig.start) {
            revert MintNotYetStarted();
          }
          // check if msg.sender owns tokens and has correct approvals
          for (uint256 i = 0; i < tokenIds.length; i++) {
            if (burnConfig.archetype.ownerOf(tokenIds[i]) != msg.sender) {
              revert NotTokenOwner();
            }
          }
          if (!burnConfig.archetype.isApprovedForAll(msg.sender, address(this))) {
            revert NotApprovedToTransfer();
          }
          uint256 quantity;
          if (burnConfig.reversed) {
            quantity = tokenIds.length * burnConfig.ratio;
          } else {
            if (tokenIds.length % burnConfig.ratio != 0) {
              revert InvalidAmountOfTokens();
            }
            quantity = tokenIds.length / burnConfig.ratio;
          }
          if (quantity > config.maxBatchSize) {
            revert MaxBatchSizeExceeded();
          }
          if (burnConfig.limit < config.maxSupply) {
            uint256 totalAfterMint = minted[msg.sender][bytes32("burn")] + quantity;
            if (totalAfterMint > burnConfig.limit) {
              revert NumberOfMintsExceeded();
            }
          }
          if ((curSupply + quantity) > config.maxSupply) {
            revert MaxSupplyExceeded();
          }
        }
        function updateBalances(
          DutchInvite storage i,
          Config storage config,
          mapping(address => OwnerBalance) storage _ownerBalance,
          mapping(address => mapping(address => uint128)) storage _affiliateBalance,
          address affiliate,
          uint256 quantity
        ) public {
          address tokenAddress = i.tokenAddress;
          uint128 value = uint128(msg.value);
          if (tokenAddress != address(0)) {
            value = uint128(computePrice(i, config.discounts, quantity, affiliate != address(0)));
          }
          uint128 affiliateWad = 0;
          if (affiliate != address(0)) {
            affiliateWad = (value * config.affiliateFee) / 10000;
            _affiliateBalance[affiliate][tokenAddress] += affiliateWad;
            emit Referral(affiliate, tokenAddress, affiliateWad, quantity);
          }
          uint128 superAffiliateWad = 0;
          if (config.superAffiliatePayout != address(0)) {
            superAffiliateWad = ((value * config.platformFee) / 2) / 10000;
            _affiliateBalance[config.superAffiliatePayout][tokenAddress] += superAffiliateWad;
          }
          OwnerBalance memory balance = _ownerBalance[tokenAddress];
          uint128 platformWad = ((value * config.platformFee) / 10000) - superAffiliateWad;
          uint128 ownerWad = value - affiliateWad - platformWad - superAffiliateWad;
          _ownerBalance[tokenAddress] = OwnerBalance({
            owner: balance.owner + ownerWad,
            platform: balance.platform + platformWad
          });
          if (tokenAddress != address(0)) {
            IERC20Upgradeable erc20Token = IERC20Upgradeable(tokenAddress);
            erc20Token.transferFrom(msg.sender, address(this), value);
          }
        }
        function withdrawTokens(
          Config storage config,
          mapping(address => OwnerBalance) storage _ownerBalance,
          mapping(address => mapping(address => uint128)) storage _affiliateBalance,
          address owner,
          address[] calldata tokens
        ) public {
          for (uint256 i = 0; i < tokens.length; i++) {
            address tokenAddress = tokens[i];
            uint128 wad = 0;
            if (msg.sender == owner || msg.sender == config.ownerAltPayout || msg.sender == PLATFORM) {
              OwnerBalance storage balance = _ownerBalance[tokenAddress];
              if (msg.sender == owner || msg.sender == config.ownerAltPayout) {
                wad = balance.owner;
                balance.owner = 0;
              } else {
                wad = balance.platform;
                balance.platform = 0;
              }
            } else {
              wad = _affiliateBalance[msg.sender][tokenAddress];
              _affiliateBalance[msg.sender][tokenAddress] = 0;
            }
            if (wad == 0) {
              revert BalanceEmpty();
            }
            if (tokenAddress == address(0)) {
              bool success = false;
              // send to ownerAltPayout if set and owner is withdrawing
              if (msg.sender == owner && config.ownerAltPayout != address(0)) {
                (success, ) = payable(config.ownerAltPayout).call{ value: wad }("");
              } else {
                (success, ) = msg.sender.call{ value: wad }("");
              }
              if (!success) {
                revert TransferFailed();
              }
            } else {
              IERC20Upgradeable erc20Token = IERC20Upgradeable(tokenAddress);
              if (msg.sender == owner && config.ownerAltPayout != address(0)) {
                erc20Token.transfer(config.ownerAltPayout, wad);
              } else {
                erc20Token.transfer(msg.sender, wad);
              }
            }
            emit Withdrawal(msg.sender, tokenAddress, wad);
          }
        }
        function validateAffiliate(
          address affiliate,
          bytes calldata signature,
          address affiliateSigner
        ) public view {
          bytes32 signedMessagehash = ECDSA.toEthSignedMessageHash(
            keccak256(abi.encodePacked(affiliate))
          );
          address signer = ECDSA.recover(signedMessagehash, signature);
          if (signer != affiliateSigner) {
            revert InvalidSignature();
          }
        }
        function verify(
          Auth calldata auth,
          address tokenAddress,
          address account
        ) public pure returns (bool) {
          // keys 0-255 and tokenAddress are public
          if (uint256(auth.key) <= 0xff || auth.key == keccak256(abi.encodePacked(tokenAddress))) {
            return true;
          }
          return MerkleProofLib.verify(auth.proof, auth.key, keccak256(abi.encodePacked(account)));
        }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
      import 'erc721a-upgradeable/contracts/ERC721A__Initializable.sol';
      import 'erc721a-upgradeable/contracts/ERC721AUpgradeable.sol';
      pragma solidity ^0.8.4;
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract ERC721A__OwnableUpgradeable is ERC721A__Initializable, ERC721AUpgradeable {
          address private _owner;
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          function __Ownable_init() internal onlyInitializingERC721A {
              __Ownable_init_unchained();
          }
          function __Ownable_init_unchained() internal onlyInitializingERC721A {
              _transferOwnership(_msgSenderERC721A());
          }
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              _isOwner();
              _;
          }
          function _isOwner() internal view {
              require(owner() == _msgSenderERC721A(), "Ownable: caller is not the owner");
          }
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              _transferOwnership(address(0));
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              _transferOwnership(newOwner);
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Internal function without access restriction.
           */
          function _transferOwnership(address newOwner) internal virtual {
              address oldOwner = _owner;
              _owner = newOwner;
              emit OwnershipTransferred(oldOwner, newOwner);
          }
          /**
           * @dev This empty reserved space is put in place to allow future versions to add new
           * variables without shifting down storage in the inheritance chain.
           * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
           */
          uint256[49] private __gap;
      }
      // 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;
          }
      }
      // 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
              }
          }
      }
      // 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;
          }
          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
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v4.2.3
      // 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()`.
       *
       * 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();
          }
          // =============================================================
          //                   TOKEN COUNTING OPERATIONS
          // =============================================================
          /**
           * @dev Returns the starting token ID.
           * To change the starting token ID, please override this function.
           */
          function _startTokenId() internal view virtual returns (uint256) {
              return 0;
          }
          /**
           * @dev Returns the next token ID to be minted.
           */
          function _nextTokenId() internal view virtual returns (uint256) {
              return 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) {
              // Counter underflow is impossible as _burnCounter cannot be incremented
              // more than `_currentIndex - _startTokenId()` times.
              unchecked {
                  return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId();
              }
          }
          /**
           * @dev Returns the total amount of tokens minted in the contract.
           */
          function _totalMinted() internal view virtual returns (uint256) {
              // Counter underflow is impossible as `_currentIndex` does not decrement,
              // and it is initialized to `_startTokenId()`.
              unchecked {
                  return ERC721AStorage.layout()._currentIndex - _startTokenId();
              }
          }
          /**
           * @dev Returns the total number of tokens burned.
           */
          function _totalBurned() internal view virtual returns (uint256) {
              return ERC721AStorage.layout()._burnCounter;
          }
          // =============================================================
          //                    ADDRESS DATA OPERATIONS
          // =============================================================
          /**
           * @dev Returns the number of tokens in `owner`'s account.
           */
          function balanceOf(address owner) public view virtual override returns (uint256) {
              if (owner == address(0)) revert BalanceQueryForZeroAddress();
              return 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();
              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 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);
              }
          }
          /**
           * 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 not burned.
                  if (packed & _BITMASK_BURNED == 0) {
                      // If the data at the starting slot does not exist, start the scan.
                      if (packed == 0) {
                          if (tokenId >= ERC721AStorage.layout()._currentIndex) revert OwnerQueryForNonexistentToken();
                          // 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;
                              return packed;
                          }
                      }
                      // Otherwise, the data exists and is not burned. 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.
                      return packed;
                  }
              }
              revert OwnerQueryForNonexistentToken();
          }
          /**
           * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
           */
          function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
              ownership.addr = address(uint160(packed));
              ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
              ownership.burned = packed & _BITMASK_BURNED != 0;
              ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
          }
          /**
           * @dev Packs ownership data into a single uint256.
           */
          function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
              assembly {
                  // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  owner := and(owner, _BITMASK_ADDRESS)
                  // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
                  result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
              }
          }
          /**
           * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
           */
          function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
              // For branchless setting of the `nextInitialized` flag.
              assembly {
                  // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
                  result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
              }
          }
          // =============================================================
          //                      APPROVAL OPERATIONS
          // =============================================================
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account. 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();
              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) {
              return
                  _startTokenId() <= tokenId &&
                  tokenId < ERC721AStorage.layout()._currentIndex && // If within bounds,
                  ERC721AStorage.layout()._packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
          }
          /**
           * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
           */
          function _isSenderApprovedOrOwner(
              address approvedAddress,
              address owner,
              address msgSender
          ) private pure returns (bool result) {
              assembly {
                  // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  owner := and(owner, _BITMASK_ADDRESS)
                  // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  msgSender := and(msgSender, _BITMASK_ADDRESS)
                  // `msgSender == owner || msgSender == approvedAddress`.
                  result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
              }
          }
          /**
           * @dev Returns the storage slot and value for the approved address of `tokenId`.
           */
          function _getApprovedSlotAndAddress(uint256 tokenId)
              private
              view
              returns (uint256 approvedAddressSlot, address approvedAddress)
          {
              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);
              if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
              (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
              // The nested ifs save around 20+ gas over a compound boolean condition.
              if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                  if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
              if (to == address(0)) revert TransferToZeroAddress();
              _beforeTokenTransfers(from, to, tokenId, 1);
              // Clear approvals from the previous owner.
              assembly {
                  if approvedAddress {
                      // This is equivalent to `delete _tokenApprovals[tokenId]`.
                      sstore(approvedAddressSlot, 0)
                  }
              }
              // Underflow of the sender's balance is impossible because we check for
              // ownership above and the recipient's balance can't realistically overflow.
              // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
              unchecked {
                  // We can directly increment and decrement the balances.
                  --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;
                          }
                      }
                  }
              }
              emit Transfer(from, to, tokenId);
              _afterTokenTransfers(from, to, tokenId, 1);
          }
          /**
           * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public payable virtual override {
              safeTransferFrom(from, to, tokenId, '');
          }
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token
           * by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement
           * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) public payable virtual override {
              transferFrom(from, to, tokenId);
              if (to.code.length != 0)
                  if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                      revert TransferToNonERC721ReceiverImplementer();
                  }
          }
          /**
           * @dev Hook that is called before a set of serially-ordered token IDs
           * are about to be transferred. This includes minting.
           * And also called before burning one token.
           *
           * `startTokenId` - the first token ID to be transferred.
           * `quantity` - the amount to be transferred.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
           * transferred to `to`.
           * - When `from` is zero, `tokenId` will be minted for `to`.
           * - When `to` is zero, `tokenId` will be burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _beforeTokenTransfers(
              address from,
              address to,
              uint256 startTokenId,
              uint256 quantity
          ) internal virtual {}
          /**
           * @dev Hook that is called after a set of serially-ordered token IDs
           * have been transferred. This includes minting.
           * And also called after one token has been burned.
           *
           * `startTokenId` - the first token ID to be transferred.
           * `quantity` - the amount to be transferred.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
           * transferred to `to`.
           * - When `from` is zero, `tokenId` has been minted for `to`.
           * - When `to` is zero, `tokenId` has been burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _afterTokenTransfers(
              address from,
              address to,
              uint256 startTokenId,
              uint256 quantity
          ) internal virtual {}
          /**
           * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
           *
           * `from` - Previous owner of the given token ID.
           * `to` - Target address that will receive the token.
           * `tokenId` - Token ID to be transferred.
           * `_data` - Optional data to send along with the call.
           *
           * Returns whether the call correctly returned the expected magic value.
           */
          function _checkContractOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) private returns (bool) {
              try
                  ERC721A__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();
                  } else {
                      assembly {
                          revert(add(32, reason), mload(reason))
                      }
                  }
              }
          }
          // =============================================================
          //                        MINT OPERATIONS
          // =============================================================
          /**
           * @dev Mints `quantity` tokens and transfers them to `to`.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `quantity` must be greater than 0.
           *
           * Emits a {Transfer} event for each mint.
           */
          function _mint(address to, uint256 quantity) internal virtual {
              uint256 startTokenId = ERC721AStorage.layout()._currentIndex;
              if (quantity == 0) revert MintZeroQuantity();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are incredibly unrealistic.
              // `balance` and `numberMinted` have a maximum limit of 2**64.
              // `tokenId` has a maximum limit of 2**256.
              unchecked {
                  // Updates:
                  // - `balance += quantity`.
                  // - `numberMinted += quantity`.
                  //
                  // We can directly add to the `balance` and `numberMinted`.
                  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)
                  );
                  uint256 toMasked;
                  uint256 end = startTokenId + quantity;
                  // Use assembly to loop and emit the `Transfer` event for gas savings.
                  // The duplicated `log4` removes an extra check and reduces stack juggling.
                  // The assembly, together with the surrounding Solidity code, have been
                  // delicately arranged to nudge the compiler into producing optimized opcodes.
                  assembly {
                      // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                      toMasked := and(to, _BITMASK_ADDRESS)
                      // Emit the `Transfer` event.
                      log4(
                          0, // Start of data (0, since no data).
                          0, // End of data (0, since no data).
                          _TRANSFER_EVENT_SIGNATURE, // Signature.
                          0, // `address(0)`.
                          toMasked, // `to`.
                          startTokenId // `tokenId`.
                      )
                      // The `iszero(eq(,))` check ensures that large values of `quantity`
                      // that overflows uint256 will make the loop run out of gas.
                      // The compiler will optimize the `iszero` away for performance.
                      for {
                          let tokenId := add(startTokenId, 1)
                      } iszero(eq(tokenId, end)) {
                          tokenId := add(tokenId, 1)
                      } {
                          // Emit the `Transfer` event. Similar to above.
                          log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                      }
                  }
                  if (toMasked == 0) revert MintToZeroAddress();
                  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();
              if (quantity == 0) revert MintZeroQuantity();
              if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
              unchecked {
                  // Updates:
                  // - `balance += quantity`.
                  // - `numberMinted += quantity`.
                  //
                  // We can directly add to the `balance` and `numberMinted`.
                  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)
                  );
                  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();
                          }
                      } while (index < end);
                      // Reentrancy protection.
                      if (ERC721AStorage.layout()._currentIndex != end) revert();
                  }
              }
          }
          /**
           * @dev Equivalent to `_safeMint(to, quantity, '')`.
           */
          function _safeMint(address to, uint256 quantity) internal virtual {
              _safeMint(to, quantity, '');
          }
          // =============================================================
          //                       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)
                  if (_msgSenderERC721A() != owner)
                      if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                          revert ApprovalCallerNotOwnerNorApproved();
                      }
              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();
              }
              _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 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();
              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)
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v4.2.3
      // 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();
          // =============================================================
          //                            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);
      }
      // SPDX-License-Identifier: MIT
      pragma solidity ^0.8.4;
      /// @notice Gas optimized ECDSA wrapper.
      /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ECDSA.sol)
      /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ECDSA.sol)
      /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol)
      library ECDSA {
          function recover(bytes32 hash, bytes calldata signature) internal view returns (address result) {
              assembly {
                  if eq(signature.length, 65) {
                      // Copy the free memory pointer so that we can restore it later.
                      let m := mload(0x40)
                      // Directly copy `r` and `s` from the calldata.
                      calldatacopy(0x40, signature.offset, 0x40)
                      // If `s` in lower half order, such that the signature is not malleable.
                      // prettier-ignore
                      if iszero(gt(mload(0x60), 0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0)) {
                          mstore(0x00, hash)
                          // Compute `v` and store it in the scratch space.
                          mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40))))
                          pop(
                              staticcall(
                                  gas(), // Amount of gas left for the transaction.
                                  0x01, // Address of `ecrecover`.
                                  0x00, // Start of input.
                                  0x80, // Size of input.
                                  0x40, // Start of output.
                                  0x20 // Size of output.
                              )
                          )
                          // Restore the zero slot.
                          mstore(0x60, 0)
                          // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
                          result := mload(sub(0x60, returndatasize()))
                      }
                      // Restore the free memory pointer.
                      mstore(0x40, m)
                  }
              }
          }
          function recover(
              bytes32 hash,
              bytes32 r,
              bytes32 vs
          ) internal view returns (address result) {
              assembly {
                  // Copy the free memory pointer so that we can restore it later.
                  let m := mload(0x40)
                  // prettier-ignore
                  let s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
                  // If `s` in lower half order, such that the signature is not malleable.
                  // prettier-ignore
                  if iszero(gt(s, 0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0)) {
                      mstore(0x00, hash)
                      mstore(0x20, add(shr(255, vs), 27))
                      mstore(0x40, r)
                      mstore(0x60, s)
                      pop(
                          staticcall(
                              gas(), // Amount of gas left for the transaction.
                              0x01, // Address of `ecrecover`.
                              0x00, // Start of input.
                              0x80, // Size of input.
                              0x40, // Start of output.
                              0x20 // Size of output.
                          )
                      )
                      // Restore the zero slot.
                      mstore(0x60, 0)
                      // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
                      result := mload(sub(0x60, returndatasize()))
                  }
                  // Restore the free memory pointer.
                  mstore(0x40, m)
              }
          }
          function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) {
              assembly {
                  // Store into scratch space for keccak256.
                  mstore(0x20, hash)
                  mstore(0x00, "\\x00\\x00\\x00\\x00\\x19Ethereum Signed Message:\
      32")
                  // 0x40 - 0x04 = 0x3c
                  result := keccak256(0x04, 0x3c)
              }
          }
          function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) {
              assembly {
                  // We need at most 128 bytes for Ethereum signed message header.
                  // The max length of the ASCII reprenstation of a uint256 is 78 bytes.
                  // The length of "\\x19Ethereum Signed Message:\
      " is 26 bytes (i.e. 0x1a).
                  // The next multiple of 32 above 78 + 26 is 128 (i.e. 0x80).
                  // Instead of allocating, we temporarily copy the 128 bytes before the
                  // start of `s` data to some variables.
                  let m3 := mload(sub(s, 0x60))
                  let m2 := mload(sub(s, 0x40))
                  let m1 := mload(sub(s, 0x20))
                  // The length of `s` is in bytes.
                  let sLength := mload(s)
                  let ptr := add(s, 0x20)
                  // `end` marks the end of the memory which we will compute the keccak256 of.
                  let end := add(ptr, sLength)
                  // Convert the length of the bytes to ASCII decimal representation
                  // and store it into the memory.
                  // prettier-ignore
                  for { let temp := sLength } 1 {} {
                      ptr := sub(ptr, 1)
                      mstore8(ptr, add(48, mod(temp, 10)))
                      temp := div(temp, 10)
                      // prettier-ignore
                      if iszero(temp) { break }
                  }
                  // Copy the header over to the memory.
                  mstore(sub(ptr, 0x20), "\\x00\\x00\\x00\\x00\\x00\\x00\\x19Ethereum Signed Message:\
      ")
                  // Compute the keccak256 of the memory.
                  result := keccak256(sub(ptr, 0x1a), sub(end, sub(ptr, 0x1a)))
                  // Restore the previous memory.
                  mstore(s, sLength)
                  mstore(sub(s, 0x20), m1)
                  mstore(sub(s, 0x40), m2)
                  mstore(sub(s, 0x60), m3)
              }
          }
      }
      // SPDX-License-Identifier: MIT
      pragma solidity ^0.8.4;
      /// @notice Library for converting numbers into strings and other string operations.
      /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol)
      /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol)
      library LibString {
          /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
          /*                        CUSTOM ERRORS                       */
          /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
          error HexLengthInsufficient();
          /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
          /*                     DECIMAL OPERATIONS                     */
          /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
          function toString(uint256 value) internal pure 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)
              }
          }
          /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
          /*                   HEXADECIMAL OPERATIONS                   */
          /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
          function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) {
              assembly {
                  let start := mload(0x40)
                  // We need 0x20 bytes for the trailing zeros padding, `length * 2` bytes
                  // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length.
                  // We add 0x20 to the total and round down to a multiple of 0x20.
                  // (0x20 + 0x20 + 0x02 + 0x20) = 0x62.
                  let m := add(start, and(add(shl(1, length), 0x62), not(0x1f)))
                  // Allocate the memory.
                  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 to calculate the length later.
                  let end := str
                  // Store "0123456789abcdef" in scratch space.
                  mstore(0x0f, 0x30313233343536373839616263646566)
                  let temp := value
                  // 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 {} 1 {} {
                      str := sub(str, 2)
                      mstore8(add(str, 1), mload(and(temp, 15)))
                      mstore8(str, mload(and(shr(4, temp), 15)))
                      temp := shr(8, temp)
                      length := sub(length, 1)
                      // prettier-ignore
                      if iszero(length) { break }
                  }
                  if temp {
                      // Store the function selector of `HexLengthInsufficient()`.
                      mstore(0x00, 0x2194895a)
                      // Revert with (offset, size).
                      revert(0x1c, 0x04)
                  }
                  // Compute the string's length.
                  let strLength := add(sub(end, str), 2)
                  // Move the pointer and write the "0x" prefix.
                  str := sub(str, 0x20)
                  mstore(str, 0x3078)
                  // Move the pointer and write the length.
                  str := sub(str, 2)
                  mstore(str, strLength)
              }
          }
          function toHexString(uint256 value) internal pure returns (string memory str) {
              assembly {
                  let start := mload(0x40)
                  // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
                  // 0x02 bytes for the prefix, and 0x40 bytes for the digits.
                  // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0.
                  let m := add(start, 0xa0)
                  // Allocate the memory.
                  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 to calculate the length later.
                  let end := str
                  // Store "0123456789abcdef" in scratch space.
                  mstore(0x0f, 0x30313233343536373839616263646566)
                  // 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, 2)
                      mstore8(add(str, 1), mload(and(temp, 15)))
                      mstore8(str, mload(and(shr(4, temp), 15)))
                      temp := shr(8, temp)
                      // prettier-ignore
                      if iszero(temp) { break }
                  }
                  // Compute the string's length.
                  let strLength := add(sub(end, str), 2)
                  // Move the pointer and write the "0x" prefix.
                  str := sub(str, 0x20)
                  mstore(str, 0x3078)
                  // Move the pointer and write the length.
                  str := sub(str, 2)
                  mstore(str, strLength)
              }
          }
          function toHexString(address value) internal pure returns (string memory str) {
              assembly {
                  let start := mload(0x40)
                  // We need 0x20 bytes for the length, 0x02 bytes for the prefix,
                  // and 0x28 bytes for the digits.
                  // The next multiple of 0x20 above (0x20 + 0x02 + 0x28) is 0x60.
                  str := add(start, 0x60)
                  // Allocate the memory.
                  mstore(0x40, str)
                  // Store "0123456789abcdef" in scratch space.
                  mstore(0x0f, 0x30313233343536373839616263646566)
                  let length := 20
                  // 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, 2)
                      mstore8(add(str, 1), mload(and(temp, 15)))
                      mstore8(str, mload(and(shr(4, temp), 15)))
                      temp := shr(8, temp)
                      length := sub(length, 1)
                      // prettier-ignore
                      if iszero(length) { break }
                  }
                  // Move the pointer and write the "0x" prefix.
                  str := sub(str, 32)
                  mstore(str, 0x3078)
                  // Move the pointer and write the length.
                  str := sub(str, 2)
                  mstore(str, 42)
              }
          }
          /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
          /*                   OTHER STRING OPERATIONS                  */
          /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
          function replace(
              string memory subject,
              string memory search,
              string memory replacement
          ) internal pure returns (string memory result) {
              assembly {
                  let subjectLength := mload(subject)
                  let searchLength := mload(search)
                  let replacementLength := mload(replacement)
                  subject := add(subject, 0x20)
                  search := add(search, 0x20)
                  replacement := add(replacement, 0x20)
                  result := add(mload(0x40), 0x20)
                  let subjectEnd := add(subject, subjectLength)
                  if iszero(gt(searchLength, subjectLength)) {
                      let subjectSearchEnd := add(sub(subjectEnd, searchLength), 1)
                      let h := 0
                      if iszero(lt(searchLength, 32)) {
                          h := keccak256(search, searchLength)
                      }
                      let m := shl(3, sub(32, and(searchLength, 31)))
                      let s := mload(search)
                      // prettier-ignore
                      for {} 1 {} {
                          let t := mload(subject)
                          // Whether the first `searchLength % 32` bytes of 
                          // `subject` and `search` matches.
                          if iszero(shr(m, xor(t, s))) {
                              if h {
                                  if iszero(eq(keccak256(subject, searchLength), h)) {
                                      mstore(result, t)
                                      result := add(result, 1)
                                      subject := add(subject, 1)
                                      // prettier-ignore
                                      if iszero(lt(subject, subjectSearchEnd)) { break }
                                      continue
                                  }
                              }
                              // Copy the `replacement` one word at a time.
                              // prettier-ignore
                              for { let o := 0 } 1 {} {
                                  mstore(add(result, o), mload(add(replacement, o)))
                                  o := add(o, 0x20)
                                  // prettier-ignore
                                  if iszero(lt(o, replacementLength)) { break }
                              }
                              result := add(result, replacementLength)
                              subject := add(subject, searchLength)    
                              if iszero(searchLength) {
                                  mstore(result, t)
                                  result := add(result, 1)
                                  subject := add(subject, 1)
                              }
                              // prettier-ignore
                              if iszero(lt(subject, subjectSearchEnd)) { break }
                              continue
                          }
                          mstore(result, t)
                          result := add(result, 1)
                          subject := add(subject, 1)
                          // prettier-ignore
                          if iszero(lt(subject, subjectSearchEnd)) { break }
                      }
                  }
                  let resultRemainder := result
                  result := add(mload(0x40), 0x20)
                  let k := add(sub(resultRemainder, result), sub(subjectEnd, subject))
                  // Copy the rest of the string one word at a time.
                  // prettier-ignore
                  for {} lt(subject, subjectEnd) {} {
                      mstore(resultRemainder, mload(subject))
                      resultRemainder := add(resultRemainder, 0x20)
                      subject := add(subject, 0x20)
                  }
                  // Allocate memory for the length and the bytes,
                  // rounded up to a multiple of 32.
                  mstore(0x40, add(result, and(add(k, 0x40), not(0x1f))))
                  result := sub(result, 0x20)
                  mstore(result, k)
              }
          }
      }
      // SPDX-License-Identifier: MIT
      pragma solidity ^0.8.4;
      /// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree.
      /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)
      /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)
      /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)
      library MerkleProofLib {
          function verify(
              bytes32[] calldata proof,
              bytes32 root,
              bytes32 leaf
          ) internal pure returns (bool isValid) {
              assembly {
                  if proof.length {
                      // Left shift by 5 is equivalent to multiplying by 0x20.
                      let end := add(proof.offset, shl(5, proof.length))
                      // Initialize `offset` to the offset of `proof` in the calldata.
                      let offset := proof.offset
                      // Iterate over proof elements to compute root hash.
                      // prettier-ignore
                      for {} 1 {} {
                          // Slot of `leaf` in scratch space.
                          // If the condition is true: 0x20, otherwise: 0x00.
                          let scratch := shl(5, gt(leaf, calldataload(offset)))
                          // Store elements to hash contiguously in scratch space.
                          // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
                          mstore(scratch, leaf)
                          mstore(xor(scratch, 0x20), calldataload(offset))
                          // Reuse `leaf` to store the hash to reduce stack operations.
                          leaf := keccak256(0x00, 0x40)
                          offset := add(offset, 0x20)
                          // prettier-ignore
                          if iszero(lt(offset, end)) { break }
                      }
                  }
                  isValid := eq(leaf, root)
              }
          }
          function verifyMultiProof(
              bytes32[] calldata proof,
              bytes32 root,
              bytes32[] calldata leafs,
              bool[] calldata flags
          ) internal pure returns (bool isValid) {
              // Rebuilds the root by consuming and producing values on a queue.
              // The queue starts with the `leafs` array, and goes into a `hashes` array.
              // After the process, the last element on the queue is verified
              // to be equal to the `root`.
              //
              // The `flags` array denotes whether the sibling
              // should be popped from the queue (`flag == true`), or
              // should be popped from the `proof` (`flag == false`).
              assembly {
                  // If the number of flags is correct.
                  // prettier-ignore
                  for {} eq(add(leafs.length, proof.length), add(flags.length, 1)) {} {
                      // Left shift by 5 is equivalent to multiplying by 0x20.
                      // Compute the end calldata offset of `leafs`.
                      let leafsEnd := add(leafs.offset, shl(5, leafs.length))
                      // These are the calldata offsets.
                      let leafsOffset := leafs.offset
                      let flagsOffset := flags.offset
                      let proofOffset := proof.offset
                      // We can use the free memory space for the queue.
                      // We don't need to allocate, since the queue is temporary.
                      let hashesFront := mload(0x40)
                      let hashesBack := hashesFront
                      // This is the end of the memory for the queue.
                      let end := add(hashesBack, shl(5, flags.length))
                      // For the case where `proof.length + leafs.length == 1`.
                      if iszero(flags.length) {
                          // If `proof.length` is zero, `leafs.length` is 1.
                          if iszero(proof.length) {
                              isValid := eq(calldataload(leafsOffset), root)
                              break
                          }
                          // If `leafs.length` is zero, `proof.length` is 1.
                          if iszero(leafs.length) {
                              isValid := eq(calldataload(proofOffset), root)
                              break
                          }
                      }
                      // prettier-ignore
                      for {} 1 {} {
                          let a := 0
                          // Pops a value from the queue into `a`.
                          switch lt(leafsOffset, leafsEnd)
                          case 0 {
                              // Pop from `hashes` if there are no more leafs.
                              a := mload(hashesFront)
                              hashesFront := add(hashesFront, 0x20)
                          }
                          default {
                              // Otherwise, pop from `leafs`.
                              a := calldataload(leafsOffset)
                              leafsOffset := add(leafsOffset, 0x20)
                          }
                          let b := 0
                          // If the flag is false, load the next proof,
                          // else, pops from the queue.
                          switch calldataload(flagsOffset)
                          case 0 {
                              // Loads the next proof.
                              b := calldataload(proofOffset)
                              proofOffset := add(proofOffset, 0x20)
                          }
                          default {
                              // Pops a value from the queue into `a`.
                              switch lt(leafsOffset, leafsEnd)
                              case 0 {
                                  // Pop from `hashes` if there are no more leafs.
                                  b := mload(hashesFront)
                                  hashesFront := add(hashesFront, 0x20)
                              }
                              default {
                                  // Otherwise, pop from `leafs`.
                                  b := calldataload(leafsOffset)
                                  leafsOffset := add(leafsOffset, 0x20)
                              }
                          }
                          // Advance to the next flag offset.
                          flagsOffset := add(flagsOffset, 0x20)
                          // Slot of `a` in scratch space.
                          // If the condition is true: 0x20, otherwise: 0x00.
                          let scratch := shl(5, gt(a, b))
                          // Hash the scratch space and push the result onto the queue.
                          mstore(scratch, a)
                          mstore(xor(scratch, 0x20), b)
                          mstore(hashesBack, keccak256(0x00, 0x40))
                          hashesBack := add(hashesBack, 0x20)
                          // prettier-ignore
                          if iszero(lt(hashesBack, end)) { break }
                      }
                      // Checks if the last value in the queue is same as the root.
                      isValid := eq(mload(sub(hashesBack, 0x20)), root)
                      break
                  }
              }
          }
      }
      

      File 5 of 10: Archetype
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
      pragma solidity ^0.8.0;
      import "../utils/introspection/IERC165Upgradeable.sol";
      /**
       * @dev Interface for the NFT Royalty Standard.
       *
       * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
       * support for royalty payments across all NFT marketplaces and ecosystem participants.
       *
       * _Available since v4.5._
       */
      interface IERC2981Upgradeable is IERC165Upgradeable {
          /**
           * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
           * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
           */
          function royaltyInfo(uint256 tokenId, uint256 salePrice)
              external
              view
              returns (address receiver, uint256 royaltyAmount);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)
      pragma solidity ^0.8.2;
      import "../../utils/AddressUpgradeable.sol";
      /**
       * @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]
       * ```
       * 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 Indicates that the contract has been initialized.
           * @custom:oz-retyped-from bool
           */
          uint8 private _initialized;
          /**
           * @dev Indicates that the contract is in the process of being initialized.
           */
          bool private _initializing;
          /**
           * @dev Triggered when the contract has been initialized or reinitialized.
           */
          event Initialized(uint8 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 functions marked with `initializer` can be nested in the context of a
           * constructor.
           *
           * Emits an {Initialized} event.
           */
          modifier initializer() {
              bool isTopLevelCall = !_initializing;
              require(
                  (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
                  "Initializable: contract is already initialized"
              );
              _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 255 will prevent any future reinitialization.
           *
           * Emits an {Initialized} event.
           */
          modifier reinitializer(uint8 version) {
              require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
              _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() {
              require(_initializing, "Initializable: contract is not initializing");
              _;
          }
          /**
           * @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 {
              require(!_initializing, "Initializable: contract is initializing");
              if (_initialized < type(uint8).max) {
                  _initialized = type(uint8).max;
                  emit Initialized(type(uint8).max);
              }
          }
          /**
           * @dev Internal function that returns the initialized version. Returns `_initialized`
           */
          function _getInitializedVersion() internal view returns (uint8) {
              return _initialized;
          }
          /**
           * @dev Internal function that returns the initialized version. Returns `_initializing`
           */
          function _isInitializing() internal view returns (bool) {
              return _initializing;
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)
      pragma solidity ^0.8.0;
      import "../../interfaces/IERC2981Upgradeable.sol";
      import "../../utils/introspection/ERC165Upgradeable.sol";
      import "../../proxy/utils/Initializable.sol";
      /**
       * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
       *
       * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
       * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
       *
       * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
       * fee is specified in basis points by default.
       *
       * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
       * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
       * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
       *
       * _Available since v4.5._
       */
      abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {
          function __ERC2981_init() internal onlyInitializing {
          }
          function __ERC2981_init_unchained() internal onlyInitializing {
          }
          struct RoyaltyInfo {
              address receiver;
              uint96 royaltyFraction;
          }
          RoyaltyInfo private _defaultRoyaltyInfo;
          mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {
              return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);
          }
          /**
           * @inheritdoc IERC2981Upgradeable
           */
          function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
              RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
              if (royalty.receiver == address(0)) {
                  royalty = _defaultRoyaltyInfo;
              }
              uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();
              return (royalty.receiver, royaltyAmount);
          }
          /**
           * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
           * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
           * override.
           */
          function _feeDenominator() internal pure virtual returns (uint96) {
              return 10000;
          }
          /**
           * @dev Sets the royalty information that all ids in this contract will default to.
           *
           * Requirements:
           *
           * - `receiver` cannot be the zero address.
           * - `feeNumerator` cannot be greater than the fee denominator.
           */
          function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
              require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
              require(receiver != address(0), "ERC2981: invalid receiver");
              _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
          }
          /**
           * @dev Removes default royalty information.
           */
          function _deleteDefaultRoyalty() internal virtual {
              delete _defaultRoyaltyInfo;
          }
          /**
           * @dev Sets the royalty information for a specific token id, overriding the global default.
           *
           * Requirements:
           *
           * - `receiver` cannot be the zero address.
           * - `feeNumerator` cannot be greater than the fee denominator.
           */
          function _setTokenRoyalty(
              uint256 tokenId,
              address receiver,
              uint96 feeNumerator
          ) internal virtual {
              require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
              require(receiver != address(0), "ERC2981: Invalid parameters");
              _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
          }
          /**
           * @dev Resets royalty information for the token id back to the global default.
           */
          function _resetTokenRoyalty(uint256 tokenId) internal virtual {
              delete _tokenRoyaltyInfo[tokenId];
          }
          /**
           * @dev This empty reserved space is put in place to allow future versions to add new
           * variables without shifting down storage in the inheritance chain.
           * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
           */
          uint256[48] private __gap;
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Interface of the ERC20 standard as defined in the EIP.
       */
      interface IERC20Upgradeable {
          /**
           * @dev Emitted when `value` tokens are moved from one account (`from`) to
           * another (`to`).
           *
           * Note that `value` may be zero.
           */
          event Transfer(address indexed from, address indexed to, uint256 value);
          /**
           * @dev Emitted when the allowance of a `spender` for an `owner` is set by
           * a call to {approve}. `value` is the new allowance.
           */
          event Approval(address indexed owner, address indexed spender, uint256 value);
          /**
           * @dev Returns the amount of tokens in existence.
           */
          function totalSupply() external view returns (uint256);
          /**
           * @dev Returns the amount of tokens owned by `account`.
           */
          function balanceOf(address account) external view returns (uint256);
          /**
           * @dev Moves `amount` tokens from the caller's account to `to`.
           *
           * Returns a boolean value indicating whether the operation succeeded.
           *
           * Emits a {Transfer} event.
           */
          function transfer(address to, uint256 amount) external returns (bool);
          /**
           * @dev Returns the remaining number of tokens that `spender` will be
           * allowed to spend on behalf of `owner` through {transferFrom}. This is
           * zero by default.
           *
           * This value changes when {approve} or {transferFrom} are called.
           */
          function allowance(address owner, address spender) external view returns (uint256);
          /**
           * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
           *
           * Returns a boolean value indicating whether the operation succeeded.
           *
           * IMPORTANT: Beware that changing an allowance with this method brings the risk
           * that someone may use both the old and the new allowance by unfortunate
           * transaction ordering. One possible solution to mitigate this race
           * condition is to first reduce the spender's allowance to 0 and set the
           * desired value afterwards:
           * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
           *
           * Emits an {Approval} event.
           */
          function approve(address spender, uint256 amount) external returns (bool);
          /**
           * @dev Moves `amount` tokens from `from` to `to` using the
           * allowance mechanism. `amount` is then deducted from the caller's
           * allowance.
           *
           * Returns a boolean value indicating whether the operation succeeded.
           *
           * Emits a {Transfer} event.
           */
          function transferFrom(
              address from,
              address to,
              uint256 amount
          ) external returns (bool);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
      pragma solidity ^0.8.1;
      /**
       * @dev Collection of functions related to the address type
       */
      library AddressUpgradeable {
          /**
           * @dev Returns true if `account` is a contract.
           *
           * [IMPORTANT]
           * ====
           * It is unsafe to assume that an address for which this function returns
           * false is an externally-owned account (EOA) and not a contract.
           *
           * Among others, `isContract` will return false for the following
           * types of addresses:
           *
           *  - an externally-owned account
           *  - a contract in construction
           *  - an address where a contract will be created
           *  - an address where a contract lived, but was destroyed
           * ====
           *
           * [IMPORTANT]
           * ====
           * You shouldn't rely on `isContract` to protect against flash loan attacks!
           *
           * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
           * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
           * constructor.
           * ====
           */
          function isContract(address account) internal view returns (bool) {
              // This method relies on extcodesize/address.code.length, which returns 0
              // for contracts in construction, since the code is only stored at the end
              // of the constructor execution.
              return account.code.length > 0;
          }
          /**
           * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
           * `recipient`, forwarding all available gas and reverting on errors.
           *
           * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
           * of certain opcodes, possibly making contracts go over the 2300 gas limit
           * imposed by `transfer`, making them unable to receive funds via
           * `transfer`. {sendValue} removes this limitation.
           *
           * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
           *
           * IMPORTANT: because control is transferred to `recipient`, care must be
           * taken to not create reentrancy vulnerabilities. Consider using
           * {ReentrancyGuard} or the
           * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
           */
          function sendValue(address payable recipient, uint256 amount) internal {
              require(address(this).balance >= amount, "Address: insufficient balance");
              (bool success, ) = recipient.call{value: amount}("");
              require(success, "Address: unable to send value, recipient may have reverted");
          }
          /**
           * @dev Performs a Solidity function call using a low level `call`. A
           * plain `call` is an unsafe replacement for a function call: use this
           * function instead.
           *
           * If `target` reverts with a revert reason, it is bubbled up by this
           * function (like regular Solidity function calls).
           *
           * Returns the raw returned data. To convert to the expected return value,
           * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
           *
           * Requirements:
           *
           * - `target` must be a contract.
           * - calling `target` with `data` must not revert.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, "Address: low-level call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
           * `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but also transferring `value` wei to `target`.
           *
           * Requirements:
           *
           * - the calling contract must have an ETH balance of at least `value`.
           * - the called Solidity function must be `payable`.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
          }
          /**
           * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
           * with `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(address(this).balance >= value, "Address: insufficient balance for call");
              (bool success, bytes memory returndata) = target.call{value: value}(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
              return functionStaticCall(target, data, "Address: low-level static call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              (bool success, bytes memory returndata) = target.staticcall(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
          /**
           * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
           * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
           *
           * _Available since v4.8._
           */
          function verifyCallResultFromTarget(
              address target,
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              if (success) {
                  if (returndata.length == 0) {
                      // only check isContract if the call was successful and the return data is empty
                      // otherwise we already know that it was a contract
                      require(isContract(target), "Address: call to non-contract");
                  }
                  return returndata;
              } else {
                  _revert(returndata, errorMessage);
              }
          }
          /**
           * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
           * revert reason or using the provided one.
           *
           * _Available since v4.3._
           */
          function verifyCallResult(
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal pure returns (bytes memory) {
              if (success) {
                  return returndata;
              } else {
                  _revert(returndata, errorMessage);
              }
          }
          function _revert(bytes memory returndata, string memory errorMessage) private pure {
              // Look for revert reason and bubble it up if present
              if (returndata.length > 0) {
                  // The easiest way to bubble the revert reason is using memory via assembly
                  /// @solidity memory-safe-assembly
                  assembly {
                      let returndata_size := mload(returndata)
                      revert(add(32, returndata), returndata_size)
                  }
              } else {
                  revert(errorMessage);
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
      pragma solidity ^0.8.0;
      import "./IERC165Upgradeable.sol";
      import "../../proxy/utils/Initializable.sol";
      /**
       * @dev Implementation of the {IERC165} interface.
       *
       * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
       * for the additional interface id that will be supported. For example:
       *
       * ```solidity
       * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
       *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
       * }
       * ```
       *
       * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
       */
      abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
          function __ERC165_init() internal onlyInitializing {
          }
          function __ERC165_init_unchained() internal onlyInitializing {
          }
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              return interfaceId == type(IERC165Upgradeable).interfaceId;
          }
          /**
           * @dev This empty reserved space is put in place to allow future versions to add new
           * variables without shifting down storage in the inheritance chain.
           * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
           */
          uint256[50] private __gap;
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165Upgradeable {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      // SPDX-License-Identifier: MIT
      pragma solidity ^0.8.4;
      /// @notice Optimized and flexible operator filterer to abide to OpenSea's
      /// mandatory on-chain royalty enforcement in order for new collections to
      /// receive royalties.
      /// For more information, see:
      /// See: https://github.com/ProjectOpenSea/operator-filter-registry
      abstract contract OperatorFilterer {
          /// @dev The default OpenSea operator blocklist subscription.
          address internal constant _DEFAULT_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
          /// @dev The OpenSea operator filter registry.
          address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;
          /// @dev Registers the current contract to OpenSea's operator filter,
          /// and subscribe to the default OpenSea operator blocklist.
          /// Note: Will not revert nor update existing settings for repeated registration.
          function _registerForOperatorFiltering() internal virtual {
              _registerForOperatorFiltering(_DEFAULT_SUBSCRIPTION, true);
          }
          /// @dev Registers the current contract to OpenSea's operator filter.
          /// Note: Will not revert nor update existing settings for repeated registration.
          function _registerForOperatorFiltering(address subscriptionOrRegistrantToCopy, bool subscribe)
              internal
              virtual
          {
              /// @solidity memory-safe-assembly
              assembly {
                  let functionSelector := 0x7d3e3dbe // `registerAndSubscribe(address,address)`.
                  // Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty.
                  subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
                  for {} iszero(subscribe) {} {
                      if iszero(subscriptionOrRegistrantToCopy) {
                          functionSelector := 0x4420e486 // `register(address)`.
                          break
                      }
                      functionSelector := 0xa0af2903 // `registerAndCopyEntries(address,address)`.
                      break
                  }
                  // Store the function selector.
                  mstore(0x00, shl(224, functionSelector))
                  // Store the `address(this)`.
                  mstore(0x04, address())
                  // Store the `subscriptionOrRegistrantToCopy`.
                  mstore(0x24, subscriptionOrRegistrantToCopy)
                  // Register into the registry.
                  if iszero(call(gas(), _OPERATOR_FILTER_REGISTRY, 0, 0x00, 0x44, 0x00, 0x04)) {
                      // If the function selector has not been overwritten,
                      // it is an out-of-gas error.
                      if eq(shr(224, mload(0x00)), functionSelector) {
                          // To prevent gas under-estimation.
                          revert(0, 0)
                      }
                  }
                  // Restore the part of the free memory pointer that was overwritten,
                  // which is guaranteed to be zero, because of Solidity's memory size limits.
                  mstore(0x24, 0)
              }
          }
          /// @dev Modifier to guard a function and revert if the caller is a blocked operator.
          modifier onlyAllowedOperator(address from) virtual {
              if (from != msg.sender) {
                  if (!_isPriorityOperator(msg.sender)) {
                      if (_operatorFilteringEnabled()) _revertIfBlocked(msg.sender);
                  }
              }
              _;
          }
          /// @dev Modifier to guard a function from approving a blocked operator..
          modifier onlyAllowedOperatorApproval(address operator) virtual {
              if (!_isPriorityOperator(operator)) {
                  if (_operatorFilteringEnabled()) _revertIfBlocked(operator);
              }
              _;
          }
          /// @dev Helper function that reverts if the `operator` is blocked by the registry.
          function _revertIfBlocked(address operator) private view {
              /// @solidity memory-safe-assembly
              assembly {
                  // Store the function selector of `isOperatorAllowed(address,address)`,
                  // shifted left by 6 bytes, which is enough for 8tb of memory.
                  // We waste 6-3 = 3 bytes to save on 6 runtime gas (PUSH1 0x224 SHL).
                  mstore(0x00, 0xc6171134001122334455)
                  // Store the `address(this)`.
                  mstore(0x1a, address())
                  // Store the `operator`.
                  mstore(0x3a, operator)
                  // `isOperatorAllowed` always returns true if it does not revert.
                  if iszero(staticcall(gas(), _OPERATOR_FILTER_REGISTRY, 0x16, 0x44, 0x00, 0x00)) {
                      // Bubble up the revert if the staticcall reverts.
                      returndatacopy(0x00, 0x00, returndatasize())
                      revert(0x00, returndatasize())
                  }
                  // We'll skip checking if `from` is inside the blacklist.
                  // Even though that can block transferring out of wrapper contracts,
                  // we don't want tokens to be stuck.
                  // Restore the part of the free memory pointer that was overwritten,
                  // which is guaranteed to be zero, if less than 8tb of memory is used.
                  mstore(0x3a, 0)
              }
          }
          /// @dev For deriving contracts to override, so that operator filtering
          /// can be turned on / off.
          /// Returns true by default.
          function _operatorFilteringEnabled() internal view virtual returns (bool) {
              return true;
          }
          /// @dev For deriving contracts to override, so that preferred marketplaces can
          /// skip operator filtering, helping users save gas.
          /// Returns false for all inputs by default.
          function _isPriorityOperator(address) internal view virtual returns (bool) {
              return false;
          }
      }
      // SPDX-License-Identifier: MIT
      // Archetype v0.5.1
      //
      //        d8888                 888               888
      //       d88888                 888               888
      //      d88P888                 888               888
      //     d88P 888 888d888 .d8888b 88888b.   .d88b.  888888 888  888 88888b.   .d88b.
      //    d88P  888 888P"  d88P"    888 "88b d8P  Y8b 888    888  888 888 "88b d8P  Y8b
      //   d88P   888 888    888      888  888 88888888 888    888  888 888  888 88888888
      //  d8888888888 888    Y88b.    888  888 Y8b.     Y88b.  Y88b 888 888 d88P Y8b.
      // d88P     888 888     "Y8888P 888  888  "Y8888   "Y888  "Y88888 88888P"   "Y8888
      //                                                            888 888
      //                                                       Y8b d88P 888
      //                                                        "Y88P"  888
      pragma solidity ^0.8.4;
      import "./ArchetypeLogic.sol";
      import "erc721a-upgradeable/contracts/ERC721AUpgradeable.sol";
      import "erc721a-upgradeable/contracts/ERC721A__Initializable.sol";
      import "./ERC721A__OwnableUpgradeable.sol";
      import "solady/src/utils/LibString.sol";
      import "closedsea/src/OperatorFilterer.sol";
      import "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
      contract Archetype is
        ERC721A__Initializable,
        ERC721AUpgradeable,
        OperatorFilterer,
        ERC721A__OwnableUpgradeable,
        ERC2981Upgradeable
      {
        //
        // EVENTS
        //
        event Invited(bytes32 indexed key, bytes32 indexed cid);
        event Referral(address indexed affiliate, address token, uint128 wad, uint256 numMints);
        event Withdrawal(address indexed src, address token, uint128 wad);
        //
        // VARIABLES
        //
        mapping(bytes32 => DutchInvite) public invites;
        mapping(address => mapping(bytes32 => uint256)) private _minted;
        mapping(bytes32 => uint256) private _listSupply;
        mapping(address => OwnerBalance) private _ownerBalance;
        mapping(address => mapping(address => uint128)) private _affiliateBalance;
        mapping(uint256 => bytes) private _tokenMsg;
        Config public config;
        BurnConfig public burnConfig;
        Options public options;
        string public provenance;
        //
        // METHODS
        //
        function initialize(
          string memory name,
          string memory symbol,
          Config calldata config_,
          address _receiver
        ) external initializerERC721A {
          __ERC721A_init(name, symbol);
          // check max bps not reached and min platform fee.
          if (
            config_.affiliateFee > MAXBPS ||
            config_.platformFee > MAXBPS ||
            config_.platformFee < 500 ||
            config_.discounts.affiliateDiscount > MAXBPS ||
            config_.affiliateSigner == address(0) ||
            config_.maxBatchSize == 0
          ) {
            revert InvalidConfig();
          }
          // ensure mint tiers are correctly ordered from highest to lowest.
          for (uint256 i = 1; i < config_.discounts.mintTiers.length; i++) {
            if (
              config_.discounts.mintTiers[i].mintDiscount > MAXBPS ||
              config_.discounts.mintTiers[i].numMints > config_.discounts.mintTiers[i - 1].numMints
            ) {
              revert InvalidConfig();
            }
          }
          config = config_;
          __Ownable_init();
          if (config.ownerAltPayout != address(0)) {
            setDefaultRoyalty(config.ownerAltPayout, config.defaultRoyalty);
          } else {
            setDefaultRoyalty(_receiver, config.defaultRoyalty);
          }
        }
        //
        // PUBLIC
        //
        function mint(
          Auth calldata auth,
          uint256 quantity,
          address affiliate,
          bytes calldata signature
        ) external payable {
          mintTo(auth, quantity, msg.sender, affiliate, signature);
        }
        function batchMintTo(
          Auth calldata auth,
          address[] calldata toList,
          uint256[] calldata quantityList,
          address affiliate,
          bytes calldata signature
        ) external payable {
          if (quantityList.length != toList.length) {
            revert InvalidConfig();
          }
          DutchInvite storage invite = invites[auth.key];
          uint256 quantity = 0;
          {
            uint32 unitSize = invite.unitSize;
            for (uint256 i = 0; i < quantityList.length; i++) {
              if (unitSize > 1) {
                quantity += quantityList[i] * unitSize;
              } else {
                quantity += quantityList[i];
              }
            }
          }
          uint256 curSupply = _totalMinted();
          ArchetypeLogic.validateMint(
            invite,
            config,
            auth,
            quantity,
            owner(),
            affiliate,
            curSupply,
            _minted,
            _listSupply,
            signature
          );
          {
            uint32 unitSize = invite.unitSize;
            for (uint256 i = 0; i < toList.length; i++) {
              if (unitSize > 1) {
                _mint(toList[i], quantityList[i] * unitSize);
              } else {
                _mint(toList[i], quantityList[i]);
              }
            }
          }
          if (invite.limit < invite.maxSupply) {
            _minted[msg.sender][auth.key] += quantity;
          }
          if (invite.maxSupply < config.maxSupply) {
            _listSupply[auth.key] += quantity;
          }
          ArchetypeLogic.updateBalances(
            invite,
            config,
            _ownerBalance,
            _affiliateBalance,
            affiliate,
            quantity
          );
        }
        function mintTo(
          Auth calldata auth,
          uint256 quantity,
          address to,
          address affiliate,
          bytes calldata signature
        ) public payable {
          DutchInvite storage i = invites[auth.key];
          if (i.unitSize > 1) {
            quantity = quantity * i.unitSize;
          }
          uint256 curSupply = _totalMinted();
          ArchetypeLogic.validateMint(
            i,
            config,
            auth,
            quantity,
            owner(),
            affiliate,
            curSupply,
            _minted,
            _listSupply,
            signature
          );
          _mint(to, quantity);
          if (i.limit < i.maxSupply) {
            _minted[msg.sender][auth.key] += quantity;
          }
          if (i.maxSupply < config.maxSupply) {
            _listSupply[auth.key] += quantity;
          }
          ArchetypeLogic.updateBalances(i, config, _ownerBalance, _affiliateBalance, affiliate, quantity);
        }
        function burnToMint(uint256[] calldata tokenIds) external {
          uint256 curSupply = _totalMinted();
          ArchetypeLogic.validateBurnToMint(config, burnConfig, tokenIds, curSupply, _minted);
          for (uint256 i = 0; i < tokenIds.length; i++) {
            burnConfig.archetype.transferFrom(
              msg.sender,
              address(0x000000000000000000000000000000000000dEaD),
              tokenIds[i]
            );
          }
          uint256 quantity = burnConfig.reversed
            ? tokenIds.length * burnConfig.ratio
            : tokenIds.length / burnConfig.ratio;
          _mint(msg.sender, quantity);
          if (burnConfig.limit < config.maxSupply) {
            _minted[msg.sender][bytes32("burn")] += quantity;
          }
        }
        function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
          if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
          return
            bytes(config.baseUri).length != 0
              ? string(abi.encodePacked(config.baseUri, LibString.toString(tokenId)))
              : "";
        }
        function withdraw() external {
          address[] memory tokens = new address[](1);
          tokens[0] = address(0);
          withdrawTokens(tokens);
        }
        function withdrawTokens(address[] memory tokens) public {
          ArchetypeLogic.withdrawTokens(config, _ownerBalance, _affiliateBalance, owner(), tokens);
        }
        function setTokenMsg(uint256 tokenId, string calldata message) external {
          if (msg.sender != ownerOf(tokenId)) {
            revert NotTokenOwner();
          }
          _tokenMsg[tokenId] = bytes(message);
        }
        function getTokenMsg(uint256 tokenId) external view returns (string memory) {
          if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
          return string(_tokenMsg[tokenId]);
        }
        function ownerBalance() external view returns (OwnerBalance memory) {
          return _ownerBalance[address(0)];
        }
        function ownerBalanceToken(address token) external view returns (OwnerBalance memory) {
          return _ownerBalance[token];
        }
        function affiliateBalance(address affiliate) external view returns (uint128) {
          return _affiliateBalance[affiliate][address(0)];
        }
        function affiliateBalanceToken(address affiliate, address token) external view returns (uint128) {
          return _affiliateBalance[affiliate][token];
        }
        function minted(address minter, bytes32 key) external view returns (uint256) {
          return _minted[minter][key];
        }
        function listSupply(bytes32 key) external view returns (uint256) {
          return _listSupply[key];
        }
        function platform() external pure returns (address) {
          return PLATFORM;
        }
        //
        // OWNER ONLY
        //
        function setBaseURI(string memory baseUri) external onlyOwner {
          if (options.uriLocked) {
            revert LockedForever();
          }
          config.baseUri = baseUri;
        }
        /// @notice the password is "forever"
        function lockURI(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.uriLocked = true;
        }
        /// @notice the password is "forever"
        // max supply cannot subceed total supply. Be careful changing.
        function setMaxSupply(uint32 maxSupply, string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          if (options.maxSupplyLocked) {
            revert LockedForever();
          }
          if (maxSupply < _totalMinted()) {
            revert MaxSupplyExceeded();
          }
          config.maxSupply = maxSupply;
        }
        /// @notice the password is "forever"
        function lockMaxSupply(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.maxSupplyLocked = true;
        }
        function setAffiliateFee(uint16 affiliateFee) external onlyOwner {
          if (options.affiliateFeeLocked) {
            revert LockedForever();
          }
          if (affiliateFee > MAXBPS) {
            revert InvalidConfig();
          }
          config.affiliateFee = affiliateFee;
        }
        /// @notice the password is "forever"
        function lockAffiliateFee(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.affiliateFeeLocked = true;
        }
        function setDiscounts(Discount calldata discounts) external onlyOwner {
          if (options.discountsLocked) {
            revert LockedForever();
          }
          if (discounts.affiliateDiscount > MAXBPS) {
            revert InvalidConfig();
          }
          // ensure mint tiers are correctly ordered from highest to lowest.
          for (uint256 i = 1; i < discounts.mintTiers.length; i++) {
            if (
              discounts.mintTiers[i].mintDiscount > MAXBPS ||
              discounts.mintTiers[i].numMints > discounts.mintTiers[i - 1].numMints
            ) {
              revert InvalidConfig();
            }
          }
          config.discounts = discounts;
        }
        /// @notice the password is "forever"
        function lockDiscounts(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.discountsLocked = true;
        }
        /// @notice Set BAYC-style provenance once it's calculated
        function setProvenanceHash(string memory provenanceHash) external onlyOwner {
          if (options.provenanceHashLocked) {
            revert LockedForever();
          }
          provenance = provenanceHash;
        }
        /// @notice the password is "forever"
        function lockProvenanceHash(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.provenanceHashLocked = true;
        }
        function setOwnerAltPayout(address ownerAltPayout) external onlyOwner {
          if (options.ownerAltPayoutLocked) {
            revert LockedForever();
          }
          config.ownerAltPayout = ownerAltPayout;
        }
        /// @notice the password is "forever"
        function lockOwnerAltPayout(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.ownerAltPayoutLocked = true;
        }
        function setMaxBatchSize(uint32 maxBatchSize) external onlyOwner {
          config.maxBatchSize = maxBatchSize;
        }
        function setInvite(
          bytes32 _key,
          bytes32 _cid,
          Invite calldata _invite
        ) external onlyOwner {
          invites[_key] = DutchInvite({
            price: _invite.price,
            reservePrice: _invite.price,
            delta: 0,
            start: _invite.start,
            end: _invite.end,
            limit: _invite.limit,
            maxSupply: _invite.maxSupply,
            interval: 0,
            unitSize: _invite.unitSize,
            tokenAddress: _invite.tokenAddress
          });
          emit Invited(_key, _cid);
        }
        function setDutchInvite(
          bytes32 _key,
          bytes32 _cid,
          DutchInvite memory _dutchInvite
        ) external onlyOwner {
          if (_dutchInvite.start < block.timestamp) {
            _dutchInvite.start = uint32(block.timestamp);
          }
          invites[_key] = _dutchInvite;
          emit Invited(_key, _cid);
        }
        function enableBurnToMint(
          address archetype,
          bool reversed,
          uint16 ratio,
          uint64 start,
          uint64 limit
        ) external onlyOwner {
          burnConfig = BurnConfig({
            archetype: IERC721AUpgradeable(archetype),
            enabled: true,
            reversed: reversed,
            ratio: ratio,
            start: start,
            limit: limit
          });
        }
        function disableBurnToMint() external onlyOwner {
          burnConfig = BurnConfig({
            enabled: false,
            reversed: false,
            ratio: 0,
            archetype: IERC721AUpgradeable(address(0)),
            start: 0,
            limit: 0
          });
        }
        //
        // PLATFORM ONLY
        //
        function setSuperAffiliatePayout(address superAffiliatePayout) external onlyPlatform {
          config.superAffiliatePayout = superAffiliatePayout;
        }
        //
        // INTERNAL
        //
        function _startTokenId() internal view virtual override returns (uint256) {
          return 1;
        }
        modifier onlyPlatform() {
          if (msg.sender != PLATFORM) {
            revert NotPlatform();
          }
          _;
        }
        // OPTIONAL ROYALTY ENFORCEMENT WITH OPENSEA
        function enableRoyaltyEnforcement() external onlyOwner {
          if (options.royaltyEnforcementLocked) {
            revert LockedForever();
          }
          _registerForOperatorFiltering();
          options.royaltyEnforcementEnabled = true;
        }
        function disableRoyaltyEnforcement() external onlyOwner {
          if (options.royaltyEnforcementLocked) {
            revert LockedForever();
          }
          options.royaltyEnforcementEnabled = false;
        }
        /// @notice the password is "forever"
        function lockRoyaltyEnforcement(string memory password) external onlyOwner {
          if (keccak256(abi.encodePacked(password)) != keccak256(abi.encodePacked("forever"))) {
            revert WrongPassword();
          }
          options.royaltyEnforcementLocked = true;
        }
        function setApprovalForAll(address operator, bool approved)
          public
          override
          onlyAllowedOperatorApproval(operator)
        {
          super.setApprovalForAll(operator, approved);
        }
        function approve(address operator, uint256 tokenId)
          public
          payable
          override
          onlyAllowedOperatorApproval(operator)
        {
          super.approve(operator, tokenId);
        }
        function transferFrom(
          address from,
          address to,
          uint256 tokenId
        ) public payable override onlyAllowedOperator(from) {
          super.transferFrom(from, to, tokenId);
        }
        function safeTransferFrom(
          address from,
          address to,
          uint256 tokenId
        ) public payable override onlyAllowedOperator(from) {
          super.safeTransferFrom(from, to, tokenId);
        }
        function safeTransferFrom(
          address from,
          address to,
          uint256 tokenId,
          bytes memory data
        ) public payable override onlyAllowedOperator(from) {
          super.safeTransferFrom(from, to, tokenId, data);
        }
        function _operatorFilteringEnabled() internal view override returns (bool) {
          return options.royaltyEnforcementEnabled;
        }
        //ERC2981 ROYALTY
        function supportsInterface(bytes4 interfaceId)
          public
          view
          virtual
          override(ERC721AUpgradeable, ERC2981Upgradeable)
          returns (bool)
        {
          // Supports the following `interfaceId`s:
          // - IERC165: 0x01ffc9a7
          // - IERC721: 0x80ac58cd
          // - IERC721Metadata: 0x5b5e139f
          // - IERC2981: 0x2a55205a
          return
            ERC721AUpgradeable.supportsInterface(interfaceId) ||
            ERC2981Upgradeable.supportsInterface(interfaceId);
        }
        function setDefaultRoyalty(address receiver, uint16 feeNumerator) public onlyOwner {
          config.defaultRoyalty = feeNumerator;
          _setDefaultRoyalty(receiver, feeNumerator);
        }
      }
      // SPDX-License-Identifier: MIT
      // ArchetypeLogic v0.5.1
      //
      //        d8888                 888               888
      //       d88888                 888               888
      //      d88P888                 888               888
      //     d88P 888 888d888 .d8888b 88888b.   .d88b.  888888 888  888 88888b.   .d88b.
      //    d88P  888 888P"  d88P"    888 "88b d8P  Y8b 888    888  888 888 "88b d8P  Y8b
      //   d88P   888 888    888      888  888 88888888 888    888  888 888  888 88888888
      //  d8888888888 888    Y88b.    888  888 Y8b.     Y88b.  Y88b 888 888 d88P Y8b.
      // d88P     888 888     "Y8888P 888  888  "Y8888   "Y888  "Y88888 88888P"   "Y8888
      //                                                            888 888
      //                                                       Y8b d88P 888
      //                                                        "Y88P"  888
      pragma solidity ^0.8.4;
      import "erc721a-upgradeable/contracts/ERC721AUpgradeable.sol";
      import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
      import "solady/src/utils/MerkleProofLib.sol";
      import "solady/src/utils/ECDSA.sol";
      error InvalidConfig();
      error MintNotYetStarted();
      error MintEnded();
      error WalletUnauthorizedToMint();
      error InsufficientEthSent();
      error ExcessiveEthSent();
      error Erc20BalanceTooLow();
      error MaxSupplyExceeded();
      error ListMaxSupplyExceeded();
      error NumberOfMintsExceeded();
      error MintingPaused();
      error InvalidReferral();
      error InvalidSignature();
      error BalanceEmpty();
      error TransferFailed();
      error MaxBatchSizeExceeded();
      error BurnToMintDisabled();
      error NotTokenOwner();
      error NotPlatform();
      error NotApprovedToTransfer();
      error InvalidAmountOfTokens();
      error WrongPassword();
      error LockedForever();
      //
      // STRUCTS
      //
      struct Auth {
        bytes32 key;
        bytes32[] proof;
      }
      struct MintTier {
        uint16 numMints;
        uint16 mintDiscount; //BPS
      }
      struct Discount {
        uint16 affiliateDiscount; //BPS
        MintTier[] mintTiers;
      }
      struct Config {
        string baseUri;
        address affiliateSigner;
        address ownerAltPayout; // optional alternative address for owner withdrawals.
        address superAffiliatePayout; // optional super affiliate address, will receive half of platform fee if set.
        uint32 maxSupply;
        uint32 maxBatchSize;
        uint16 affiliateFee; //BPS
        uint16 platformFee; //BPS
        uint16 defaultRoyalty; //BPS
        Discount discounts;
      }
      struct Options {
        bool uriLocked;
        bool maxSupplyLocked;
        bool affiliateFeeLocked;
        bool discountsLocked;
        bool ownerAltPayoutLocked;
        bool royaltyEnforcementEnabled;
        bool royaltyEnforcementLocked;
        bool provenanceHashLocked;
      }
      struct DutchInvite {
        uint128 price;
        uint128 reservePrice;
        uint128 delta;
        uint32 start;
        uint32 end;
        uint32 limit;
        uint32 maxSupply;
        uint32 interval;
        uint32 unitSize; // mint 1 get x
        address tokenAddress;
      }
      struct Invite {
        uint128 price;
        uint32 start;
        uint32 end;
        uint32 limit;
        uint32 maxSupply;
        uint32 unitSize; // mint 1 get x
        address tokenAddress;
      }
      struct OwnerBalance {
        uint128 owner;
        uint128 platform;
      }
      struct BurnConfig {
        IERC721AUpgradeable archetype;
        bool enabled;
        bool reversed; // side of the ratio (false=burn {ratio} get 1, true=burn 1 get {ratio})
        uint16 ratio;
        uint64 start;
        uint64 limit;
      }
      // address constant PLATFORM = 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC; // TEST (account[2])
      address constant PLATFORM = 0x86B82972282Dd22348374bC63fd21620F7ED847B;
      uint16 constant MAXBPS = 5000; // max fee or discount is 50%
      library ArchetypeLogic {
        //
        // EVENTS
        //
        event Invited(bytes32 indexed key, bytes32 indexed cid);
        event Referral(address indexed affiliate, address token, uint128 wad, uint256 numMints);
        event Withdrawal(address indexed src, address token, uint128 wad);
        // calculate price based on affiliate usage and mint discounts
        function computePrice(
          DutchInvite storage invite,
          Discount storage discounts,
          uint256 numTokens,
          bool affiliateUsed
        ) public view returns (uint256) {
          uint256 price = invite.price;
          if (invite.interval != 0) {
            uint256 diff = (((block.timestamp - invite.start) / invite.interval) * invite.delta);
            if (price > invite.reservePrice) {
              if (diff > price - invite.reservePrice) {
                price = invite.reservePrice;
              } else {
                price = price - diff;
              }
            } else if (price < invite.reservePrice) {
              if (diff > invite.reservePrice - price) {
                price = invite.reservePrice;
              } else {
                price = price + diff;
              }
            }
          }
          uint256 cost = price * numTokens;
          if (affiliateUsed) {
            cost = cost - ((cost * discounts.affiliateDiscount) / 10000);
          }
          for (uint256 i = 0; i < discounts.mintTiers.length; i++) {
            if (numTokens >= discounts.mintTiers[i].numMints) {
              return cost = cost - ((cost * discounts.mintTiers[i].mintDiscount) / 10000);
            }
          }
          return cost;
        }
        function validateMint(
          DutchInvite storage i,
          Config storage config,
          Auth calldata auth,
          uint256 quantity,
          address owner,
          address affiliate,
          uint256 curSupply,
          mapping(address => mapping(bytes32 => uint256)) storage minted,
          mapping(bytes32 => uint256) storage listSupply,
          bytes calldata signature
        ) public view {
          if (affiliate != address(0)) {
            if (affiliate == PLATFORM || affiliate == owner || affiliate == msg.sender) {
              revert InvalidReferral();
            }
            validateAffiliate(affiliate, signature, config.affiliateSigner);
          }
          if (i.limit == 0) {
            revert MintingPaused();
          }
          if (!verify(auth, i.tokenAddress, msg.sender)) {
            revert WalletUnauthorizedToMint();
          }
          if (block.timestamp < i.start) {
            revert MintNotYetStarted();
          }
          if (i.end > i.start && block.timestamp > i.end) {
            revert MintEnded();
          }
          if (i.limit < i.maxSupply) {
            uint256 totalAfterMint = minted[msg.sender][auth.key] + quantity;
            if (totalAfterMint > i.limit) {
              revert NumberOfMintsExceeded();
            }
          }
          if (i.maxSupply < config.maxSupply) {
            uint256 totalAfterMint = listSupply[auth.key] + quantity;
            if (totalAfterMint > i.maxSupply) {
              revert ListMaxSupplyExceeded();
            }
          }
          if (quantity > config.maxBatchSize) {
            revert MaxBatchSizeExceeded();
          }
          if ((curSupply + quantity) > config.maxSupply) {
            revert MaxSupplyExceeded();
          }
          uint256 cost = computePrice(i, config.discounts, quantity, affiliate != address(0));
          if (i.tokenAddress != address(0)) {
            IERC20Upgradeable erc20Token = IERC20Upgradeable(i.tokenAddress);
            if (erc20Token.allowance(msg.sender, address(this)) < cost) {
              revert NotApprovedToTransfer();
            }
            if (erc20Token.balanceOf(msg.sender) < cost) {
              revert Erc20BalanceTooLow();
            }
            if (msg.value != 0) {
              revert ExcessiveEthSent();
            }
          } else {
            if (msg.value < cost) {
              revert InsufficientEthSent();
            }
            if (msg.value > cost) {
              revert ExcessiveEthSent();
            }
          }
        }
        function validateBurnToMint(
          Config storage config,
          BurnConfig storage burnConfig,
          uint256[] calldata tokenIds,
          uint256 curSupply,
          mapping(address => mapping(bytes32 => uint256)) storage minted
        ) public view {
          if (!burnConfig.enabled) {
            revert BurnToMintDisabled();
          }
          if (block.timestamp < burnConfig.start) {
            revert MintNotYetStarted();
          }
          // check if msg.sender owns tokens and has correct approvals
          for (uint256 i = 0; i < tokenIds.length; i++) {
            if (burnConfig.archetype.ownerOf(tokenIds[i]) != msg.sender) {
              revert NotTokenOwner();
            }
          }
          if (!burnConfig.archetype.isApprovedForAll(msg.sender, address(this))) {
            revert NotApprovedToTransfer();
          }
          uint256 quantity;
          if (burnConfig.reversed) {
            quantity = tokenIds.length * burnConfig.ratio;
          } else {
            if (tokenIds.length % burnConfig.ratio != 0) {
              revert InvalidAmountOfTokens();
            }
            quantity = tokenIds.length / burnConfig.ratio;
          }
          if (quantity > config.maxBatchSize) {
            revert MaxBatchSizeExceeded();
          }
          if (burnConfig.limit < config.maxSupply) {
            uint256 totalAfterMint = minted[msg.sender][bytes32("burn")] + quantity;
            if (totalAfterMint > burnConfig.limit) {
              revert NumberOfMintsExceeded();
            }
          }
          if ((curSupply + quantity) > config.maxSupply) {
            revert MaxSupplyExceeded();
          }
        }
        function updateBalances(
          DutchInvite storage i,
          Config storage config,
          mapping(address => OwnerBalance) storage _ownerBalance,
          mapping(address => mapping(address => uint128)) storage _affiliateBalance,
          address affiliate,
          uint256 quantity
        ) public {
          address tokenAddress = i.tokenAddress;
          uint128 value = uint128(msg.value);
          if (tokenAddress != address(0)) {
            value = uint128(computePrice(i, config.discounts, quantity, affiliate != address(0)));
          }
          uint128 affiliateWad = 0;
          if (affiliate != address(0)) {
            affiliateWad = (value * config.affiliateFee) / 10000;
            _affiliateBalance[affiliate][tokenAddress] += affiliateWad;
            emit Referral(affiliate, tokenAddress, affiliateWad, quantity);
          }
          uint128 superAffiliateWad = 0;
          if (config.superAffiliatePayout != address(0)) {
            superAffiliateWad = ((value * config.platformFee) / 2) / 10000;
            _affiliateBalance[config.superAffiliatePayout][tokenAddress] += superAffiliateWad;
          }
          OwnerBalance memory balance = _ownerBalance[tokenAddress];
          uint128 platformWad = ((value * config.platformFee) / 10000) - superAffiliateWad;
          uint128 ownerWad = value - affiliateWad - platformWad - superAffiliateWad;
          _ownerBalance[tokenAddress] = OwnerBalance({
            owner: balance.owner + ownerWad,
            platform: balance.platform + platformWad
          });
          if (tokenAddress != address(0)) {
            IERC20Upgradeable erc20Token = IERC20Upgradeable(tokenAddress);
            erc20Token.transferFrom(msg.sender, address(this), value);
          }
        }
        function withdrawTokens(
          Config storage config,
          mapping(address => OwnerBalance) storage _ownerBalance,
          mapping(address => mapping(address => uint128)) storage _affiliateBalance,
          address owner,
          address[] calldata tokens
        ) public {
          for (uint256 i = 0; i < tokens.length; i++) {
            address tokenAddress = tokens[i];
            uint128 wad = 0;
            if (msg.sender == owner || msg.sender == config.ownerAltPayout || msg.sender == PLATFORM) {
              OwnerBalance storage balance = _ownerBalance[tokenAddress];
              if (msg.sender == owner || msg.sender == config.ownerAltPayout) {
                wad = balance.owner;
                balance.owner = 0;
              } else {
                wad = balance.platform;
                balance.platform = 0;
              }
            } else {
              wad = _affiliateBalance[msg.sender][tokenAddress];
              _affiliateBalance[msg.sender][tokenAddress] = 0;
            }
            if (wad == 0) {
              revert BalanceEmpty();
            }
            if (tokenAddress == address(0)) {
              bool success = false;
              // send to ownerAltPayout if set and owner is withdrawing
              if (msg.sender == owner && config.ownerAltPayout != address(0)) {
                (success, ) = payable(config.ownerAltPayout).call{ value: wad }("");
              } else {
                (success, ) = msg.sender.call{ value: wad }("");
              }
              if (!success) {
                revert TransferFailed();
              }
            } else {
              IERC20Upgradeable erc20Token = IERC20Upgradeable(tokenAddress);
              if (msg.sender == owner && config.ownerAltPayout != address(0)) {
                erc20Token.transfer(config.ownerAltPayout, wad);
              } else {
                erc20Token.transfer(msg.sender, wad);
              }
            }
            emit Withdrawal(msg.sender, tokenAddress, wad);
          }
        }
        function validateAffiliate(
          address affiliate,
          bytes calldata signature,
          address affiliateSigner
        ) public view {
          bytes32 signedMessagehash = ECDSA.toEthSignedMessageHash(
            keccak256(abi.encodePacked(affiliate))
          );
          address signer = ECDSA.recover(signedMessagehash, signature);
          if (signer != affiliateSigner) {
            revert InvalidSignature();
          }
        }
        function verify(
          Auth calldata auth,
          address tokenAddress,
          address account
        ) public pure returns (bool) {
          // keys 0-255 and tokenAddress are public
          if (uint256(auth.key) <= 0xff || auth.key == keccak256(abi.encodePacked(tokenAddress))) {
            return true;
          }
          return MerkleProofLib.verify(auth.proof, auth.key, keccak256(abi.encodePacked(account)));
        }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
      import 'erc721a-upgradeable/contracts/ERC721A__Initializable.sol';
      import 'erc721a-upgradeable/contracts/ERC721AUpgradeable.sol';
      pragma solidity ^0.8.4;
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract ERC721A__OwnableUpgradeable is ERC721A__Initializable, ERC721AUpgradeable {
          address private _owner;
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          function __Ownable_init() internal onlyInitializingERC721A {
              __Ownable_init_unchained();
          }
          function __Ownable_init_unchained() internal onlyInitializingERC721A {
              _transferOwnership(_msgSenderERC721A());
          }
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              _isOwner();
              _;
          }
          function _isOwner() internal view {
              require(owner() == _msgSenderERC721A(), "Ownable: caller is not the owner");
          }
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              _transferOwnership(address(0));
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              _transferOwnership(newOwner);
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Internal function without access restriction.
           */
          function _transferOwnership(address newOwner) internal virtual {
              address oldOwner = _owner;
              _owner = newOwner;
              emit OwnershipTransferred(oldOwner, newOwner);
          }
          /**
           * @dev This empty reserved space is put in place to allow future versions to add new
           * variables without shifting down storage in the inheritance chain.
           * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
           */
          uint256[49] private __gap;
      }
      // 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;
          }
      }
      // 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
              }
          }
      }
      // 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;
          }
          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
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v4.2.3
      // 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()`.
       *
       * 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();
          }
          // =============================================================
          //                   TOKEN COUNTING OPERATIONS
          // =============================================================
          /**
           * @dev Returns the starting token ID.
           * To change the starting token ID, please override this function.
           */
          function _startTokenId() internal view virtual returns (uint256) {
              return 0;
          }
          /**
           * @dev Returns the next token ID to be minted.
           */
          function _nextTokenId() internal view virtual returns (uint256) {
              return 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) {
              // Counter underflow is impossible as _burnCounter cannot be incremented
              // more than `_currentIndex - _startTokenId()` times.
              unchecked {
                  return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId();
              }
          }
          /**
           * @dev Returns the total amount of tokens minted in the contract.
           */
          function _totalMinted() internal view virtual returns (uint256) {
              // Counter underflow is impossible as `_currentIndex` does not decrement,
              // and it is initialized to `_startTokenId()`.
              unchecked {
                  return ERC721AStorage.layout()._currentIndex - _startTokenId();
              }
          }
          /**
           * @dev Returns the total number of tokens burned.
           */
          function _totalBurned() internal view virtual returns (uint256) {
              return ERC721AStorage.layout()._burnCounter;
          }
          // =============================================================
          //                    ADDRESS DATA OPERATIONS
          // =============================================================
          /**
           * @dev Returns the number of tokens in `owner`'s account.
           */
          function balanceOf(address owner) public view virtual override returns (uint256) {
              if (owner == address(0)) revert BalanceQueryForZeroAddress();
              return 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();
              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 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);
              }
          }
          /**
           * 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 not burned.
                  if (packed & _BITMASK_BURNED == 0) {
                      // If the data at the starting slot does not exist, start the scan.
                      if (packed == 0) {
                          if (tokenId >= ERC721AStorage.layout()._currentIndex) revert OwnerQueryForNonexistentToken();
                          // 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;
                              return packed;
                          }
                      }
                      // Otherwise, the data exists and is not burned. 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.
                      return packed;
                  }
              }
              revert OwnerQueryForNonexistentToken();
          }
          /**
           * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
           */
          function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
              ownership.addr = address(uint160(packed));
              ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
              ownership.burned = packed & _BITMASK_BURNED != 0;
              ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
          }
          /**
           * @dev Packs ownership data into a single uint256.
           */
          function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
              assembly {
                  // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  owner := and(owner, _BITMASK_ADDRESS)
                  // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
                  result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
              }
          }
          /**
           * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
           */
          function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
              // For branchless setting of the `nextInitialized` flag.
              assembly {
                  // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
                  result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
              }
          }
          // =============================================================
          //                      APPROVAL OPERATIONS
          // =============================================================
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account. 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();
              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) {
              return
                  _startTokenId() <= tokenId &&
                  tokenId < ERC721AStorage.layout()._currentIndex && // If within bounds,
                  ERC721AStorage.layout()._packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
          }
          /**
           * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
           */
          function _isSenderApprovedOrOwner(
              address approvedAddress,
              address owner,
              address msgSender
          ) private pure returns (bool result) {
              assembly {
                  // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  owner := and(owner, _BITMASK_ADDRESS)
                  // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
                  msgSender := and(msgSender, _BITMASK_ADDRESS)
                  // `msgSender == owner || msgSender == approvedAddress`.
                  result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
              }
          }
          /**
           * @dev Returns the storage slot and value for the approved address of `tokenId`.
           */
          function _getApprovedSlotAndAddress(uint256 tokenId)
              private
              view
              returns (uint256 approvedAddressSlot, address approvedAddress)
          {
              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);
              if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
              (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
              // The nested ifs save around 20+ gas over a compound boolean condition.
              if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                  if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
              if (to == address(0)) revert TransferToZeroAddress();
              _beforeTokenTransfers(from, to, tokenId, 1);
              // Clear approvals from the previous owner.
              assembly {
                  if approvedAddress {
                      // This is equivalent to `delete _tokenApprovals[tokenId]`.
                      sstore(approvedAddressSlot, 0)
                  }
              }
              // Underflow of the sender's balance is impossible because we check for
              // ownership above and the recipient's balance can't realistically overflow.
              // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
              unchecked {
                  // We can directly increment and decrement the balances.
                  --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;
                          }
                      }
                  }
              }
              emit Transfer(from, to, tokenId);
              _afterTokenTransfers(from, to, tokenId, 1);
          }
          /**
           * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public payable virtual override {
              safeTransferFrom(from, to, tokenId, '');
          }
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token
           * by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement
           * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) public payable virtual override {
              transferFrom(from, to, tokenId);
              if (to.code.length != 0)
                  if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                      revert TransferToNonERC721ReceiverImplementer();
                  }
          }
          /**
           * @dev Hook that is called before a set of serially-ordered token IDs
           * are about to be transferred. This includes minting.
           * And also called before burning one token.
           *
           * `startTokenId` - the first token ID to be transferred.
           * `quantity` - the amount to be transferred.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
           * transferred to `to`.
           * - When `from` is zero, `tokenId` will be minted for `to`.
           * - When `to` is zero, `tokenId` will be burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _beforeTokenTransfers(
              address from,
              address to,
              uint256 startTokenId,
              uint256 quantity
          ) internal virtual {}
          /**
           * @dev Hook that is called after a set of serially-ordered token IDs
           * have been transferred. This includes minting.
           * And also called after one token has been burned.
           *
           * `startTokenId` - the first token ID to be transferred.
           * `quantity` - the amount to be transferred.
           *
           * Calling conditions:
           *
           * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
           * transferred to `to`.
           * - When `from` is zero, `tokenId` has been minted for `to`.
           * - When `to` is zero, `tokenId` has been burned by `from`.
           * - `from` and `to` are never both zero.
           */
          function _afterTokenTransfers(
              address from,
              address to,
              uint256 startTokenId,
              uint256 quantity
          ) internal virtual {}
          /**
           * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
           *
           * `from` - Previous owner of the given token ID.
           * `to` - Target address that will receive the token.
           * `tokenId` - Token ID to be transferred.
           * `_data` - Optional data to send along with the call.
           *
           * Returns whether the call correctly returned the expected magic value.
           */
          function _checkContractOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) private returns (bool) {
              try
                  ERC721A__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();
                  } else {
                      assembly {
                          revert(add(32, reason), mload(reason))
                      }
                  }
              }
          }
          // =============================================================
          //                        MINT OPERATIONS
          // =============================================================
          /**
           * @dev Mints `quantity` tokens and transfers them to `to`.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `quantity` must be greater than 0.
           *
           * Emits a {Transfer} event for each mint.
           */
          function _mint(address to, uint256 quantity) internal virtual {
              uint256 startTokenId = ERC721AStorage.layout()._currentIndex;
              if (quantity == 0) revert MintZeroQuantity();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are incredibly unrealistic.
              // `balance` and `numberMinted` have a maximum limit of 2**64.
              // `tokenId` has a maximum limit of 2**256.
              unchecked {
                  // Updates:
                  // - `balance += quantity`.
                  // - `numberMinted += quantity`.
                  //
                  // We can directly add to the `balance` and `numberMinted`.
                  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)
                  );
                  uint256 toMasked;
                  uint256 end = startTokenId + quantity;
                  // Use assembly to loop and emit the `Transfer` event for gas savings.
                  // The duplicated `log4` removes an extra check and reduces stack juggling.
                  // The assembly, together with the surrounding Solidity code, have been
                  // delicately arranged to nudge the compiler into producing optimized opcodes.
                  assembly {
                      // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                      toMasked := and(to, _BITMASK_ADDRESS)
                      // Emit the `Transfer` event.
                      log4(
                          0, // Start of data (0, since no data).
                          0, // End of data (0, since no data).
                          _TRANSFER_EVENT_SIGNATURE, // Signature.
                          0, // `address(0)`.
                          toMasked, // `to`.
                          startTokenId // `tokenId`.
                      )
                      // The `iszero(eq(,))` check ensures that large values of `quantity`
                      // that overflows uint256 will make the loop run out of gas.
                      // The compiler will optimize the `iszero` away for performance.
                      for {
                          let tokenId := add(startTokenId, 1)
                      } iszero(eq(tokenId, end)) {
                          tokenId := add(tokenId, 1)
                      } {
                          // Emit the `Transfer` event. Similar to above.
                          log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                      }
                  }
                  if (toMasked == 0) revert MintToZeroAddress();
                  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();
              if (quantity == 0) revert MintZeroQuantity();
              if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
              unchecked {
                  // Updates:
                  // - `balance += quantity`.
                  // - `numberMinted += quantity`.
                  //
                  // We can directly add to the `balance` and `numberMinted`.
                  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)
                  );
                  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();
                          }
                      } while (index < end);
                      // Reentrancy protection.
                      if (ERC721AStorage.layout()._currentIndex != end) revert();
                  }
              }
          }
          /**
           * @dev Equivalent to `_safeMint(to, quantity, '')`.
           */
          function _safeMint(address to, uint256 quantity) internal virtual {
              _safeMint(to, quantity, '');
          }
          // =============================================================
          //                       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)
                  if (_msgSenderERC721A() != owner)
                      if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                          revert ApprovalCallerNotOwnerNorApproved();
                      }
              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();
              }
              _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 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();
              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)
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v4.2.3
      // 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();
          // =============================================================
          //                            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);
      }
      // SPDX-License-Identifier: MIT
      pragma solidity ^0.8.4;
      /// @notice Gas optimized ECDSA wrapper.
      /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ECDSA.sol)
      /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ECDSA.sol)
      /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol)
      library ECDSA {
          function recover(bytes32 hash, bytes calldata signature) internal view returns (address result) {
              assembly {
                  if eq(signature.length, 65) {
                      // Copy the free memory pointer so that we can restore it later.
                      let m := mload(0x40)
                      // Directly copy `r` and `s` from the calldata.
                      calldatacopy(0x40, signature.offset, 0x40)
                      // If `s` in lower half order, such that the signature is not malleable.
                      // prettier-ignore
                      if iszero(gt(mload(0x60), 0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0)) {
                          mstore(0x00, hash)
                          // Compute `v` and store it in the scratch space.
                          mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40))))
                          pop(
                              staticcall(
                                  gas(), // Amount of gas left for the transaction.
                                  0x01, // Address of `ecrecover`.
                                  0x00, // Start of input.
                                  0x80, // Size of input.
                                  0x40, // Start of output.
                                  0x20 // Size of output.
                              )
                          )
                          // Restore the zero slot.
                          mstore(0x60, 0)
                          // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
                          result := mload(sub(0x60, returndatasize()))
                      }
                      // Restore the free memory pointer.
                      mstore(0x40, m)
                  }
              }
          }
          function recover(
              bytes32 hash,
              bytes32 r,
              bytes32 vs
          ) internal view returns (address result) {
              assembly {
                  // Copy the free memory pointer so that we can restore it later.
                  let m := mload(0x40)
                  // prettier-ignore
                  let s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
                  // If `s` in lower half order, such that the signature is not malleable.
                  // prettier-ignore
                  if iszero(gt(s, 0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0)) {
                      mstore(0x00, hash)
                      mstore(0x20, add(shr(255, vs), 27))
                      mstore(0x40, r)
                      mstore(0x60, s)
                      pop(
                          staticcall(
                              gas(), // Amount of gas left for the transaction.
                              0x01, // Address of `ecrecover`.
                              0x00, // Start of input.
                              0x80, // Size of input.
                              0x40, // Start of output.
                              0x20 // Size of output.
                          )
                      )
                      // Restore the zero slot.
                      mstore(0x60, 0)
                      // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
                      result := mload(sub(0x60, returndatasize()))
                  }
                  // Restore the free memory pointer.
                  mstore(0x40, m)
              }
          }
          function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) {
              assembly {
                  // Store into scratch space for keccak256.
                  mstore(0x20, hash)
                  mstore(0x00, "\\x00\\x00\\x00\\x00\\x19Ethereum Signed Message:\
      32")
                  // 0x40 - 0x04 = 0x3c
                  result := keccak256(0x04, 0x3c)
              }
          }
          function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) {
              assembly {
                  // We need at most 128 bytes for Ethereum signed message header.
                  // The max length of the ASCII reprenstation of a uint256 is 78 bytes.
                  // The length of "\\x19Ethereum Signed Message:\
      " is 26 bytes (i.e. 0x1a).
                  // The next multiple of 32 above 78 + 26 is 128 (i.e. 0x80).
                  // Instead of allocating, we temporarily copy the 128 bytes before the
                  // start of `s` data to some variables.
                  let m3 := mload(sub(s, 0x60))
                  let m2 := mload(sub(s, 0x40))
                  let m1 := mload(sub(s, 0x20))
                  // The length of `s` is in bytes.
                  let sLength := mload(s)
                  let ptr := add(s, 0x20)
                  // `end` marks the end of the memory which we will compute the keccak256 of.
                  let end := add(ptr, sLength)
                  // Convert the length of the bytes to ASCII decimal representation
                  // and store it into the memory.
                  // prettier-ignore
                  for { let temp := sLength } 1 {} {
                      ptr := sub(ptr, 1)
                      mstore8(ptr, add(48, mod(temp, 10)))
                      temp := div(temp, 10)
                      // prettier-ignore
                      if iszero(temp) { break }
                  }
                  // Copy the header over to the memory.
                  mstore(sub(ptr, 0x20), "\\x00\\x00\\x00\\x00\\x00\\x00\\x19Ethereum Signed Message:\
      ")
                  // Compute the keccak256 of the memory.
                  result := keccak256(sub(ptr, 0x1a), sub(end, sub(ptr, 0x1a)))
                  // Restore the previous memory.
                  mstore(s, sLength)
                  mstore(sub(s, 0x20), m1)
                  mstore(sub(s, 0x40), m2)
                  mstore(sub(s, 0x60), m3)
              }
          }
      }
      // SPDX-License-Identifier: MIT
      pragma solidity ^0.8.4;
      /// @notice Library for converting numbers into strings and other string operations.
      /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/LibString.sol)
      /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/LibString.sol)
      library LibString {
          /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
          /*                        CUSTOM ERRORS                       */
          /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
          error HexLengthInsufficient();
          /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
          /*                     DECIMAL OPERATIONS                     */
          /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
          function toString(uint256 value) internal pure 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)
              }
          }
          /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
          /*                   HEXADECIMAL OPERATIONS                   */
          /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
          function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) {
              assembly {
                  let start := mload(0x40)
                  // We need 0x20 bytes for the trailing zeros padding, `length * 2` bytes
                  // for the digits, 0x02 bytes for the prefix, and 0x20 bytes for the length.
                  // We add 0x20 to the total and round down to a multiple of 0x20.
                  // (0x20 + 0x20 + 0x02 + 0x20) = 0x62.
                  let m := add(start, and(add(shl(1, length), 0x62), not(0x1f)))
                  // Allocate the memory.
                  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 to calculate the length later.
                  let end := str
                  // Store "0123456789abcdef" in scratch space.
                  mstore(0x0f, 0x30313233343536373839616263646566)
                  let temp := value
                  // 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 {} 1 {} {
                      str := sub(str, 2)
                      mstore8(add(str, 1), mload(and(temp, 15)))
                      mstore8(str, mload(and(shr(4, temp), 15)))
                      temp := shr(8, temp)
                      length := sub(length, 1)
                      // prettier-ignore
                      if iszero(length) { break }
                  }
                  if temp {
                      // Store the function selector of `HexLengthInsufficient()`.
                      mstore(0x00, 0x2194895a)
                      // Revert with (offset, size).
                      revert(0x1c, 0x04)
                  }
                  // Compute the string's length.
                  let strLength := add(sub(end, str), 2)
                  // Move the pointer and write the "0x" prefix.
                  str := sub(str, 0x20)
                  mstore(str, 0x3078)
                  // Move the pointer and write the length.
                  str := sub(str, 2)
                  mstore(str, strLength)
              }
          }
          function toHexString(uint256 value) internal pure returns (string memory str) {
              assembly {
                  let start := mload(0x40)
                  // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
                  // 0x02 bytes for the prefix, and 0x40 bytes for the digits.
                  // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x40) is 0xa0.
                  let m := add(start, 0xa0)
                  // Allocate the memory.
                  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 to calculate the length later.
                  let end := str
                  // Store "0123456789abcdef" in scratch space.
                  mstore(0x0f, 0x30313233343536373839616263646566)
                  // 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, 2)
                      mstore8(add(str, 1), mload(and(temp, 15)))
                      mstore8(str, mload(and(shr(4, temp), 15)))
                      temp := shr(8, temp)
                      // prettier-ignore
                      if iszero(temp) { break }
                  }
                  // Compute the string's length.
                  let strLength := add(sub(end, str), 2)
                  // Move the pointer and write the "0x" prefix.
                  str := sub(str, 0x20)
                  mstore(str, 0x3078)
                  // Move the pointer and write the length.
                  str := sub(str, 2)
                  mstore(str, strLength)
              }
          }
          function toHexString(address value) internal pure returns (string memory str) {
              assembly {
                  let start := mload(0x40)
                  // We need 0x20 bytes for the length, 0x02 bytes for the prefix,
                  // and 0x28 bytes for the digits.
                  // The next multiple of 0x20 above (0x20 + 0x02 + 0x28) is 0x60.
                  str := add(start, 0x60)
                  // Allocate the memory.
                  mstore(0x40, str)
                  // Store "0123456789abcdef" in scratch space.
                  mstore(0x0f, 0x30313233343536373839616263646566)
                  let length := 20
                  // 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, 2)
                      mstore8(add(str, 1), mload(and(temp, 15)))
                      mstore8(str, mload(and(shr(4, temp), 15)))
                      temp := shr(8, temp)
                      length := sub(length, 1)
                      // prettier-ignore
                      if iszero(length) { break }
                  }
                  // Move the pointer and write the "0x" prefix.
                  str := sub(str, 32)
                  mstore(str, 0x3078)
                  // Move the pointer and write the length.
                  str := sub(str, 2)
                  mstore(str, 42)
              }
          }
          /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
          /*                   OTHER STRING OPERATIONS                  */
          /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
          function replace(
              string memory subject,
              string memory search,
              string memory replacement
          ) internal pure returns (string memory result) {
              assembly {
                  let subjectLength := mload(subject)
                  let searchLength := mload(search)
                  let replacementLength := mload(replacement)
                  subject := add(subject, 0x20)
                  search := add(search, 0x20)
                  replacement := add(replacement, 0x20)
                  result := add(mload(0x40), 0x20)
                  let subjectEnd := add(subject, subjectLength)
                  if iszero(gt(searchLength, subjectLength)) {
                      let subjectSearchEnd := add(sub(subjectEnd, searchLength), 1)
                      let h := 0
                      if iszero(lt(searchLength, 32)) {
                          h := keccak256(search, searchLength)
                      }
                      let m := shl(3, sub(32, and(searchLength, 31)))
                      let s := mload(search)
                      // prettier-ignore
                      for {} 1 {} {
                          let t := mload(subject)
                          // Whether the first `searchLength % 32` bytes of 
                          // `subject` and `search` matches.
                          if iszero(shr(m, xor(t, s))) {
                              if h {
                                  if iszero(eq(keccak256(subject, searchLength), h)) {
                                      mstore(result, t)
                                      result := add(result, 1)
                                      subject := add(subject, 1)
                                      // prettier-ignore
                                      if iszero(lt(subject, subjectSearchEnd)) { break }
                                      continue
                                  }
                              }
                              // Copy the `replacement` one word at a time.
                              // prettier-ignore
                              for { let o := 0 } 1 {} {
                                  mstore(add(result, o), mload(add(replacement, o)))
                                  o := add(o, 0x20)
                                  // prettier-ignore
                                  if iszero(lt(o, replacementLength)) { break }
                              }
                              result := add(result, replacementLength)
                              subject := add(subject, searchLength)    
                              if iszero(searchLength) {
                                  mstore(result, t)
                                  result := add(result, 1)
                                  subject := add(subject, 1)
                              }
                              // prettier-ignore
                              if iszero(lt(subject, subjectSearchEnd)) { break }
                              continue
                          }
                          mstore(result, t)
                          result := add(result, 1)
                          subject := add(subject, 1)
                          // prettier-ignore
                          if iszero(lt(subject, subjectSearchEnd)) { break }
                      }
                  }
                  let resultRemainder := result
                  result := add(mload(0x40), 0x20)
                  let k := add(sub(resultRemainder, result), sub(subjectEnd, subject))
                  // Copy the rest of the string one word at a time.
                  // prettier-ignore
                  for {} lt(subject, subjectEnd) {} {
                      mstore(resultRemainder, mload(subject))
                      resultRemainder := add(resultRemainder, 0x20)
                      subject := add(subject, 0x20)
                  }
                  // Allocate memory for the length and the bytes,
                  // rounded up to a multiple of 32.
                  mstore(0x40, add(result, and(add(k, 0x40), not(0x1f))))
                  result := sub(result, 0x20)
                  mstore(result, k)
              }
          }
      }
      // SPDX-License-Identifier: MIT
      pragma solidity ^0.8.4;
      /// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree.
      /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)
      /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)
      /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)
      library MerkleProofLib {
          function verify(
              bytes32[] calldata proof,
              bytes32 root,
              bytes32 leaf
          ) internal pure returns (bool isValid) {
              assembly {
                  if proof.length {
                      // Left shift by 5 is equivalent to multiplying by 0x20.
                      let end := add(proof.offset, shl(5, proof.length))
                      // Initialize `offset` to the offset of `proof` in the calldata.
                      let offset := proof.offset
                      // Iterate over proof elements to compute root hash.
                      // prettier-ignore
                      for {} 1 {} {
                          // Slot of `leaf` in scratch space.
                          // If the condition is true: 0x20, otherwise: 0x00.
                          let scratch := shl(5, gt(leaf, calldataload(offset)))
                          // Store elements to hash contiguously in scratch space.
                          // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
                          mstore(scratch, leaf)
                          mstore(xor(scratch, 0x20), calldataload(offset))
                          // Reuse `leaf` to store the hash to reduce stack operations.
                          leaf := keccak256(0x00, 0x40)
                          offset := add(offset, 0x20)
                          // prettier-ignore
                          if iszero(lt(offset, end)) { break }
                      }
                  }
                  isValid := eq(leaf, root)
              }
          }
          function verifyMultiProof(
              bytes32[] calldata proof,
              bytes32 root,
              bytes32[] calldata leafs,
              bool[] calldata flags
          ) internal pure returns (bool isValid) {
              // Rebuilds the root by consuming and producing values on a queue.
              // The queue starts with the `leafs` array, and goes into a `hashes` array.
              // After the process, the last element on the queue is verified
              // to be equal to the `root`.
              //
              // The `flags` array denotes whether the sibling
              // should be popped from the queue (`flag == true`), or
              // should be popped from the `proof` (`flag == false`).
              assembly {
                  // If the number of flags is correct.
                  // prettier-ignore
                  for {} eq(add(leafs.length, proof.length), add(flags.length, 1)) {} {
                      // Left shift by 5 is equivalent to multiplying by 0x20.
                      // Compute the end calldata offset of `leafs`.
                      let leafsEnd := add(leafs.offset, shl(5, leafs.length))
                      // These are the calldata offsets.
                      let leafsOffset := leafs.offset
                      let flagsOffset := flags.offset
                      let proofOffset := proof.offset
                      // We can use the free memory space for the queue.
                      // We don't need to allocate, since the queue is temporary.
                      let hashesFront := mload(0x40)
                      let hashesBack := hashesFront
                      // This is the end of the memory for the queue.
                      let end := add(hashesBack, shl(5, flags.length))
                      // For the case where `proof.length + leafs.length == 1`.
                      if iszero(flags.length) {
                          // If `proof.length` is zero, `leafs.length` is 1.
                          if iszero(proof.length) {
                              isValid := eq(calldataload(leafsOffset), root)
                              break
                          }
                          // If `leafs.length` is zero, `proof.length` is 1.
                          if iszero(leafs.length) {
                              isValid := eq(calldataload(proofOffset), root)
                              break
                          }
                      }
                      // prettier-ignore
                      for {} 1 {} {
                          let a := 0
                          // Pops a value from the queue into `a`.
                          switch lt(leafsOffset, leafsEnd)
                          case 0 {
                              // Pop from `hashes` if there are no more leafs.
                              a := mload(hashesFront)
                              hashesFront := add(hashesFront, 0x20)
                          }
                          default {
                              // Otherwise, pop from `leafs`.
                              a := calldataload(leafsOffset)
                              leafsOffset := add(leafsOffset, 0x20)
                          }
                          let b := 0
                          // If the flag is false, load the next proof,
                          // else, pops from the queue.
                          switch calldataload(flagsOffset)
                          case 0 {
                              // Loads the next proof.
                              b := calldataload(proofOffset)
                              proofOffset := add(proofOffset, 0x20)
                          }
                          default {
                              // Pops a value from the queue into `a`.
                              switch lt(leafsOffset, leafsEnd)
                              case 0 {
                                  // Pop from `hashes` if there are no more leafs.
                                  b := mload(hashesFront)
                                  hashesFront := add(hashesFront, 0x20)
                              }
                              default {
                                  // Otherwise, pop from `leafs`.
                                  b := calldataload(leafsOffset)
                                  leafsOffset := add(leafsOffset, 0x20)
                              }
                          }
                          // Advance to the next flag offset.
                          flagsOffset := add(flagsOffset, 0x20)
                          // Slot of `a` in scratch space.
                          // If the condition is true: 0x20, otherwise: 0x00.
                          let scratch := shl(5, gt(a, b))
                          // Hash the scratch space and push the result onto the queue.
                          mstore(scratch, a)
                          mstore(xor(scratch, 0x20), b)
                          mstore(hashesBack, keccak256(0x00, 0x40))
                          hashesBack := add(hashesBack, 0x20)
                          // prettier-ignore
                          if iszero(lt(hashesBack, end)) { break }
                      }
                      // Checks if the last value in the queue is same as the root.
                      isValid := eq(mload(sub(hashesBack, 0x20)), root)
                      break
                  }
              }
          }
      }
      

      File 6 of 10: MiladyAura
      // SPDX-License-Identifier: MIT
      // File: @openzeppelin/contracts/utils/Counters.sol
      // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
      pragma solidity ^0.8.0;
      /**
       * @title Counters
       * @author Matt Condon (@shrugs)
       * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
       * of elements in a mapping, issuing ERC721 ids, or counting request ids.
       *
       * Include with `using Counters for Counters.Counter;`
       */
      library Counters {
          struct Counter {
              // This variable should never be directly accessed by users of the library: interactions must be restricted to
              // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
              // this feature: see https://github.com/ethereum/solidity/issues/4637
              uint256 _value; // default: 0
          }
          function current(Counter storage counter) internal view returns (uint256) {
              return counter._value;
          }
          function increment(Counter storage counter) internal {
              unchecked {
                  counter._value += 1;
              }
          }
          function decrement(Counter storage counter) internal {
              uint256 value = counter._value;
              require(value > 0, "Counter: decrement overflow");
              unchecked {
                  counter._value = value - 1;
              }
          }
          function reset(Counter storage counter) internal {
              counter._value = 0;
          }
      }
      // File: @openzeppelin/contracts/utils/Strings.sol
      // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev String operations.
       */
      library Strings {
          bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
          /**
           * @dev Converts a `uint256` to its ASCII `string` decimal representation.
           */
          function toString(uint256 value) internal pure returns (string memory) {
              // Inspired by OraclizeAPI's implementation - MIT licence
              // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
              if (value == 0) {
                  return "0";
              }
              uint256 temp = value;
              uint256 digits;
              while (temp != 0) {
                  digits++;
                  temp /= 10;
              }
              bytes memory buffer = new bytes(digits);
              while (value != 0) {
                  digits -= 1;
                  buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
                  value /= 10;
              }
              return string(buffer);
          }
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
           */
          function toHexString(uint256 value) internal pure returns (string memory) {
              if (value == 0) {
                  return "0x00";
              }
              uint256 temp = value;
              uint256 length = 0;
              while (temp != 0) {
                  length++;
                  temp >>= 8;
              }
              return toHexString(value, length);
          }
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
           */
          function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
              bytes memory buffer = new bytes(2 * length + 2);
              buffer[0] = "0";
              buffer[1] = "x";
              for (uint256 i = 2 * length + 1; i > 1; --i) {
                  buffer[i] = _HEX_SYMBOLS[value & 0xf];
                  value >>= 4;
              }
              require(value == 0, "Strings: hex length insufficient");
              return string(buffer);
          }
      }
      // File: @openzeppelin/contracts/utils/Context.sol
      // OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Provides information about the current execution context, including the
       * sender of the transaction and its data. While these are generally available
       * via msg.sender and msg.data, they should not be accessed in such a direct
       * manner, since when dealing with meta-transactions the account sending and
       * paying for execution may not be the actual sender (as far as an application
       * is concerned).
       *
       * This contract is only required for intermediate, library-like contracts.
       */
      abstract contract Context {
          function _msgSender() internal view virtual returns (address) {
              return msg.sender;
          }
          function _msgData() internal view virtual returns (bytes calldata) {
              return msg.data;
          }
      }
      // File: @openzeppelin/contracts/access/Ownable.sol
      // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract Ownable is Context {
          address private _owner;
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          constructor() {
              _transferOwnership(_msgSender());
          }
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              require(owner() == _msgSender(), "Ownable: caller is not the owner");
              _;
          }
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              _transferOwnership(address(0));
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              _transferOwnership(newOwner);
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Internal function without access restriction.
           */
          function _transferOwnership(address newOwner) internal virtual {
              address oldOwner = _owner;
              _owner = newOwner;
              emit OwnershipTransferred(oldOwner, newOwner);
          }
      }
      // File: @openzeppelin/contracts/utils/Address.sol
      // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
      pragma solidity ^0.8.1;
      /**
       * @dev Collection of functions related to the address type
       */
      library Address {
          /**
           * @dev Returns true if `account` is a contract.
           *
           * [IMPORTANT]
           * ====
           * It is unsafe to assume that an address for which this function returns
           * false is an externally-owned account (EOA) and not a contract.
           *
           * Among others, `isContract` will return false for the following
           * types of addresses:
           *
           *  - an externally-owned account
           *  - a contract in construction
           *  - an address where a contract will be created
           *  - an address where a contract lived, but was destroyed
           * ====
           *
           * [IMPORTANT]
           * ====
           * You shouldn't rely on `isContract` to protect against flash loan attacks!
           *
           * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
           * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
           * constructor.
           * ====
           */
          function isContract(address account) internal view returns (bool) {
              // This method relies on extcodesize/address.code.length, which returns 0
              // for contracts in construction, since the code is only stored at the end
              // of the constructor execution.
              return account.code.length > 0;
          }
          /**
           * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
           * `recipient`, forwarding all available gas and reverting on errors.
           *
           * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
           * of certain opcodes, possibly making contracts go over the 2300 gas limit
           * imposed by `transfer`, making them unable to receive funds via
           * `transfer`. {sendValue} removes this limitation.
           *
           * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
           *
           * IMPORTANT: because control is transferred to `recipient`, care must be
           * taken to not create reentrancy vulnerabilities. Consider using
           * {ReentrancyGuard} or the
           * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
           */
          function sendValue(address payable recipient, uint256 amount) internal {
              require(address(this).balance >= amount, "Address: insufficient balance");
              (bool success, ) = recipient.call{value: amount}("");
              require(success, "Address: unable to send value, recipient may have reverted");
          }
          /**
           * @dev Performs a Solidity function call using a low level `call`. A
           * plain `call` is an unsafe replacement for a function call: use this
           * function instead.
           *
           * If `target` reverts with a revert reason, it is bubbled up by this
           * function (like regular Solidity function calls).
           *
           * Returns the raw returned data. To convert to the expected return value,
           * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
           *
           * Requirements:
           *
           * - `target` must be a contract.
           * - calling `target` with `data` must not revert.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionCall(target, data, "Address: low-level call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
           * `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but also transferring `value` wei to `target`.
           *
           * Requirements:
           *
           * - the calling contract must have an ETH balance of at least `value`.
           * - the called Solidity function must be `payable`.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
          }
          /**
           * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
           * with `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(address(this).balance >= value, "Address: insufficient balance for call");
              require(isContract(target), "Address: call to non-contract");
              (bool success, bytes memory returndata) = target.call{value: value}(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
              return functionStaticCall(target, data, "Address: low-level static call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              require(isContract(target), "Address: static call to non-contract");
              (bool success, bytes memory returndata) = target.staticcall(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionDelegateCall(target, data, "Address: low-level delegate call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(isContract(target), "Address: delegate call to non-contract");
              (bool success, bytes memory returndata) = target.delegatecall(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
           * revert reason using the provided one.
           *
           * _Available since v4.3._
           */
          function verifyCallResult(
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal pure returns (bytes memory) {
              if (success) {
                  return returndata;
              } else {
                  // Look for revert reason and bubble it up if present
                  if (returndata.length > 0) {
                      // The easiest way to bubble the revert reason is using memory via assembly
                      assembly {
                          let returndata_size := mload(returndata)
                          revert(add(32, returndata), returndata_size)
                      }
                  } else {
                      revert(errorMessage);
                  }
              }
          }
      }
      // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
      pragma solidity ^0.8.0;
      /**
       * @title ERC721 token receiver interface
       * @dev Interface for any contract that wants to support safeTransfers
       * from ERC721 asset contracts.
       */
      interface IERC721Receiver {
          /**
           * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
           * by `operator` from `from`, this function is called.
           *
           * It must return its Solidity selector to confirm the token transfer.
           * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
           *
           * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
           */
          function onERC721Received(
              address operator,
              address from,
              uint256 tokenId,
              bytes calldata data
          ) external returns (bytes4);
      }
      // File: @openzeppelin/contracts/utils/introspection/IERC165.sol
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165 {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      // File: @openzeppelin/contracts/utils/introspection/ERC165.sol
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Implementation of the {IERC165} interface.
       *
       * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
       * for the additional interface id that will be supported. For example:
       *
       * ```solidity
       * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
       *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
       * }
       * ```
       *
       * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
       */
      abstract contract ERC165 is IERC165 {
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              return interfaceId == type(IERC165).interfaceId;
          }
      }
      // File: @openzeppelin/contracts/token/ERC721/IERC721.sol
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Required interface of an ERC721 compliant contract.
       */
      interface IERC721 is IERC165 {
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
          /**
           * @dev Returns the number of tokens in ``owner``'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, 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
          ) external;
          /**
           * @dev Transfers `tokenId` token 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;
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external;
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
          /**
           * @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 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);
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes calldata data
          ) external;
      }
      // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
      pragma solidity ^0.8.0;
      /**
       * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
       * @dev See https://eips.ethereum.org/EIPS/eip-721
       */
      interface IERC721Metadata is IERC721 {
          /**
           * @dev Returns the token collection name.
           */
          function name() external view returns (string memory);
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() external view returns (string memory);
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) external view returns (string memory);
      }
      // File: @openzeppelin/contracts/token/ERC721/ERC721.sol
      // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
       * the Metadata extension, but not including the Enumerable extension, which is available separately as
       * {ERC721Enumerable}.
       */
      contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
          using Address for address;
          using Strings for uint256;
          // Token name
          string private _name;
          // Token symbol
          string private _symbol;
          // Mapping from token ID to owner address
          mapping(uint256 => address) private _owners;
          // Mapping owner address to token count
          mapping(address => uint256) private _balances;
          // Mapping from token ID to approved address
          mapping(uint256 => address) private _tokenApprovals;
          // Mapping from owner to operator approvals
          mapping(address => mapping(address => bool)) private _operatorApprovals;
          /**
           * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
           */
          constructor(string memory name_, string memory symbol_) {
              _name = name_;
              _symbol = symbol_;
          }
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
              return
                  interfaceId == type(IERC721).interfaceId ||
                  interfaceId == type(IERC721Metadata).interfaceId ||
                  super.supportsInterface(interfaceId);
          }
          /**
           * @dev See {IERC721-balanceOf}.
           */
          function balanceOf(address owner) public view virtual override returns (uint256) {
              require(owner != address(0), "ERC721: balance query for the zero address");
              return _balances[owner];
          }
          /**
           * @dev See {IERC721-ownerOf}.
           */
          function ownerOf(uint256 tokenId) public view virtual override returns (address) {
              address owner = _owners[tokenId];
              require(owner != address(0), "ERC721: owner query for nonexistent token");
              return owner;
          }
          /**
           * @dev See {IERC721Metadata-name}.
           */
          function name() public view virtual override returns (string memory) {
              return _name;
          }
          /**
           * @dev See {IERC721Metadata-symbol}.
           */
          function symbol() public view virtual override returns (string memory) {
              return _symbol;
          }
          /**
           * @dev See {IERC721Metadata-tokenURI}.
           */
          function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
              require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
              string memory baseURI = _baseURI();
              return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
          }
          /**
           * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
           * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
           * by default, can be overriden in child contracts.
           */
          function _baseURI() internal view virtual returns (string memory) {
              return "";
          }
          /**
           * @dev See {IERC721-approve}.
           */
          function approve(address to, uint256 tokenId) public virtual override {
              address owner = ERC721.ownerOf(tokenId);
              require(to != owner, "ERC721: approval to current owner");
              require(
                  _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
                  "ERC721: approve caller is not owner nor approved for all"
              );
              _approve(to, tokenId);
          }
          /**
           * @dev See {IERC721-getApproved}.
           */
          function getApproved(uint256 tokenId) public view virtual override returns (address) {
              require(_exists(tokenId), "ERC721: approved query for nonexistent token");
              return _tokenApprovals[tokenId];
          }
          /**
           * @dev See {IERC721-setApprovalForAll}.
           */
          function setApprovalForAll(address operator, bool approved) public virtual override {
              _setApprovalForAll(_msgSender(), operator, approved);
          }
          /**
           * @dev See {IERC721-isApprovedForAll}.
           */
          function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
              return _operatorApprovals[owner][operator];
          }
          /**
           * @dev See {IERC721-transferFrom}.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              //solhint-disable-next-line max-line-length
              require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
              _transfer(from, to, tokenId);
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              safeTransferFrom(from, to, tokenId, "");
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) public virtual override {
              require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
              _safeTransfer(from, to, tokenId, _data);
          }
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
           * are aware of the ERC721 protocol to prevent tokens from being forever locked.
           *
           * `_data` is additional data, it has no specified format and it is sent in call to `to`.
           *
           * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
           * implement alternative mechanisms to perform token transfer, such as signature-based.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function _safeTransfer(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) internal virtual {
              _transfer(from, to, tokenId);
              require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
          }
          /**
           * @dev Returns whether `tokenId` exists.
           *
           * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
           *
           * Tokens start existing when they are minted (`_mint`),
           * and stop existing when they are burned (`_burn`).
           */
          function _exists(uint256 tokenId) internal view virtual returns (bool) {
              return _owners[tokenId] != address(0);
          }
          /**
           * @dev Returns whether `spender` is allowed to manage `tokenId`.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
              require(_exists(tokenId), "ERC721: operator query for nonexistent token");
              address owner = ERC721.ownerOf(tokenId);
              return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
          }
          /**
           * @dev Safely mints `tokenId` and transfers it to `to`.
           *
           * Requirements:
           *
           * - `tokenId` must not exist.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function _safeMint(address to, uint256 tokenId) internal virtual {
              _safeMint(to, tokenId, "");
          }
          /**
           * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
           * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
           */
          function _safeMint(
              address to,
              uint256 tokenId,
              bytes memory _data
          ) internal virtual {
              _mint(to, tokenId);
              require(
                  _checkOnERC721Received(address(0), to, tokenId, _data),
                  "ERC721: transfer to non ERC721Receiver implementer"
              );
          }
          /**
           * @dev Mints `tokenId` and transfers it to `to`.
           *
           * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
           *
           * Requirements:
           *
           * - `tokenId` must not exist.
           * - `to` cannot be the zero address.
           *
           * Emits a {Transfer} event.
           */
          function _mint(address to, uint256 tokenId) internal virtual {
              require(to != address(0), "ERC721: mint to the zero address");
              require(!_exists(tokenId), "ERC721: token already minted");
              _beforeTokenTransfer(address(0), to, tokenId);
              _balances[to] += 1;
              _owners[tokenId] = to;
              emit Transfer(address(0), to, tokenId);
              _afterTokenTransfer(address(0), to, tokenId);
          }
          /**
           * @dev Destroys `tokenId`.
           * The approval is cleared when the token is burned.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           *
           * Emits a {Transfer} event.
           */
          function _burn(uint256 tokenId) internal virtual {
              address owner = ERC721.ownerOf(tokenId);
              _beforeTokenTransfer(owner, address(0), tokenId);
              // Clear approvals
              _approve(address(0), tokenId);
              _balances[owner] -= 1;
              delete _owners[tokenId];
              emit Transfer(owner, address(0), tokenId);
              _afterTokenTransfer(owner, address(0), tokenId);
          }
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           *
           * Emits a {Transfer} event.
           */
          function _transfer(
              address from,
              address to,
              uint256 tokenId
          ) internal virtual {
              require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
              require(to != address(0), "ERC721: transfer to the zero address");
              _beforeTokenTransfer(from, to, tokenId);
              // Clear approvals from the previous owner
              _approve(address(0), tokenId);
              _balances[from] -= 1;
              _balances[to] += 1;
              _owners[tokenId] = to;
              emit Transfer(from, to, tokenId);
              _afterTokenTransfer(from, to, tokenId);
          }
          /**
           * @dev Approve `to` to operate on `tokenId`
           *
           * Emits a {Approval} event.
           */
          function _approve(address to, uint256 tokenId) internal virtual {
              _tokenApprovals[tokenId] = to;
              emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
          }
          /**
           * @dev Approve `operator` to operate on all of `owner` tokens
           *
           * Emits a {ApprovalForAll} event.
           */
          function _setApprovalForAll(
              address owner,
              address operator,
              bool approved
          ) internal virtual {
              require(owner != operator, "ERC721: approve to caller");
              _operatorApprovals[owner][operator] = approved;
              emit ApprovalForAll(owner, operator, approved);
          }
          /**
           * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
           * The call is not executed if the target address is not a contract.
           *
           * @param from address representing the previous owner of the given token ID
           * @param to target address that will receive the tokens
           * @param tokenId uint256 ID of the token to be transferred
           * @param _data bytes optional data to send along with the call
           * @return bool whether the call correctly returned the expected magic value
           */
          function _checkOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) private returns (bool) {
              if (to.isContract()) {
                  try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                      return retval == IERC721Receiver.onERC721Received.selector;
                  } catch (bytes memory reason) {
                      if (reason.length == 0) {
                          revert("ERC721: transfer to non ERC721Receiver implementer");
                      } else {
                          assembly {
                              revert(add(32, reason), mload(reason))
                          }
                      }
                  }
              } else {
                  return true;
              }
          }
          /**
           * @dev Hook that is called before any token transfer. This includes minting
           * and burning.
           *
           * 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, ``from``'s `tokenId` will be burned.
           * - `from` and `to` are never both zero.
           *
           * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
           */
          function _beforeTokenTransfer(
              address from,
              address to,
              uint256 tokenId
          ) internal virtual {}
          /**
           * @dev Hook that is called after any transfer of tokens. This includes
           * minting and burning.
           *
           * Calling conditions:
           *
           * - when `from` and `to` are both non-zero.
           * - `from` and `to` are never both zero.
           *
           * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
           */
          function _afterTokenTransfer(
              address from,
              address to,
              uint256 tokenId
          ) internal virtual {}
      }
      // File: contracts/MiladyAura.sol
      pragma solidity >=0.7.0 <0.9.0;
      contract MiladyAura is ERC721, Ownable {
        using Strings for uint256;
        using Counters for Counters.Counter;
        Counters.Counter private supply;
        string public uriPrefix = "";
        string public uriSuffix = ".json";
        string public hiddenMetadataUri;
        
        uint256 public cost = 0.033 ether;
        uint256 public maxSupply = 1888;
        uint256 public maxMintAmountPerTx = 100;
        bool public paused = true;
        bool public revealed = false;
        constructor() ERC721("MiladyAura", "AURA") {
          setHiddenMetadataUri("ipfs://__CID__/hidden.json");
        }
        modifier mintCompliance(uint256 _mintAmount) {
          require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, "Invalid mint amount!");
          require(supply.current() + _mintAmount <= maxSupply, "Max supply exceeded!");
          _;
        }
        function totalSupply() public view returns (uint256) {
          return supply.current();
        }
        function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) {
          require(!paused, "The contract is paused!");
          require(msg.value >= cost * _mintAmount, "Insufficient funds!");
          _mintLoop(msg.sender, _mintAmount);
        }
        
        function mintForAddress(uint256 _mintAmount, address _receiver) public mintCompliance(_mintAmount) onlyOwner {
          _mintLoop(_receiver, _mintAmount);
        }
        function walletOfOwner(address _owner)
          public
          view
          returns (uint256[] memory)
        {
          uint256 ownerTokenCount = balanceOf(_owner);
          uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount);
          uint256 currentTokenId = 1;
          uint256 ownedTokenIndex = 0;
          while (ownedTokenIndex < ownerTokenCount && currentTokenId <= maxSupply) {
            address currentTokenOwner = ownerOf(currentTokenId);
            if (currentTokenOwner == _owner) {
              ownedTokenIds[ownedTokenIndex] = currentTokenId;
              ownedTokenIndex++;
            }
            currentTokenId++;
          }
          return ownedTokenIds;
        }
        function tokenURI(uint256 _tokenId)
          public
          view
          virtual
          override
          returns (string memory)
        {
          require(
            _exists(_tokenId),
            "ERC721Metadata: URI query for nonexistent token"
          );
          if (revealed == false) {
            return hiddenMetadataUri;
          }
          string memory currentBaseURI = _baseURI();
          return bytes(currentBaseURI).length > 0
              ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriSuffix))
              : "";
        }
        function setRevealed(bool _state) public onlyOwner {
          revealed = _state;
        }
        function setCost(uint256 _cost) public onlyOwner {
          cost = _cost;
        }
        function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner {
          maxMintAmountPerTx = _maxMintAmountPerTx;
        }
        function setHiddenMetadataUri(string memory _hiddenMetadataUri) public onlyOwner {
          hiddenMetadataUri = _hiddenMetadataUri;
        }
        function setUriPrefix(string memory _uriPrefix) public onlyOwner {
          uriPrefix = _uriPrefix;
        }
        function setUriSuffix(string memory _uriSuffix) public onlyOwner {
          uriSuffix = _uriSuffix;
        }
        function setPaused(bool _state) public onlyOwner {
          paused = _state;
        }
        function withdraw() public onlyOwner {
          (bool os, ) = payable(owner()).call{value: address(this).balance}("");
          require(os);
          // =============================================================================
        }
        function _mintLoop(address _receiver, uint256 _mintAmount) internal {
          for (uint256 i = 0; i < _mintAmount; i++) {
            supply.increment();
            _safeMint(_receiver, supply.current());
          }
        }
        function _baseURI() internal view virtual override returns (string memory) {
          return uriPrefix;
        }
      }

      File 7 of 10: WHITEHEARTS
      // SPDX-License-Identifier: MIT
      pragma solidity >=0.8.9 <0.9.0;
      import 'erc721a/contracts/extensions/ERC721AQueryable.sol';
      import '@openzeppelin/contracts/access/Ownable.sol';
      import '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';
      import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
      contract WHITEHEARTS is ERC721AQueryable, Ownable, ReentrancyGuard {
        using Strings for uint256;
        bytes32 public merkleRoot;
        mapping(address => bool) public whitelistClaimed;
        mapping(address => uint8) public _allowList;
        string public uriPrefix = '';
        string public uriSuffix = '.json';
        string public hiddenMetadataUri;
        
        uint256 public cost;
        uint256 public maxSupply;
        uint256 public maxMintAmountPerTx;
        bool public paused = true;
        bool public whitelistMintEnabled = false;
        bool public revealed = false;
        bool public isAllowListActive = false;
        constructor(
          string memory _tokenName,
          string memory _tokenSymbol,
          uint256 _cost,
          uint256 _maxSupply,
          uint256 _maxMintAmountPerTx,
          string memory _hiddenMetadataUri
        ) ERC721A(_tokenName, _tokenSymbol) {
          setCost(_cost);
          maxSupply = _maxSupply;
          setMaxMintAmountPerTx(_maxMintAmountPerTx);
          setHiddenMetadataUri(_hiddenMetadataUri);
        }
        modifier mintCompliance(uint256 _mintAmount) {
          require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, 'Invalid mint amount!');
          require(totalSupply() + _mintAmount <= maxSupply, 'Max supply exceeded!');
          _;
        }
        modifier mintPriceCompliance(uint256 _mintAmount) {
          require(msg.value >= cost * _mintAmount, 'Insufficient funds!');
          _;
        }
        function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
          // Verify whitelist requirements
          require(whitelistMintEnabled, 'The whitelist sale is not enabled!');
          require(!whitelistClaimed[_msgSender()], 'Address already claimed!');
          bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));
          require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), 'Invalid proof!');
          whitelistClaimed[_msgSender()] = true;
          _safeMint(_msgSender(), _mintAmount);
        }
        function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
          require(!paused, 'The contract is paused!');
          _safeMint(_msgSender(), _mintAmount);
        }
        
        function mintForAddress(uint256 _mintAmount, address _receiver) public mintCompliance(_mintAmount) onlyOwner {
          _safeMint(_receiver, _mintAmount);
        }
        
        function mintAllowList(uint8 numberOfTokens) external payable {
          uint256 ts = totalSupply();
          require(isAllowListActive, "Allow list is not active");
          require(numberOfTokens <= _allowList[msg.sender], "Exceeded max available to purchase");
          require(ts + numberOfTokens <= maxSupply, "Purchase would exceed max tokens");
          _allowList[msg.sender] -= numberOfTokens;
          _safeMint(msg.sender, numberOfTokens);
      }
      function setAllowList(address[] calldata addresses, uint8[] calldata numAllowedToMint) external onlyOwner {
          for (uint i = 0; i < addresses.length; i++) {
      \t_allowList[addresses[i]] = numAllowedToMint[i];
          }
      }
      function setAllowlistMintEnabled(bool _state) public onlyOwner {
          isAllowListActive = _state;
      }
        function _startTokenId() internal view virtual override returns (uint256) {
          return 1;
        }
        function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
          require(_exists(_tokenId), 'ERC721Metadata: URI query for nonexistent token');
          if (revealed == false) {
            return hiddenMetadataUri;
          }
          string memory currentBaseURI = _baseURI();
          return bytes(currentBaseURI).length > 0
              ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriSuffix))
              : '';
        }
        function setRevealed(bool _state) public onlyOwner {
          revealed = _state;
        }
        function setCost(uint256 _cost) public onlyOwner {
          cost = _cost;
        }
        function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner {
          maxMintAmountPerTx = _maxMintAmountPerTx;
        }
        function setHiddenMetadataUri(string memory _hiddenMetadataUri) public onlyOwner {
          hiddenMetadataUri = _hiddenMetadataUri;
        }
        function setUriPrefix(string memory _uriPrefix) public onlyOwner {
          uriPrefix = _uriPrefix;
        }
        function setUriSuffix(string memory _uriSuffix) public onlyOwner {
          uriSuffix = _uriSuffix;
        }
        function setPaused(bool _state) public onlyOwner {
          paused = _state;
        }
        function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner {
          merkleRoot = _merkleRoot;
        }
        function setWhitelistMintEnabled(bool _state) public onlyOwner {
          whitelistMintEnabled = _state;
        }
        function withdraw() public onlyOwner nonReentrant {
         
          // This will transfer the remaining contract balance to the owner.
          // Do not remove this otherwise you will not be able to withdraw the funds.
          // =============================================================================
          (bool os, ) = payable(owner()).call{value: address(this).balance}('');
          require(os);
          // =============================================================================
        }
        function _baseURI() internal view virtual override returns (string memory) {
          return uriPrefix;
        }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Contract module that helps prevent reentrant calls to a function.
       *
       * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
       * available, which can be applied to functions to make sure there are no nested
       * (reentrant) calls to them.
       *
       * Note that because there is a single `nonReentrant` guard, functions marked as
       * `nonReentrant` may not call one another. This can be worked around by making
       * those functions `private`, and then adding `external` `nonReentrant` entry
       * points to them.
       *
       * TIP: If you would like to learn more about reentrancy and alternative ways
       * to protect against it, check out our blog post
       * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
       */
      abstract contract ReentrancyGuard {
          // Booleans are more expensive than uint256 or any type that takes up a full
          // word because each write operation emits an extra SLOAD to first read the
          // slot's contents, replace the bits taken up by the boolean, and then write
          // back. This is the compiler's defense against contract upgrades and
          // pointer aliasing, and it cannot be disabled.
          // The values being non-zero value makes deployment a bit more expensive,
          // but in exchange the refund on every call to nonReentrant will be lower in
          // amount. Since refunds are capped to a percentage of the total
          // transaction's gas, it is best to keep them low in cases like this one, to
          // increase the likelihood of the full refund coming into effect.
          uint256 private constant _NOT_ENTERED = 1;
          uint256 private constant _ENTERED = 2;
          uint256 private _status;
          constructor() {
              _status = _NOT_ENTERED;
          }
          /**
           * @dev Prevents a contract from calling itself, directly or indirectly.
           * Calling a `nonReentrant` function from another `nonReentrant`
           * function is not supported. It is possible to prevent this from happening
           * by making the `nonReentrant` function external, and making it call a
           * `private` function that does the actual work.
           */
          modifier nonReentrant() {
              // On the first call to nonReentrant, _notEntered will be true
              require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
              // Any calls to nonReentrant after this point will fail
              _status = _ENTERED;
              _;
              // By storing the original value once again, a refund is triggered (see
              // https://eips.ethereum.org/EIPS/eip-2200)
              _status = _NOT_ENTERED;
          }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import './IERC721AQueryable.sol';
      import '../ERC721A.sol';
      /**
       * @title ERC721A Queryable
       * @dev ERC721A subclass with convenience query functions.
       */
      abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
          /**
           * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
           *
           * If the `tokenId` is out of bounds:
           *   - `addr` = `address(0)`
           *   - `startTimestamp` = `0`
           *   - `burned` = `false`
           *
           * If the `tokenId` is burned:
           *   - `addr` = `<Address of owner before token was burned>`
           *   - `startTimestamp` = `<Timestamp when token was burned>`
           *   - `burned = `true`
           *
           * Otherwise:
           *   - `addr` = `<Address of owner>`
           *   - `startTimestamp` = `<Timestamp of start of ownership>`
           *   - `burned = `false`
           */
          function explicitOwnershipOf(uint256 tokenId) public view override returns (TokenOwnership memory) {
              TokenOwnership memory ownership;
              if (tokenId < _startTokenId() || tokenId >= _currentIndex) {
                  return ownership;
              }
              ownership = _ownerships[tokenId];
              if (ownership.burned) {
                  return ownership;
              }
              return _ownershipOf(tokenId);
          }
          /**
           * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
           * See {ERC721AQueryable-explicitOwnershipOf}
           */
          function explicitOwnershipsOf(uint256[] memory tokenIds) external view override returns (TokenOwnership[] memory) {
              unchecked {
                  uint256 tokenIdsLength = tokenIds.length;
                  TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength);
                  for (uint256 i; i != tokenIdsLength; ++i) {
                      ownerships[i] = explicitOwnershipOf(tokenIds[i]);
                  }
                  return ownerships;
              }
          }
          /**
           * @dev Returns an array of token IDs owned by `owner`,
           * in the range [`start`, `stop`)
           * (i.e. `start <= tokenId < stop`).
           *
           * This function allows for tokens to be queried if the collection
           * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
           *
           * Requirements:
           *
           * - `start` < `stop`
           */
          function tokensOfOwnerIn(
              address owner,
              uint256 start,
              uint256 stop
          ) external view override returns (uint256[] memory) {
              unchecked {
                  if (start >= stop) revert InvalidQueryRange();
                  uint256 tokenIdsIdx;
                  uint256 stopLimit = _currentIndex;
                  // Set `start = max(start, _startTokenId())`.
                  if (start < _startTokenId()) {
                      start = _startTokenId();
                  }
                  // Set `stop = min(stop, _currentIndex)`.
                  if (stop > stopLimit) {
                      stop = stopLimit;
                  }
                  uint256 tokenIdsMaxLength = balanceOf(owner);
                  // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`,
                  // to cater for cases where `balanceOf(owner)` is too big.
                  if (start < stop) {
                      uint256 rangeLength = stop - start;
                      if (rangeLength < tokenIdsMaxLength) {
                          tokenIdsMaxLength = rangeLength;
                      }
                  } else {
                      tokenIdsMaxLength = 0;
                  }
                  uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength);
                  if (tokenIdsMaxLength == 0) {
                      return tokenIds;
                  }
                  // We need to call `explicitOwnershipOf(start)`,
                  // because the slot at `start` may not be initialized.
                  TokenOwnership memory ownership = explicitOwnershipOf(start);
                  address currOwnershipAddr;
                  // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`.
                  // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range.
                  if (!ownership.burned) {
                      currOwnershipAddr = ownership.addr;
                  }
                  for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) {
                      ownership = _ownerships[i];
                      if (ownership.burned) {
                          continue;
                      }
                      if (ownership.addr != address(0)) {
                          currOwnershipAddr = ownership.addr;
                      }
                      if (currOwnershipAddr == owner) {
                          tokenIds[tokenIdsIdx++] = i;
                      }
                  }
                  // Downsize the array to fit.
                  assembly {
                      mstore(tokenIds, tokenIdsIdx)
                  }
                  return tokenIds;
              }
          }
          /**
           * @dev Returns an array of token IDs owned by `owner`.
           *
           * This function scans the ownership mapping and is O(totalSupply) in complexity.
           * It is meant to be called off-chain.
           *
           * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
           * multiple smaller scans if the collection is large enough to cause
           * an out-of-gas error (10K pfp collections should be fine).
           */
          function tokensOfOwner(address owner) external view override returns (uint256[] memory) {
              unchecked {
                  uint256 tokenIdsIdx;
                  address currOwnershipAddr;
                  uint256 tokenIdsLength = balanceOf(owner);
                  uint256[] memory tokenIds = new uint256[](tokenIdsLength);
                  TokenOwnership memory ownership;
                  for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
                      ownership = _ownerships[i];
                      if (ownership.burned) {
                          continue;
                      }
                      if (ownership.addr != address(0)) {
                          currOwnershipAddr = ownership.addr;
                      }
                      if (currOwnershipAddr == owner) {
                          tokenIds[tokenIdsIdx++] = i;
                      }
                  }
                  return tokenIds;
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
      pragma solidity ^0.8.0;
      import "../utils/Context.sol";
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract Ownable is Context {
          address private _owner;
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          constructor() {
              _transferOwnership(_msgSender());
          }
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              _checkOwner();
              _;
          }
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
          /**
           * @dev Throws if the sender is not the owner.
           */
          function _checkOwner() internal view virtual {
              require(owner() == _msgSender(), "Ownable: caller is not the owner");
          }
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              _transferOwnership(address(0));
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              _transferOwnership(newOwner);
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Internal function without access restriction.
           */
          function _transferOwnership(address newOwner) internal virtual {
              address oldOwner = _owner;
              _owner = newOwner;
              emit OwnershipTransferred(oldOwner, newOwner);
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev These functions deal with verification of Merkle Tree proofs.
       *
       * The proofs can be generated using the JavaScript library
       * https://github.com/miguelmota/merkletreejs[merkletreejs].
       * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
       *
       * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
       *
       * WARNING: You should avoid using leaf values that are 64 bytes long prior to
       * hashing, or use a hash function other than keccak256 for hashing leaves.
       * This is because the concatenation of a sorted pair of internal nodes in
       * the merkle tree could be reinterpreted as a leaf value.
       */
      library MerkleProof {
          /**
           * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
           * defined by `root`. For this, a `proof` must be provided, containing
           * sibling hashes on the branch from the leaf to the root of the tree. Each
           * pair of leaves and each pair of pre-images are assumed to be sorted.
           */
          function verify(
              bytes32[] memory proof,
              bytes32 root,
              bytes32 leaf
          ) internal pure returns (bool) {
              return processProof(proof, leaf) == root;
          }
          /**
           * @dev Calldata version of {verify}
           *
           * _Available since v4.7._
           */
          function verifyCalldata(
              bytes32[] calldata proof,
              bytes32 root,
              bytes32 leaf
          ) internal pure returns (bool) {
              return processProofCalldata(proof, leaf) == root;
          }
          /**
           * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
           * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
           * hash matches the root of the tree. When processing the proof, the pairs
           * of leafs & pre-images are assumed to be sorted.
           *
           * _Available since v4.4._
           */
          function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
              bytes32 computedHash = leaf;
              for (uint256 i = 0; i < proof.length; i++) {
                  computedHash = _hashPair(computedHash, proof[i]);
              }
              return computedHash;
          }
          /**
           * @dev Calldata version of {processProof}
           *
           * _Available since v4.7._
           */
          function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
              bytes32 computedHash = leaf;
              for (uint256 i = 0; i < proof.length; i++) {
                  computedHash = _hashPair(computedHash, proof[i]);
              }
              return computedHash;
          }
          /**
           * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by
           * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
           *
           * _Available since v4.7._
           */
          function multiProofVerify(
              bytes32[] memory proof,
              bool[] memory proofFlags,
              bytes32 root,
              bytes32[] memory leaves
          ) internal pure returns (bool) {
              return processMultiProof(proof, proofFlags, leaves) == root;
          }
          /**
           * @dev Calldata version of {multiProofVerify}
           *
           * _Available since v4.7._
           */
          function multiProofVerifyCalldata(
              bytes32[] calldata proof,
              bool[] calldata proofFlags,
              bytes32 root,
              bytes32[] memory leaves
          ) internal pure returns (bool) {
              return processMultiProofCalldata(proof, proofFlags, leaves) == root;
          }
          /**
           * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,
           * consuming from one or the other at each step according to the instructions given by
           * `proofFlags`.
           *
           * _Available since v4.7._
           */
          function processMultiProof(
              bytes32[] memory proof,
              bool[] memory proofFlags,
              bytes32[] memory leaves
          ) internal pure returns (bytes32 merkleRoot) {
              // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
              // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
              // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
              // the merkle tree.
              uint256 leavesLen = leaves.length;
              uint256 totalHashes = proofFlags.length;
              // Check proof validity.
              require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
              // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
              // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
              bytes32[] memory hashes = new bytes32[](totalHashes);
              uint256 leafPos = 0;
              uint256 hashPos = 0;
              uint256 proofPos = 0;
              // At each step, we compute the next hash using two values:
              // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
              //   get the next hash.
              // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
              //   `proof` array.
              for (uint256 i = 0; i < totalHashes; i++) {
                  bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
                  bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
                  hashes[i] = _hashPair(a, b);
              }
              if (totalHashes > 0) {
                  return hashes[totalHashes - 1];
              } else if (leavesLen > 0) {
                  return leaves[0];
              } else {
                  return proof[0];
              }
          }
          /**
           * @dev Calldata version of {processMultiProof}
           *
           * _Available since v4.7._
           */
          function processMultiProofCalldata(
              bytes32[] calldata proof,
              bool[] calldata proofFlags,
              bytes32[] memory leaves
          ) internal pure returns (bytes32 merkleRoot) {
              // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
              // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
              // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
              // the merkle tree.
              uint256 leavesLen = leaves.length;
              uint256 totalHashes = proofFlags.length;
              // Check proof validity.
              require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
              // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
              // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
              bytes32[] memory hashes = new bytes32[](totalHashes);
              uint256 leafPos = 0;
              uint256 hashPos = 0;
              uint256 proofPos = 0;
              // At each step, we compute the next hash using two values:
              // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
              //   get the next hash.
              // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
              //   `proof` array.
              for (uint256 i = 0; i < totalHashes; i++) {
                  bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
                  bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
                  hashes[i] = _hashPair(a, b);
              }
              if (totalHashes > 0) {
                  return hashes[totalHashes - 1];
              } else if (leavesLen > 0) {
                  return leaves[0];
              } else {
                  return proof[0];
              }
          }
          function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
              return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
          }
          function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
              /// @solidity memory-safe-assembly
              assembly {
                  mstore(0x00, a)
                  mstore(0x20, b)
                  value := keccak256(0x00, 0x40)
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import '../IERC721A.sol';
      /**
       * @dev Interface of an ERC721AQueryable compliant contract.
       */
      interface IERC721AQueryable is IERC721A {
          /**
           * Invalid query range (`start` >= `stop`).
           */
          error InvalidQueryRange();
          /**
           * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
           *
           * If the `tokenId` is out of bounds:
           *   - `addr` = `address(0)`
           *   - `startTimestamp` = `0`
           *   - `burned` = `false`
           *
           * If the `tokenId` is burned:
           *   - `addr` = `<Address of owner before token was burned>`
           *   - `startTimestamp` = `<Timestamp when token was burned>`
           *   - `burned = `true`
           *
           * Otherwise:
           *   - `addr` = `<Address of owner>`
           *   - `startTimestamp` = `<Timestamp of start of ownership>`
           *   - `burned = `false`
           */
          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 pfp collections should be fine).
           */
          function tokensOfOwner(address owner) external view returns (uint256[] memory);
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import './IERC721A.sol';
      import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
      import '@openzeppelin/contracts/utils/Address.sol';
      import '@openzeppelin/contracts/utils/Context.sol';
      import '@openzeppelin/contracts/utils/Strings.sol';
      import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
      /**
       * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
       * the Metadata extension. Built to optimize for lower gas during batch mints.
       *
       * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
       *
       * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
       *
       * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
       */
      contract ERC721A is Context, ERC165, IERC721A {
          using Address for address;
          using Strings for uint256;
          // The tokenId of the next token to be minted.
          uint256 internal _currentIndex;
          // The number of tokens burned.
          uint256 internal _burnCounter;
          // Token name
          string private _name;
          // Token symbol
          string private _symbol;
          // Mapping from token ID to ownership details
          // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
          mapping(uint256 => TokenOwnership) internal _ownerships;
          // Mapping owner address to address data
          mapping(address => AddressData) private _addressData;
          // Mapping from token ID to approved address
          mapping(uint256 => address) private _tokenApprovals;
          // Mapping from owner to operator approvals
          mapping(address => mapping(address => bool)) private _operatorApprovals;
          constructor(string memory name_, string memory symbol_) {
              _name = name_;
              _symbol = symbol_;
              _currentIndex = _startTokenId();
          }
          /**
           * To change the starting tokenId, please override this function.
           */
          function _startTokenId() internal view virtual returns (uint256) {
              return 0;
          }
          /**
           * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
           */
          function totalSupply() public view override returns (uint256) {
              // Counter underflow is impossible as _burnCounter cannot be incremented
              // more than _currentIndex - _startTokenId() times
              unchecked {
                  return _currentIndex - _burnCounter - _startTokenId();
              }
          }
          /**
           * Returns the total amount of tokens minted in the contract.
           */
          function _totalMinted() internal view returns (uint256) {
              // Counter underflow is impossible as _currentIndex does not decrement,
              // and it is initialized to _startTokenId()
              unchecked {
                  return _currentIndex - _startTokenId();
              }
          }
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
              return
                  interfaceId == type(IERC721).interfaceId ||
                  interfaceId == type(IERC721Metadata).interfaceId ||
                  super.supportsInterface(interfaceId);
          }
          /**
           * @dev See {IERC721-balanceOf}.
           */
          function balanceOf(address owner) public view override returns (uint256) {
              if (owner == address(0)) revert BalanceQueryForZeroAddress();
              return uint256(_addressData[owner].balance);
          }
          /**
           * Returns the number of tokens minted by `owner`.
           */
          function _numberMinted(address owner) internal view returns (uint256) {
              return uint256(_addressData[owner].numberMinted);
          }
          /**
           * Returns the number of tokens burned by or on behalf of `owner`.
           */
          function _numberBurned(address owner) internal view returns (uint256) {
              return uint256(_addressData[owner].numberBurned);
          }
          /**
           * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
           */
          function _getAux(address owner) internal view returns (uint64) {
              return _addressData[owner].aux;
          }
          /**
           * Sets the auxillary 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 {
              _addressData[owner].aux = aux;
          }
          /**
           * Gas spent here starts off proportional to the maximum mint batch size.
           * It gradually moves to O(1) as tokens get transferred around in the collection over time.
           */
          function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
              uint256 curr = tokenId;
              unchecked {
                  if (_startTokenId() <= curr) if (curr < _currentIndex) {
                      TokenOwnership memory ownership = _ownerships[curr];
                      if (!ownership.burned) {
                          if (ownership.addr != address(0)) {
                              return ownership;
                          }
                          // Invariant:
                          // There will always be an ownership that has an address and is not burned
                          // before an ownership that does not have an address and is not burned.
                          // Hence, curr will not underflow.
                          while (true) {
                              curr--;
                              ownership = _ownerships[curr];
                              if (ownership.addr != address(0)) {
                                  return ownership;
                              }
                          }
                      }
                  }
              }
              revert OwnerQueryForNonexistentToken();
          }
          /**
           * @dev See {IERC721-ownerOf}.
           */
          function ownerOf(uint256 tokenId) public view override returns (address) {
              return _ownershipOf(tokenId).addr;
          }
          /**
           * @dev See {IERC721Metadata-name}.
           */
          function name() public view virtual override returns (string memory) {
              return _name;
          }
          /**
           * @dev See {IERC721Metadata-symbol}.
           */
          function symbol() public view virtual override returns (string memory) {
              return _symbol;
          }
          /**
           * @dev See {IERC721Metadata-tokenURI}.
           */
          function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
              if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
              string memory baseURI = _baseURI();
              return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : '';
          }
          /**
           * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
           * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
           * by default, can be overriden in child contracts.
           */
          function _baseURI() internal view virtual returns (string memory) {
              return '';
          }
          /**
           * @dev See {IERC721-approve}.
           */
          function approve(address to, uint256 tokenId) public override {
              address owner = ERC721A.ownerOf(tokenId);
              if (to == owner) revert ApprovalToCurrentOwner();
              if (_msgSender() != owner) if(!isApprovedForAll(owner, _msgSender())) {
                  revert ApprovalCallerNotOwnerNorApproved();
              }
              _approve(to, tokenId, owner);
          }
          /**
           * @dev See {IERC721-getApproved}.
           */
          function getApproved(uint256 tokenId) public view override returns (address) {
              if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
              return _tokenApprovals[tokenId];
          }
          /**
           * @dev See {IERC721-setApprovalForAll}.
           */
          function setApprovalForAll(address operator, bool approved) public virtual override {
              if (operator == _msgSender()) revert ApproveToCaller();
              _operatorApprovals[_msgSender()][operator] = approved;
              emit ApprovalForAll(_msgSender(), operator, approved);
          }
          /**
           * @dev See {IERC721-isApprovedForAll}.
           */
          function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
              return _operatorApprovals[owner][operator];
          }
          /**
           * @dev See {IERC721-transferFrom}.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              _transfer(from, to, tokenId);
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              safeTransferFrom(from, to, tokenId, '');
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) public virtual override {
              _transfer(from, to, tokenId);
              if (to.isContract()) if(!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                  revert TransferToNonERC721ReceiverImplementer();
              }
          }
          /**
           * @dev Returns whether `tokenId` exists.
           *
           * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
           *
           * Tokens start existing when they are minted (`_mint`),
           */
          function _exists(uint256 tokenId) internal view returns (bool) {
              return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;
          }
          /**
           * @dev Equivalent to `_safeMint(to, quantity, '')`.
           */
          function _safeMint(address to, uint256 quantity) internal {
              _safeMint(to, 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.
           *
           * Emits a {Transfer} event.
           */
          function _safeMint(
              address to,
              uint256 quantity,
              bytes memory _data
          ) internal {
              uint256 startTokenId = _currentIndex;
              if (to == address(0)) revert MintToZeroAddress();
              if (quantity == 0) revert MintZeroQuantity();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are incredibly unrealistic.
              // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
              // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
              unchecked {
                  _addressData[to].balance += uint64(quantity);
                  _addressData[to].numberMinted += uint64(quantity);
                  _ownerships[startTokenId].addr = to;
                  _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
                  uint256 updatedIndex = startTokenId;
                  uint256 end = updatedIndex + quantity;
                  if (to.isContract()) {
                      do {
                          emit Transfer(address(0), to, updatedIndex);
                          if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
                              revert TransferToNonERC721ReceiverImplementer();
                          }
                      } while (updatedIndex < end);
                      // Reentrancy protection
                      if (_currentIndex != startTokenId) revert();
                  } else {
                      do {
                          emit Transfer(address(0), to, updatedIndex++);
                      } while (updatedIndex < end);
                  }
                  _currentIndex = updatedIndex;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
          /**
           * @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.
           */
          function _mint(address to, uint256 quantity) internal {
              uint256 startTokenId = _currentIndex;
              if (to == address(0)) revert MintToZeroAddress();
              if (quantity == 0) revert MintZeroQuantity();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are incredibly unrealistic.
              // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
              // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
              unchecked {
                  _addressData[to].balance += uint64(quantity);
                  _addressData[to].numberMinted += uint64(quantity);
                  _ownerships[startTokenId].addr = to;
                  _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
                  uint256 updatedIndex = startTokenId;
                  uint256 end = updatedIndex + quantity;
                  do {
                      emit Transfer(address(0), to, updatedIndex++);
                  } while (updatedIndex < end);
                  _currentIndex = updatedIndex;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           *
           * Emits a {Transfer} event.
           */
          function _transfer(
              address from,
              address to,
              uint256 tokenId
          ) private {
              TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
              if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
              bool isApprovedOrOwner = (_msgSender() == from ||
                  isApprovedForAll(from, _msgSender()) ||
                  getApproved(tokenId) == _msgSender());
              if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
              if (to == address(0)) revert TransferToZeroAddress();
              _beforeTokenTransfers(from, to, tokenId, 1);
              // Clear approvals from the previous owner
              _approve(address(0), tokenId, from);
              // 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 {
                  _addressData[from].balance -= 1;
                  _addressData[to].balance += 1;
                  TokenOwnership storage currSlot = _ownerships[tokenId];
                  currSlot.addr = to;
                  currSlot.startTimestamp = uint64(block.timestamp);
                  // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
                  // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
                  uint256 nextTokenId = tokenId + 1;
                  TokenOwnership storage nextSlot = _ownerships[nextTokenId];
                  if (nextSlot.addr == address(0)) {
                      // This will suffice for checking _exists(nextTokenId),
                      // as a burned slot cannot contain the zero address.
                      if (nextTokenId != _currentIndex) {
                          nextSlot.addr = from;
                          nextSlot.startTimestamp = prevOwnership.startTimestamp;
                      }
                  }
              }
              emit Transfer(from, to, tokenId);
              _afterTokenTransfers(from, to, tokenId, 1);
          }
          /**
           * @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 {
              TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
              address from = prevOwnership.addr;
              if (approvalCheck) {
                  bool isApprovedOrOwner = (_msgSender() == from ||
                      isApprovedForAll(from, _msgSender()) ||
                      getApproved(tokenId) == _msgSender());
                  if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
              }
              _beforeTokenTransfers(from, address(0), tokenId, 1);
              // Clear approvals from the previous owner
              _approve(address(0), tokenId, from);
              // 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 {
                  AddressData storage addressData = _addressData[from];
                  addressData.balance -= 1;
                  addressData.numberBurned += 1;
                  // Keep track of who burned the token, and the timestamp of burning.
                  TokenOwnership storage currSlot = _ownerships[tokenId];
                  currSlot.addr = from;
                  currSlot.startTimestamp = uint64(block.timestamp);
                  currSlot.burned = true;
                  // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
                  // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
                  uint256 nextTokenId = tokenId + 1;
                  TokenOwnership storage nextSlot = _ownerships[nextTokenId];
                  if (nextSlot.addr == address(0)) {
                      // This will suffice for checking _exists(nextTokenId),
                      // as a burned slot cannot contain the zero address.
                      if (nextTokenId != _currentIndex) {
                          nextSlot.addr = from;
                          nextSlot.startTimestamp = prevOwnership.startTimestamp;
                      }
                  }
              }
              emit Transfer(from, address(0), tokenId);
              _afterTokenTransfers(from, address(0), tokenId, 1);
              // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
              unchecked {
                  _burnCounter++;
              }
          }
          /**
           * @dev Approve `to` to operate on `tokenId`
           *
           * Emits a {Approval} event.
           */
          function _approve(
              address to,
              uint256 tokenId,
              address owner
          ) private {
              _tokenApprovals[tokenId] = to;
              emit Approval(owner, to, tokenId);
          }
          /**
           * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
           *
           * @param from address representing the previous owner of the given token ID
           * @param to target address that will receive the tokens
           * @param tokenId uint256 ID of the token to be transferred
           * @param _data bytes optional data to send along with the call
           * @return bool whether the call correctly returned the expected magic value
           */
          function _checkContractOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) private returns (bool) {
              try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                  return retval == IERC721Receiver(to).onERC721Received.selector;
              } catch (bytes memory reason) {
                  if (reason.length == 0) {
                      revert TransferToNonERC721ReceiverImplementer();
                  } else {
                      assembly {
                          revert(add(32, reason), mload(reason))
                      }
                  }
              }
          }
          /**
           * @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 {}
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
      import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
      /**
       * @dev Interface of an ERC721A compliant contract.
       */
      interface IERC721A is IERC721, IERC721Metadata {
          /**
           * The caller must own the token or be an approved operator.
           */
          error ApprovalCallerNotOwnerNorApproved();
          /**
           * The token does not exist.
           */
          error ApprovalQueryForNonexistentToken();
          /**
           * The caller cannot approve to their own address.
           */
          error ApproveToCaller();
          /**
           * The caller cannot approve to the current owner.
           */
          error ApprovalToCurrentOwner();
          /**
           * 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();
          // Compiler will pack this into a single 256bit word.
          struct TokenOwnership {
              // The address of the owner.
              address addr;
              // Keeps track of the start time of ownership with minimal overhead for tokenomics.
              uint64 startTimestamp;
              // Whether the token has been burned.
              bool burned;
          }
          // Compiler will pack this into a single 256bit word.
          struct AddressData {
              // Realistically, 2**64-1 is more than enough.
              uint64 balance;
              // Keeps track of mint count with minimal overhead for tokenomics.
              uint64 numberMinted;
              // Keeps track of burn count with minimal overhead for tokenomics.
              uint64 numberBurned;
              // For miscellaneous variable(s) pertaining to the address
              // (e.g. number of whitelist mint slots used).
              // If there are multiple variables, please pack them into a uint64.
              uint64 aux;
          }
          /**
           * @dev Returns the total amount of tokens stored by the contract.
           * 
           * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
           */
          function totalSupply() external view returns (uint256);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)
      pragma solidity ^0.8.0;
      import "../../utils/introspection/IERC165.sol";
      /**
       * @dev Required interface of an ERC721 compliant contract.
       */
      interface IERC721 is IERC165 {
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
          /**
           * @dev Returns the number of tokens in ``owner``'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes calldata data
          ) external;
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
           * are aware of the ERC721 protocol to prevent tokens from being forever locked.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external;
          /**
           * @dev Transfers `tokenId` token from `from` to `to`.
           *
           * WARNING: 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;
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external;
          /**
           * @dev Approve or remove `operator` as an operator for the caller.
           * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
           *
           * Requirements:
           *
           * - The `operator` cannot be the caller.
           *
           * Emits an {ApprovalForAll} event.
           */
          function setApprovalForAll(address operator, bool _approved) external;
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
          /**
           * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
           *
           * See {setApprovalForAll}
           */
          function isApprovedForAll(address owner, address operator) external view returns (bool);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
      pragma solidity ^0.8.0;
      import "../IERC721.sol";
      /**
       * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
       * @dev See https://eips.ethereum.org/EIPS/eip-721
       */
      interface IERC721Metadata is IERC721 {
          /**
           * @dev Returns the token collection name.
           */
          function name() external view returns (string memory);
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() external view returns (string memory);
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) external view returns (string memory);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165 {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Provides information about the current execution context, including the
       * sender of the transaction and its data. While these are generally available
       * via msg.sender and msg.data, they should not be accessed in such a direct
       * manner, since when dealing with meta-transactions the account sending and
       * paying for execution may not be the actual sender (as far as an application
       * is concerned).
       *
       * This contract is only required for intermediate, library-like contracts.
       */
      abstract contract Context {
          function _msgSender() internal view virtual returns (address) {
              return msg.sender;
          }
          function _msgData() internal view virtual returns (bytes calldata) {
              return msg.data;
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
      pragma solidity ^0.8.1;
      /**
       * @dev Collection of functions related to the address type
       */
      library Address {
          /**
           * @dev Returns true if `account` is a contract.
           *
           * [IMPORTANT]
           * ====
           * It is unsafe to assume that an address for which this function returns
           * false is an externally-owned account (EOA) and not a contract.
           *
           * Among others, `isContract` will return false for the following
           * types of addresses:
           *
           *  - an externally-owned account
           *  - a contract in construction
           *  - an address where a contract will be created
           *  - an address where a contract lived, but was destroyed
           * ====
           *
           * [IMPORTANT]
           * ====
           * You shouldn't rely on `isContract` to protect against flash loan attacks!
           *
           * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
           * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
           * constructor.
           * ====
           */
          function isContract(address account) internal view returns (bool) {
              // This method relies on extcodesize/address.code.length, which returns 0
              // for contracts in construction, since the code is only stored at the end
              // of the constructor execution.
              return account.code.length > 0;
          }
          /**
           * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
           * `recipient`, forwarding all available gas and reverting on errors.
           *
           * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
           * of certain opcodes, possibly making contracts go over the 2300 gas limit
           * imposed by `transfer`, making them unable to receive funds via
           * `transfer`. {sendValue} removes this limitation.
           *
           * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
           *
           * IMPORTANT: because control is transferred to `recipient`, care must be
           * taken to not create reentrancy vulnerabilities. Consider using
           * {ReentrancyGuard} or the
           * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
           */
          function sendValue(address payable recipient, uint256 amount) internal {
              require(address(this).balance >= amount, "Address: insufficient balance");
              (bool success, ) = recipient.call{value: amount}("");
              require(success, "Address: unable to send value, recipient may have reverted");
          }
          /**
           * @dev Performs a Solidity function call using a low level `call`. A
           * plain `call` is an unsafe replacement for a function call: use this
           * function instead.
           *
           * If `target` reverts with a revert reason, it is bubbled up by this
           * function (like regular Solidity function calls).
           *
           * Returns the raw returned data. To convert to the expected return value,
           * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
           *
           * Requirements:
           *
           * - `target` must be a contract.
           * - calling `target` with `data` must not revert.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionCall(target, data, "Address: low-level call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
           * `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but also transferring `value` wei to `target`.
           *
           * Requirements:
           *
           * - the calling contract must have an ETH balance of at least `value`.
           * - the called Solidity function must be `payable`.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
          }
          /**
           * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
           * with `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(address(this).balance >= value, "Address: insufficient balance for call");
              require(isContract(target), "Address: call to non-contract");
              (bool success, bytes memory returndata) = target.call{value: value}(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
              return functionStaticCall(target, data, "Address: low-level static call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              require(isContract(target), "Address: static call to non-contract");
              (bool success, bytes memory returndata) = target.staticcall(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionDelegateCall(target, data, "Address: low-level delegate call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(isContract(target), "Address: delegate call to non-contract");
              (bool success, bytes memory returndata) = target.delegatecall(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
           * revert reason using the provided one.
           *
           * _Available since v4.3._
           */
          function verifyCallResult(
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal pure returns (bytes memory) {
              if (success) {
                  return returndata;
              } else {
                  // Look for revert reason and bubble it up if present
                  if (returndata.length > 0) {
                      // The easiest way to bubble the revert reason is using memory via assembly
                      /// @solidity memory-safe-assembly
                      assembly {
                          let returndata_size := mload(returndata)
                          revert(add(32, returndata), returndata_size)
                      }
                  } else {
                      revert(errorMessage);
                  }
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
      pragma solidity ^0.8.0;
      /**
       * @title ERC721 token receiver interface
       * @dev Interface for any contract that wants to support safeTransfers
       * from ERC721 asset contracts.
       */
      interface IERC721Receiver {
          /**
           * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
           * by `operator` from `from`, this function is called.
           *
           * It must return its Solidity selector to confirm the token transfer.
           * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
           *
           * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
           */
          function onERC721Received(
              address operator,
              address from,
              uint256 tokenId,
              bytes calldata data
          ) external returns (bytes4);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev String operations.
       */
      library Strings {
          bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
          uint8 private constant _ADDRESS_LENGTH = 20;
          /**
           * @dev Converts a `uint256` to its ASCII `string` decimal representation.
           */
          function toString(uint256 value) internal pure returns (string memory) {
              // Inspired by OraclizeAPI's implementation - MIT licence
              // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
              if (value == 0) {
                  return "0";
              }
              uint256 temp = value;
              uint256 digits;
              while (temp != 0) {
                  digits++;
                  temp /= 10;
              }
              bytes memory buffer = new bytes(digits);
              while (value != 0) {
                  digits -= 1;
                  buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
                  value /= 10;
              }
              return string(buffer);
          }
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
           */
          function toHexString(uint256 value) internal pure returns (string memory) {
              if (value == 0) {
                  return "0x00";
              }
              uint256 temp = value;
              uint256 length = 0;
              while (temp != 0) {
                  length++;
                  temp >>= 8;
              }
              return toHexString(value, length);
          }
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
           */
          function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
              bytes memory buffer = new bytes(2 * length + 2);
              buffer[0] = "0";
              buffer[1] = "x";
              for (uint256 i = 2 * length + 1; i > 1; --i) {
                  buffer[i] = _HEX_SYMBOLS[value & 0xf];
                  value >>= 4;
              }
              require(value == 0, "Strings: hex length insufficient");
              return string(buffer);
          }
          /**
           * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
           */
          function toHexString(address addr) internal pure returns (string memory) {
              return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
      pragma solidity ^0.8.0;
      import "./IERC165.sol";
      /**
       * @dev Implementation of the {IERC165} interface.
       *
       * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
       * for the additional interface id that will be supported. For example:
       *
       * ```solidity
       * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
       *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
       * }
       * ```
       *
       * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
       */
      abstract contract ERC165 is IERC165 {
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              return interfaceId == type(IERC165).interfaceId;
          }
      }
      

      File 8 of 10: SIM2
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
      pragma solidity ^0.8.0;
      import "../utils/Context.sol";
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract Ownable is Context {
          address private _owner;
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          constructor() {
              _transferOwnership(_msgSender());
          }
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              _checkOwner();
              _;
          }
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
          /**
           * @dev Throws if the sender is not the owner.
           */
          function _checkOwner() internal view virtual {
              require(owner() == _msgSender(), "Ownable: caller is not the owner");
          }
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              _transferOwnership(address(0));
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              _transferOwnership(newOwner);
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Internal function without access restriction.
           */
          function _transferOwnership(address newOwner) internal virtual {
              address oldOwner = _owner;
              _owner = newOwner;
              emit OwnershipTransferred(oldOwner, newOwner);
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Contract module that helps prevent reentrant calls to a function.
       *
       * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
       * available, which can be applied to functions to make sure there are no nested
       * (reentrant) calls to them.
       *
       * Note that because there is a single `nonReentrant` guard, functions marked as
       * `nonReentrant` may not call one another. This can be worked around by making
       * those functions `private`, and then adding `external` `nonReentrant` entry
       * points to them.
       *
       * TIP: If you would like to learn more about reentrancy and alternative ways
       * to protect against it, check out our blog post
       * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
       */
      abstract contract ReentrancyGuard {
          // Booleans are more expensive than uint256 or any type that takes up a full
          // word because each write operation emits an extra SLOAD to first read the
          // slot's contents, replace the bits taken up by the boolean, and then write
          // back. This is the compiler's defense against contract upgrades and
          // pointer aliasing, and it cannot be disabled.
          // The values being non-zero value makes deployment a bit more expensive,
          // but in exchange the refund on every call to nonReentrant will be lower in
          // amount. Since refunds are capped to a percentage of the total
          // transaction's gas, it is best to keep them low in cases like this one, to
          // increase the likelihood of the full refund coming into effect.
          uint256 private constant _NOT_ENTERED = 1;
          uint256 private constant _ENTERED = 2;
          uint256 private _status;
          constructor() {
              _status = _NOT_ENTERED;
          }
          /**
           * @dev Prevents a contract from calling itself, directly or indirectly.
           * Calling a `nonReentrant` function from another `nonReentrant`
           * function is not supported. It is possible to prevent this from happening
           * by making the `nonReentrant` function external, and making it call a
           * `private` function that does the actual work.
           */
          modifier nonReentrant() {
              _nonReentrantBefore();
              _;
              _nonReentrantAfter();
          }
          function _nonReentrantBefore() private {
              // On the first call to nonReentrant, _status will be _NOT_ENTERED
              require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
              // Any calls to nonReentrant after this point will fail
              _status = _ENTERED;
          }
          function _nonReentrantAfter() private {
              // By storing the original value once again, a refund is triggered (see
              // https://eips.ethereum.org/EIPS/eip-2200)
              _status = _NOT_ENTERED;
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
      pragma solidity ^0.8.0;
      import "../IERC721.sol";
      /**
       * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
       * @dev See https://eips.ethereum.org/EIPS/eip-721
       */
      interface IERC721Metadata is IERC721 {
          /**
           * @dev Returns the token collection name.
           */
          function name() external view returns (string memory);
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() external view returns (string memory);
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) external view returns (string memory);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)
      pragma solidity ^0.8.0;
      import "../../utils/introspection/IERC165.sol";
      /**
       * @dev Required interface of an ERC721 compliant contract.
       */
      interface IERC721 is IERC165 {
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
          /**
           * @dev Returns the number of tokens in ``owner``'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes calldata data
          ) external;
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
           * are aware of the ERC721 protocol to prevent tokens from being forever locked.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external;
          /**
           * @dev Transfers `tokenId` token from `from` to `to`.
           *
           * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
           * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
           * understand this adds an external call which potentially creates a reentrancy vulnerability.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           *
           * Emits a {Transfer} event.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) external;
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external;
          /**
           * @dev Approve or remove `operator` as an operator for the caller.
           * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
           *
           * Requirements:
           *
           * - The `operator` cannot be the caller.
           *
           * Emits an {ApprovalForAll} event.
           */
          function setApprovalForAll(address operator, bool _approved) external;
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
          /**
           * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
           *
           * See {setApprovalForAll}
           */
          function isApprovedForAll(address owner, address operator) external view returns (bool);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
      pragma solidity ^0.8.0;
      /**
       * @title ERC721 token receiver interface
       * @dev Interface for any contract that wants to support safeTransfers
       * from ERC721 asset contracts.
       */
      interface IERC721Receiver {
          /**
           * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
           * by `operator` from `from`, this function is called.
           *
           * It must return its Solidity selector to confirm the token transfer.
           * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
           *
           * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
           */
          function onERC721Received(
              address operator,
              address from,
              uint256 tokenId,
              bytes calldata data
          ) external returns (bytes4);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
      pragma solidity ^0.8.1;
      /**
       * @dev Collection of functions related to the address type
       */
      library Address {
          /**
           * @dev Returns true if `account` is a contract.
           *
           * [IMPORTANT]
           * ====
           * It is unsafe to assume that an address for which this function returns
           * false is an externally-owned account (EOA) and not a contract.
           *
           * Among others, `isContract` will return false for the following
           * types of addresses:
           *
           *  - an externally-owned account
           *  - a contract in construction
           *  - an address where a contract will be created
           *  - an address where a contract lived, but was destroyed
           * ====
           *
           * [IMPORTANT]
           * ====
           * You shouldn't rely on `isContract` to protect against flash loan attacks!
           *
           * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
           * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
           * constructor.
           * ====
           */
          function isContract(address account) internal view returns (bool) {
              // This method relies on extcodesize/address.code.length, which returns 0
              // for contracts in construction, since the code is only stored at the end
              // of the constructor execution.
              return account.code.length > 0;
          }
          /**
           * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
           * `recipient`, forwarding all available gas and reverting on errors.
           *
           * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
           * of certain opcodes, possibly making contracts go over the 2300 gas limit
           * imposed by `transfer`, making them unable to receive funds via
           * `transfer`. {sendValue} removes this limitation.
           *
           * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
           *
           * IMPORTANT: because control is transferred to `recipient`, care must be
           * taken to not create reentrancy vulnerabilities. Consider using
           * {ReentrancyGuard} or the
           * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
           */
          function sendValue(address payable recipient, uint256 amount) internal {
              require(address(this).balance >= amount, "Address: insufficient balance");
              (bool success, ) = recipient.call{value: amount}("");
              require(success, "Address: unable to send value, recipient may have reverted");
          }
          /**
           * @dev Performs a Solidity function call using a low level `call`. A
           * plain `call` is an unsafe replacement for a function call: use this
           * function instead.
           *
           * If `target` reverts with a revert reason, it is bubbled up by this
           * function (like regular Solidity function calls).
           *
           * Returns the raw returned data. To convert to the expected return value,
           * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
           *
           * Requirements:
           *
           * - `target` must be a contract.
           * - calling `target` with `data` must not revert.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, "Address: low-level call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
           * `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but also transferring `value` wei to `target`.
           *
           * Requirements:
           *
           * - the calling contract must have an ETH balance of at least `value`.
           * - the called Solidity function must be `payable`.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
          }
          /**
           * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
           * with `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(address(this).balance >= value, "Address: insufficient balance for call");
              (bool success, bytes memory returndata) = target.call{value: value}(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
              return functionStaticCall(target, data, "Address: low-level static call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              (bool success, bytes memory returndata) = target.staticcall(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionDelegateCall(target, data, "Address: low-level delegate call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              (bool success, bytes memory returndata) = target.delegatecall(data);
              return verifyCallResultFromTarget(target, success, returndata, errorMessage);
          }
          /**
           * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
           * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
           *
           * _Available since v4.8._
           */
          function verifyCallResultFromTarget(
              address target,
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              if (success) {
                  if (returndata.length == 0) {
                      // only check isContract if the call was successful and the return data is empty
                      // otherwise we already know that it was a contract
                      require(isContract(target), "Address: call to non-contract");
                  }
                  return returndata;
              } else {
                  _revert(returndata, errorMessage);
              }
          }
          /**
           * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
           * revert reason or using the provided one.
           *
           * _Available since v4.3._
           */
          function verifyCallResult(
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal pure returns (bytes memory) {
              if (success) {
                  return returndata;
              } else {
                  _revert(returndata, errorMessage);
              }
          }
          function _revert(bytes memory returndata, string memory errorMessage) private pure {
              // Look for revert reason and bubble it up if present
              if (returndata.length > 0) {
                  // The easiest way to bubble the revert reason is using memory via assembly
                  /// @solidity memory-safe-assembly
                  assembly {
                      let returndata_size := mload(returndata)
                      revert(add(32, returndata), returndata_size)
                  }
              } else {
                  revert(errorMessage);
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Provides information about the current execution context, including the
       * sender of the transaction and its data. While these are generally available
       * via msg.sender and msg.data, they should not be accessed in such a direct
       * manner, since when dealing with meta-transactions the account sending and
       * paying for execution may not be the actual sender (as far as an application
       * is concerned).
       *
       * This contract is only required for intermediate, library-like contracts.
       */
      abstract contract Context {
          function _msgSender() internal view virtual returns (address) {
              return msg.sender;
          }
          function _msgData() internal view virtual returns (bytes calldata) {
              return msg.data;
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev These functions deal with verification of Merkle Tree proofs.
       *
       * The tree and the proofs can be generated using our
       * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
       * You will find a quickstart guide in the readme.
       *
       * WARNING: You should avoid using leaf values that are 64 bytes long prior to
       * hashing, or use a hash function other than keccak256 for hashing leaves.
       * This is because the concatenation of a sorted pair of internal nodes in
       * the merkle tree could be reinterpreted as a leaf value.
       * OpenZeppelin's JavaScript library generates merkle trees that are safe
       * against this attack out of the box.
       */
      library MerkleProof {
          /**
           * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
           * defined by `root`. For this, a `proof` must be provided, containing
           * sibling hashes on the branch from the leaf to the root of the tree. Each
           * pair of leaves and each pair of pre-images are assumed to be sorted.
           */
          function verify(
              bytes32[] memory proof,
              bytes32 root,
              bytes32 leaf
          ) internal pure returns (bool) {
              return processProof(proof, leaf) == root;
          }
          /**
           * @dev Calldata version of {verify}
           *
           * _Available since v4.7._
           */
          function verifyCalldata(
              bytes32[] calldata proof,
              bytes32 root,
              bytes32 leaf
          ) internal pure returns (bool) {
              return processProofCalldata(proof, leaf) == root;
          }
          /**
           * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
           * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
           * hash matches the root of the tree. When processing the proof, the pairs
           * of leafs & pre-images are assumed to be sorted.
           *
           * _Available since v4.4._
           */
          function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
              bytes32 computedHash = leaf;
              for (uint256 i = 0; i < proof.length; i++) {
                  computedHash = _hashPair(computedHash, proof[i]);
              }
              return computedHash;
          }
          /**
           * @dev Calldata version of {processProof}
           *
           * _Available since v4.7._
           */
          function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
              bytes32 computedHash = leaf;
              for (uint256 i = 0; i < proof.length; i++) {
                  computedHash = _hashPair(computedHash, proof[i]);
              }
              return computedHash;
          }
          /**
           * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
           * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
           *
           * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
           *
           * _Available since v4.7._
           */
          function multiProofVerify(
              bytes32[] memory proof,
              bool[] memory proofFlags,
              bytes32 root,
              bytes32[] memory leaves
          ) internal pure returns (bool) {
              return processMultiProof(proof, proofFlags, leaves) == root;
          }
          /**
           * @dev Calldata version of {multiProofVerify}
           *
           * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
           *
           * _Available since v4.7._
           */
          function multiProofVerifyCalldata(
              bytes32[] calldata proof,
              bool[] calldata proofFlags,
              bytes32 root,
              bytes32[] memory leaves
          ) internal pure returns (bool) {
              return processMultiProofCalldata(proof, proofFlags, leaves) == root;
          }
          /**
           * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
           * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
           * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
           * respectively.
           *
           * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
           * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
           * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
           *
           * _Available since v4.7._
           */
          function processMultiProof(
              bytes32[] memory proof,
              bool[] memory proofFlags,
              bytes32[] memory leaves
          ) internal pure returns (bytes32 merkleRoot) {
              // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
              // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
              // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
              // the merkle tree.
              uint256 leavesLen = leaves.length;
              uint256 totalHashes = proofFlags.length;
              // Check proof validity.
              require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
              // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
              // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
              bytes32[] memory hashes = new bytes32[](totalHashes);
              uint256 leafPos = 0;
              uint256 hashPos = 0;
              uint256 proofPos = 0;
              // At each step, we compute the next hash using two values:
              // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
              //   get the next hash.
              // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
              //   `proof` array.
              for (uint256 i = 0; i < totalHashes; i++) {
                  bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
                  bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
                  hashes[i] = _hashPair(a, b);
              }
              if (totalHashes > 0) {
                  return hashes[totalHashes - 1];
              } else if (leavesLen > 0) {
                  return leaves[0];
              } else {
                  return proof[0];
              }
          }
          /**
           * @dev Calldata version of {processMultiProof}.
           *
           * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
           *
           * _Available since v4.7._
           */
          function processMultiProofCalldata(
              bytes32[] calldata proof,
              bool[] calldata proofFlags,
              bytes32[] memory leaves
          ) internal pure returns (bytes32 merkleRoot) {
              // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
              // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
              // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
              // the merkle tree.
              uint256 leavesLen = leaves.length;
              uint256 totalHashes = proofFlags.length;
              // Check proof validity.
              require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");
              // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
              // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
              bytes32[] memory hashes = new bytes32[](totalHashes);
              uint256 leafPos = 0;
              uint256 hashPos = 0;
              uint256 proofPos = 0;
              // At each step, we compute the next hash using two values:
              // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
              //   get the next hash.
              // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
              //   `proof` array.
              for (uint256 i = 0; i < totalHashes; i++) {
                  bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
                  bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
                  hashes[i] = _hashPair(a, b);
              }
              if (totalHashes > 0) {
                  return hashes[totalHashes - 1];
              } else if (leavesLen > 0) {
                  return leaves[0];
              } else {
                  return proof[0];
              }
          }
          function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
              return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
          }
          function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
              /// @solidity memory-safe-assembly
              assembly {
                  mstore(0x00, a)
                  mstore(0x20, b)
                  value := keccak256(0x00, 0x40)
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
      pragma solidity ^0.8.0;
      import "./IERC165.sol";
      /**
       * @dev Implementation of the {IERC165} interface.
       *
       * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
       * for the additional interface id that will be supported. For example:
       *
       * ```solidity
       * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
       *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
       * }
       * ```
       *
       * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
       */
      abstract contract ERC165 is IERC165 {
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              return interfaceId == type(IERC165).interfaceId;
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165 {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Standard math utilities missing in the Solidity language.
       */
      library Math {
          enum Rounding {
              Down, // Toward negative infinity
              Up, // Toward infinity
              Zero // Toward zero
          }
          /**
           * @dev Returns the largest of two numbers.
           */
          function max(uint256 a, uint256 b) internal pure returns (uint256) {
              return a > b ? a : b;
          }
          /**
           * @dev Returns the smallest of two numbers.
           */
          function min(uint256 a, uint256 b) internal pure returns (uint256) {
              return a < b ? a : b;
          }
          /**
           * @dev Returns the average of two numbers. The result is rounded towards
           * zero.
           */
          function average(uint256 a, uint256 b) internal pure returns (uint256) {
              // (a + b) / 2 can overflow.
              return (a & b) + (a ^ b) / 2;
          }
          /**
           * @dev Returns the ceiling of the division of two numbers.
           *
           * This differs from standard division with `/` in that it rounds up instead
           * of rounding down.
           */
          function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
              // (a + b - 1) / b can overflow on addition, so we distribute.
              return a == 0 ? 0 : (a - 1) / b + 1;
          }
          /**
           * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
           * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
           * with further edits by Uniswap Labs also under MIT license.
           */
          function mulDiv(
              uint256 x,
              uint256 y,
              uint256 denominator
          ) internal pure returns (uint256 result) {
              unchecked {
                  // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
                  // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
                  // variables such that product = prod1 * 2^256 + prod0.
                  uint256 prod0; // Least significant 256 bits of the product
                  uint256 prod1; // Most significant 256 bits of the product
                  assembly {
                      let mm := mulmod(x, y, not(0))
                      prod0 := mul(x, y)
                      prod1 := sub(sub(mm, prod0), lt(mm, prod0))
                  }
                  // Handle non-overflow cases, 256 by 256 division.
                  if (prod1 == 0) {
                      return prod0 / denominator;
                  }
                  // Make sure the result is less than 2^256. Also prevents denominator == 0.
                  require(denominator > prod1);
                  ///////////////////////////////////////////////
                  // 512 by 256 division.
                  ///////////////////////////////////////////////
                  // Make division exact by subtracting the remainder from [prod1 prod0].
                  uint256 remainder;
                  assembly {
                      // Compute remainder using mulmod.
                      remainder := mulmod(x, y, denominator)
                      // Subtract 256 bit number from 512 bit number.
                      prod1 := sub(prod1, gt(remainder, prod0))
                      prod0 := sub(prod0, remainder)
                  }
                  // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
                  // See https://cs.stackexchange.com/q/138556/92363.
                  // Does not overflow because the denominator cannot be zero at this stage in the function.
                  uint256 twos = denominator & (~denominator + 1);
                  assembly {
                      // Divide denominator by twos.
                      denominator := div(denominator, twos)
                      // Divide [prod1 prod0] by twos.
                      prod0 := div(prod0, twos)
                      // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                      twos := add(div(sub(0, twos), twos), 1)
                  }
                  // Shift in bits from prod1 into prod0.
                  prod0 |= prod1 * twos;
                  // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
                  // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
                  // four bits. That is, denominator * inv = 1 mod 2^4.
                  uint256 inverse = (3 * denominator) ^ 2;
                  // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
                  // in modular arithmetic, doubling the correct bits in each step.
                  inverse *= 2 - denominator * inverse; // inverse mod 2^8
                  inverse *= 2 - denominator * inverse; // inverse mod 2^16
                  inverse *= 2 - denominator * inverse; // inverse mod 2^32
                  inverse *= 2 - denominator * inverse; // inverse mod 2^64
                  inverse *= 2 - denominator * inverse; // inverse mod 2^128
                  inverse *= 2 - denominator * inverse; // inverse mod 2^256
                  // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
                  // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
                  // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
                  // is no longer required.
                  result = prod0 * inverse;
                  return result;
              }
          }
          /**
           * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
           */
          function mulDiv(
              uint256 x,
              uint256 y,
              uint256 denominator,
              Rounding rounding
          ) internal pure returns (uint256) {
              uint256 result = mulDiv(x, y, denominator);
              if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
                  result += 1;
              }
              return result;
          }
          /**
           * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
           *
           * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
           */
          function sqrt(uint256 a) internal pure returns (uint256) {
              if (a == 0) {
                  return 0;
              }
              // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
              //
              // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
              // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
              //
              // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
              // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
              // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
              //
              // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
              uint256 result = 1 << (log2(a) >> 1);
              // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
              // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
              // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
              // into the expected uint128 result.
              unchecked {
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  result = (result + a / result) >> 1;
                  return min(result, a / result);
              }
          }
          /**
           * @notice Calculates sqrt(a), following the selected rounding direction.
           */
          function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
              unchecked {
                  uint256 result = sqrt(a);
                  return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
              }
          }
          /**
           * @dev Return the log in base 2, rounded down, of a positive value.
           * Returns 0 if given 0.
           */
          function log2(uint256 value) internal pure returns (uint256) {
              uint256 result = 0;
              unchecked {
                  if (value >> 128 > 0) {
                      value >>= 128;
                      result += 128;
                  }
                  if (value >> 64 > 0) {
                      value >>= 64;
                      result += 64;
                  }
                  if (value >> 32 > 0) {
                      value >>= 32;
                      result += 32;
                  }
                  if (value >> 16 > 0) {
                      value >>= 16;
                      result += 16;
                  }
                  if (value >> 8 > 0) {
                      value >>= 8;
                      result += 8;
                  }
                  if (value >> 4 > 0) {
                      value >>= 4;
                      result += 4;
                  }
                  if (value >> 2 > 0) {
                      value >>= 2;
                      result += 2;
                  }
                  if (value >> 1 > 0) {
                      result += 1;
                  }
              }
              return result;
          }
          /**
           * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
           * Returns 0 if given 0.
           */
          function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
              unchecked {
                  uint256 result = log2(value);
                  return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
              }
          }
          /**
           * @dev Return the log in base 10, rounded down, of a positive value.
           * Returns 0 if given 0.
           */
          function log10(uint256 value) internal pure returns (uint256) {
              uint256 result = 0;
              unchecked {
                  if (value >= 10**64) {
                      value /= 10**64;
                      result += 64;
                  }
                  if (value >= 10**32) {
                      value /= 10**32;
                      result += 32;
                  }
                  if (value >= 10**16) {
                      value /= 10**16;
                      result += 16;
                  }
                  if (value >= 10**8) {
                      value /= 10**8;
                      result += 8;
                  }
                  if (value >= 10**4) {
                      value /= 10**4;
                      result += 4;
                  }
                  if (value >= 10**2) {
                      value /= 10**2;
                      result += 2;
                  }
                  if (value >= 10**1) {
                      result += 1;
                  }
              }
              return result;
          }
          /**
           * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
           * Returns 0 if given 0.
           */
          function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
              unchecked {
                  uint256 result = log10(value);
                  return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
              }
          }
          /**
           * @dev Return the log in base 256, rounded down, of a positive value.
           * Returns 0 if given 0.
           *
           * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
           */
          function log256(uint256 value) internal pure returns (uint256) {
              uint256 result = 0;
              unchecked {
                  if (value >> 128 > 0) {
                      value >>= 128;
                      result += 16;
                  }
                  if (value >> 64 > 0) {
                      value >>= 64;
                      result += 8;
                  }
                  if (value >> 32 > 0) {
                      value >>= 32;
                      result += 4;
                  }
                  if (value >> 16 > 0) {
                      value >>= 16;
                      result += 2;
                  }
                  if (value >> 8 > 0) {
                      result += 1;
                  }
              }
              return result;
          }
          /**
           * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
           * Returns 0 if given 0.
           */
          function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
              unchecked {
                  uint256 result = log256(value);
                  return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
      pragma solidity ^0.8.0;
      import "./math/Math.sol";
      /**
       * @dev String operations.
       */
      library Strings {
          bytes16 private constant _SYMBOLS = "0123456789abcdef";
          uint8 private constant _ADDRESS_LENGTH = 20;
          /**
           * @dev Converts a `uint256` to its ASCII `string` decimal representation.
           */
          function toString(uint256 value) internal pure returns (string memory) {
              unchecked {
                  uint256 length = Math.log10(value) + 1;
                  string memory buffer = new string(length);
                  uint256 ptr;
                  /// @solidity memory-safe-assembly
                  assembly {
                      ptr := add(buffer, add(32, length))
                  }
                  while (true) {
                      ptr--;
                      /// @solidity memory-safe-assembly
                      assembly {
                          mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                      }
                      value /= 10;
                      if (value == 0) break;
                  }
                  return buffer;
              }
          }
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
           */
          function toHexString(uint256 value) internal pure returns (string memory) {
              unchecked {
                  return toHexString(value, Math.log256(value) + 1);
              }
          }
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
           */
          function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
              bytes memory buffer = new bytes(2 * length + 2);
              buffer[0] = "0";
              buffer[1] = "x";
              for (uint256 i = 2 * length + 1; i > 1; --i) {
                  buffer[i] = _SYMBOLS[value & 0xf];
                  value >>= 4;
              }
              require(value == 0, "Strings: hex length insufficient");
              return string(buffer);
          }
          /**
           * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
           */
          function toHexString(address addr) internal pure returns (string memory) {
              return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
          }
      }
      // SPDX-License-Identifier: MIT
      pragma solidity >=0.8.9 <0.9.0;
      import 'erc721a/contracts/extensions/ERC721AQueryable.sol';
      import '@openzeppelin/contracts/access/Ownable.sol';
      import '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';
      import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
      contract SIM2 is ERC721AQueryable, Ownable, ReentrancyGuard {
        using Strings for uint256;
        bytes32 public merkleRoot;
        mapping(address => bool) public whitelistClaimed;
        string public uriPrefix = '';
        string public uriSuffix = '.json';
        string public hiddenMetadataUri;
        
        uint256 public cost;
        uint256 public maxSupply;
        uint256 public maxMintAmountPerTx;
        bool public paused = true;
        bool public whitelistMintEnabled = false;
        bool public revealed = false;
        constructor(
          string memory _tokenName,
          string memory _tokenSymbol,
          uint256 _cost,
          uint256 _maxSupply,
          uint256 _maxMintAmountPerTx,
          string memory _hiddenMetadataUri
        ) ERC721A(_tokenName, _tokenSymbol) {
          setCost(_cost);
          maxSupply = _maxSupply;
          setMaxMintAmountPerTx(_maxMintAmountPerTx);
          setHiddenMetadataUri(_hiddenMetadataUri);
        }
        modifier mintCompliance(uint256 _mintAmount) {
          require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, 'Invalid mint amount!');
          require(totalSupply() + _mintAmount <= maxSupply, 'Max supply exceeded!');
          _;
        }
        modifier mintPriceCompliance(uint256 _mintAmount) {
          require(msg.value >= cost * _mintAmount, 'Insufficient funds!');
          _;
        }
        function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
          // Verify whitelist requirements
          require(whitelistMintEnabled, 'The whitelist sale is not enabled!');
          require(!whitelistClaimed[_msgSender()], 'Address already claimed!');
          bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));
          require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), 'Invalid proof!');
          whitelistClaimed[_msgSender()] = true;
          _safeMint(_msgSender(), _mintAmount);
        }
        function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
          require(!paused, 'The contract is paused!');
          _safeMint(_msgSender(), _mintAmount);
        }
        
        function mintForAddress(uint256 _mintAmount, address _receiver) public mintCompliance(_mintAmount) onlyOwner {
          _safeMint(_receiver, _mintAmount);
        }
        function _startTokenId() internal view virtual override returns (uint256) {
          return 1;
        }
        function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
          require(_exists(_tokenId), 'ERC721Metadata: URI query for nonexistent token');
          if (revealed == false) {
            return hiddenMetadataUri;
          }
          string memory currentBaseURI = _baseURI();
          return bytes(currentBaseURI).length > 0
              ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriSuffix))
              : '';
        }
        function setRevealed(bool _state) public onlyOwner {
          revealed = _state;
        }
        function setCost(uint256 _cost) public onlyOwner {
          cost = _cost;
        }
        function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner {
          maxMintAmountPerTx = _maxMintAmountPerTx;
        }
        function setHiddenMetadataUri(string memory _hiddenMetadataUri) public onlyOwner {
          hiddenMetadataUri = _hiddenMetadataUri;
        }
        function setUriPrefix(string memory _uriPrefix) public onlyOwner {
          uriPrefix = _uriPrefix;
        }
        function setUriSuffix(string memory _uriSuffix) public onlyOwner {
          uriSuffix = _uriSuffix;
        }
        function setPaused(bool _state) public onlyOwner {
          paused = _state;
        }
        function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner {
          merkleRoot = _merkleRoot;
        }
        function setWhitelistMintEnabled(bool _state) public onlyOwner {
          whitelistMintEnabled = _state;
        }
        function withdraw() public onlyOwner nonReentrant {
          // This will transfer the remaining contract balance to the owner.
          // Do not remove this otherwise you will not be able to withdraw the funds.
          // =============================================================================
          (bool os, ) = payable(owner()).call{value: address(this).balance}('');
          require(os);
          // =============================================================================
        }
        function _baseURI() internal view virtual override returns (string memory) {
          return uriPrefix;
        }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import './IERC721A.sol';
      import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
      import '@openzeppelin/contracts/utils/Address.sol';
      import '@openzeppelin/contracts/utils/Context.sol';
      import '@openzeppelin/contracts/utils/Strings.sol';
      import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
      /**
       * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
       * the Metadata extension. Built to optimize for lower gas during batch mints.
       *
       * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
       *
       * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
       *
       * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
       */
      contract ERC721A is Context, ERC165, IERC721A {
          using Address for address;
          using Strings for uint256;
          // The tokenId of the next token to be minted.
          uint256 internal _currentIndex;
          // The number of tokens burned.
          uint256 internal _burnCounter;
          // Token name
          string private _name;
          // Token symbol
          string private _symbol;
          // Mapping from token ID to ownership details
          // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
          mapping(uint256 => TokenOwnership) internal _ownerships;
          // Mapping owner address to address data
          mapping(address => AddressData) private _addressData;
          // Mapping from token ID to approved address
          mapping(uint256 => address) private _tokenApprovals;
          // Mapping from owner to operator approvals
          mapping(address => mapping(address => bool)) private _operatorApprovals;
          constructor(string memory name_, string memory symbol_) {
              _name = name_;
              _symbol = symbol_;
              _currentIndex = _startTokenId();
          }
          /**
           * To change the starting tokenId, please override this function.
           */
          function _startTokenId() internal view virtual returns (uint256) {
              return 0;
          }
          /**
           * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
           */
          function totalSupply() public view override returns (uint256) {
              // Counter underflow is impossible as _burnCounter cannot be incremented
              // more than _currentIndex - _startTokenId() times
              unchecked {
                  return _currentIndex - _burnCounter - _startTokenId();
              }
          }
          /**
           * Returns the total amount of tokens minted in the contract.
           */
          function _totalMinted() internal view returns (uint256) {
              // Counter underflow is impossible as _currentIndex does not decrement,
              // and it is initialized to _startTokenId()
              unchecked {
                  return _currentIndex - _startTokenId();
              }
          }
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
              return
                  interfaceId == type(IERC721).interfaceId ||
                  interfaceId == type(IERC721Metadata).interfaceId ||
                  super.supportsInterface(interfaceId);
          }
          /**
           * @dev See {IERC721-balanceOf}.
           */
          function balanceOf(address owner) public view override returns (uint256) {
              if (owner == address(0)) revert BalanceQueryForZeroAddress();
              return uint256(_addressData[owner].balance);
          }
          /**
           * Returns the number of tokens minted by `owner`.
           */
          function _numberMinted(address owner) internal view returns (uint256) {
              return uint256(_addressData[owner].numberMinted);
          }
          /**
           * Returns the number of tokens burned by or on behalf of `owner`.
           */
          function _numberBurned(address owner) internal view returns (uint256) {
              return uint256(_addressData[owner].numberBurned);
          }
          /**
           * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
           */
          function _getAux(address owner) internal view returns (uint64) {
              return _addressData[owner].aux;
          }
          /**
           * Sets the auxillary 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 {
              _addressData[owner].aux = aux;
          }
          /**
           * Gas spent here starts off proportional to the maximum mint batch size.
           * It gradually moves to O(1) as tokens get transferred around in the collection over time.
           */
          function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
              uint256 curr = tokenId;
              unchecked {
                  if (_startTokenId() <= curr) if (curr < _currentIndex) {
                      TokenOwnership memory ownership = _ownerships[curr];
                      if (!ownership.burned) {
                          if (ownership.addr != address(0)) {
                              return ownership;
                          }
                          // Invariant:
                          // There will always be an ownership that has an address and is not burned
                          // before an ownership that does not have an address and is not burned.
                          // Hence, curr will not underflow.
                          while (true) {
                              curr--;
                              ownership = _ownerships[curr];
                              if (ownership.addr != address(0)) {
                                  return ownership;
                              }
                          }
                      }
                  }
              }
              revert OwnerQueryForNonexistentToken();
          }
          /**
           * @dev See {IERC721-ownerOf}.
           */
          function ownerOf(uint256 tokenId) public view override returns (address) {
              return _ownershipOf(tokenId).addr;
          }
          /**
           * @dev See {IERC721Metadata-name}.
           */
          function name() public view virtual override returns (string memory) {
              return _name;
          }
          /**
           * @dev See {IERC721Metadata-symbol}.
           */
          function symbol() public view virtual override returns (string memory) {
              return _symbol;
          }
          /**
           * @dev See {IERC721Metadata-tokenURI}.
           */
          function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
              if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
              string memory baseURI = _baseURI();
              return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : '';
          }
          /**
           * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
           * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
           * by default, can be overriden in child contracts.
           */
          function _baseURI() internal view virtual returns (string memory) {
              return '';
          }
          /**
           * @dev See {IERC721-approve}.
           */
          function approve(address to, uint256 tokenId) public override {
              address owner = ERC721A.ownerOf(tokenId);
              if (to == owner) revert ApprovalToCurrentOwner();
              if (_msgSender() != owner) if(!isApprovedForAll(owner, _msgSender())) {
                  revert ApprovalCallerNotOwnerNorApproved();
              }
              _approve(to, tokenId, owner);
          }
          /**
           * @dev See {IERC721-getApproved}.
           */
          function getApproved(uint256 tokenId) public view override returns (address) {
              if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
              return _tokenApprovals[tokenId];
          }
          /**
           * @dev See {IERC721-setApprovalForAll}.
           */
          function setApprovalForAll(address operator, bool approved) public virtual override {
              if (operator == _msgSender()) revert ApproveToCaller();
              _operatorApprovals[_msgSender()][operator] = approved;
              emit ApprovalForAll(_msgSender(), operator, approved);
          }
          /**
           * @dev See {IERC721-isApprovedForAll}.
           */
          function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
              return _operatorApprovals[owner][operator];
          }
          /**
           * @dev See {IERC721-transferFrom}.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              _transfer(from, to, tokenId);
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              safeTransferFrom(from, to, tokenId, '');
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) public virtual override {
              _transfer(from, to, tokenId);
              if (to.isContract()) if(!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                  revert TransferToNonERC721ReceiverImplementer();
              }
          }
          /**
           * @dev Returns whether `tokenId` exists.
           *
           * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
           *
           * Tokens start existing when they are minted (`_mint`),
           */
          function _exists(uint256 tokenId) internal view returns (bool) {
              return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;
          }
          /**
           * @dev Equivalent to `_safeMint(to, quantity, '')`.
           */
          function _safeMint(address to, uint256 quantity) internal {
              _safeMint(to, 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.
           *
           * Emits a {Transfer} event.
           */
          function _safeMint(
              address to,
              uint256 quantity,
              bytes memory _data
          ) internal {
              uint256 startTokenId = _currentIndex;
              if (to == address(0)) revert MintToZeroAddress();
              if (quantity == 0) revert MintZeroQuantity();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are incredibly unrealistic.
              // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
              // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
              unchecked {
                  _addressData[to].balance += uint64(quantity);
                  _addressData[to].numberMinted += uint64(quantity);
                  _ownerships[startTokenId].addr = to;
                  _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
                  uint256 updatedIndex = startTokenId;
                  uint256 end = updatedIndex + quantity;
                  if (to.isContract()) {
                      do {
                          emit Transfer(address(0), to, updatedIndex);
                          if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
                              revert TransferToNonERC721ReceiverImplementer();
                          }
                      } while (updatedIndex < end);
                      // Reentrancy protection
                      if (_currentIndex != startTokenId) revert();
                  } else {
                      do {
                          emit Transfer(address(0), to, updatedIndex++);
                      } while (updatedIndex < end);
                  }
                  _currentIndex = updatedIndex;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
          /**
           * @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.
           */
          function _mint(address to, uint256 quantity) internal {
              uint256 startTokenId = _currentIndex;
              if (to == address(0)) revert MintToZeroAddress();
              if (quantity == 0) revert MintZeroQuantity();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are incredibly unrealistic.
              // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
              // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
              unchecked {
                  _addressData[to].balance += uint64(quantity);
                  _addressData[to].numberMinted += uint64(quantity);
                  _ownerships[startTokenId].addr = to;
                  _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
                  uint256 updatedIndex = startTokenId;
                  uint256 end = updatedIndex + quantity;
                  do {
                      emit Transfer(address(0), to, updatedIndex++);
                  } while (updatedIndex < end);
                  _currentIndex = updatedIndex;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           *
           * Emits a {Transfer} event.
           */
          function _transfer(
              address from,
              address to,
              uint256 tokenId
          ) private {
              TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
              if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
              bool isApprovedOrOwner = (_msgSender() == from ||
                  isApprovedForAll(from, _msgSender()) ||
                  getApproved(tokenId) == _msgSender());
              if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
              if (to == address(0)) revert TransferToZeroAddress();
              _beforeTokenTransfers(from, to, tokenId, 1);
              // Clear approvals from the previous owner
              _approve(address(0), tokenId, from);
              // 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 {
                  _addressData[from].balance -= 1;
                  _addressData[to].balance += 1;
                  TokenOwnership storage currSlot = _ownerships[tokenId];
                  currSlot.addr = to;
                  currSlot.startTimestamp = uint64(block.timestamp);
                  // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
                  // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
                  uint256 nextTokenId = tokenId + 1;
                  TokenOwnership storage nextSlot = _ownerships[nextTokenId];
                  if (nextSlot.addr == address(0)) {
                      // This will suffice for checking _exists(nextTokenId),
                      // as a burned slot cannot contain the zero address.
                      if (nextTokenId != _currentIndex) {
                          nextSlot.addr = from;
                          nextSlot.startTimestamp = prevOwnership.startTimestamp;
                      }
                  }
              }
              emit Transfer(from, to, tokenId);
              _afterTokenTransfers(from, to, tokenId, 1);
          }
          /**
           * @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 {
              TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
              address from = prevOwnership.addr;
              if (approvalCheck) {
                  bool isApprovedOrOwner = (_msgSender() == from ||
                      isApprovedForAll(from, _msgSender()) ||
                      getApproved(tokenId) == _msgSender());
                  if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
              }
              _beforeTokenTransfers(from, address(0), tokenId, 1);
              // Clear approvals from the previous owner
              _approve(address(0), tokenId, from);
              // 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 {
                  AddressData storage addressData = _addressData[from];
                  addressData.balance -= 1;
                  addressData.numberBurned += 1;
                  // Keep track of who burned the token, and the timestamp of burning.
                  TokenOwnership storage currSlot = _ownerships[tokenId];
                  currSlot.addr = from;
                  currSlot.startTimestamp = uint64(block.timestamp);
                  currSlot.burned = true;
                  // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
                  // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
                  uint256 nextTokenId = tokenId + 1;
                  TokenOwnership storage nextSlot = _ownerships[nextTokenId];
                  if (nextSlot.addr == address(0)) {
                      // This will suffice for checking _exists(nextTokenId),
                      // as a burned slot cannot contain the zero address.
                      if (nextTokenId != _currentIndex) {
                          nextSlot.addr = from;
                          nextSlot.startTimestamp = prevOwnership.startTimestamp;
                      }
                  }
              }
              emit Transfer(from, address(0), tokenId);
              _afterTokenTransfers(from, address(0), tokenId, 1);
              // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
              unchecked {
                  _burnCounter++;
              }
          }
          /**
           * @dev Approve `to` to operate on `tokenId`
           *
           * Emits a {Approval} event.
           */
          function _approve(
              address to,
              uint256 tokenId,
              address owner
          ) private {
              _tokenApprovals[tokenId] = to;
              emit Approval(owner, to, tokenId);
          }
          /**
           * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
           *
           * @param from address representing the previous owner of the given token ID
           * @param to target address that will receive the tokens
           * @param tokenId uint256 ID of the token to be transferred
           * @param _data bytes optional data to send along with the call
           * @return bool whether the call correctly returned the expected magic value
           */
          function _checkContractOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) private returns (bool) {
              try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                  return retval == IERC721Receiver(to).onERC721Received.selector;
              } catch (bytes memory reason) {
                  if (reason.length == 0) {
                      revert TransferToNonERC721ReceiverImplementer();
                  } else {
                      assembly {
                          revert(add(32, reason), mload(reason))
                      }
                  }
              }
          }
          /**
           * @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 {}
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import './IERC721AQueryable.sol';
      import '../ERC721A.sol';
      /**
       * @title ERC721A Queryable
       * @dev ERC721A subclass with convenience query functions.
       */
      abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
          /**
           * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
           *
           * If the `tokenId` is out of bounds:
           *   - `addr` = `address(0)`
           *   - `startTimestamp` = `0`
           *   - `burned` = `false`
           *
           * If the `tokenId` is burned:
           *   - `addr` = `<Address of owner before token was burned>`
           *   - `startTimestamp` = `<Timestamp when token was burned>`
           *   - `burned = `true`
           *
           * Otherwise:
           *   - `addr` = `<Address of owner>`
           *   - `startTimestamp` = `<Timestamp of start of ownership>`
           *   - `burned = `false`
           */
          function explicitOwnershipOf(uint256 tokenId) public view override returns (TokenOwnership memory) {
              TokenOwnership memory ownership;
              if (tokenId < _startTokenId() || tokenId >= _currentIndex) {
                  return ownership;
              }
              ownership = _ownerships[tokenId];
              if (ownership.burned) {
                  return ownership;
              }
              return _ownershipOf(tokenId);
          }
          /**
           * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
           * See {ERC721AQueryable-explicitOwnershipOf}
           */
          function explicitOwnershipsOf(uint256[] memory tokenIds) external view override returns (TokenOwnership[] memory) {
              unchecked {
                  uint256 tokenIdsLength = tokenIds.length;
                  TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength);
                  for (uint256 i; i != tokenIdsLength; ++i) {
                      ownerships[i] = explicitOwnershipOf(tokenIds[i]);
                  }
                  return ownerships;
              }
          }
          /**
           * @dev Returns an array of token IDs owned by `owner`,
           * in the range [`start`, `stop`)
           * (i.e. `start <= tokenId < stop`).
           *
           * This function allows for tokens to be queried if the collection
           * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
           *
           * Requirements:
           *
           * - `start` < `stop`
           */
          function tokensOfOwnerIn(
              address owner,
              uint256 start,
              uint256 stop
          ) external view override returns (uint256[] memory) {
              unchecked {
                  if (start >= stop) revert InvalidQueryRange();
                  uint256 tokenIdsIdx;
                  uint256 stopLimit = _currentIndex;
                  // Set `start = max(start, _startTokenId())`.
                  if (start < _startTokenId()) {
                      start = _startTokenId();
                  }
                  // Set `stop = min(stop, _currentIndex)`.
                  if (stop > stopLimit) {
                      stop = stopLimit;
                  }
                  uint256 tokenIdsMaxLength = balanceOf(owner);
                  // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`,
                  // to cater for cases where `balanceOf(owner)` is too big.
                  if (start < stop) {
                      uint256 rangeLength = stop - start;
                      if (rangeLength < tokenIdsMaxLength) {
                          tokenIdsMaxLength = rangeLength;
                      }
                  } else {
                      tokenIdsMaxLength = 0;
                  }
                  uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength);
                  if (tokenIdsMaxLength == 0) {
                      return tokenIds;
                  }
                  // We need to call `explicitOwnershipOf(start)`,
                  // because the slot at `start` may not be initialized.
                  TokenOwnership memory ownership = explicitOwnershipOf(start);
                  address currOwnershipAddr;
                  // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`.
                  // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range.
                  if (!ownership.burned) {
                      currOwnershipAddr = ownership.addr;
                  }
                  for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) {
                      ownership = _ownerships[i];
                      if (ownership.burned) {
                          continue;
                      }
                      if (ownership.addr != address(0)) {
                          currOwnershipAddr = ownership.addr;
                      }
                      if (currOwnershipAddr == owner) {
                          tokenIds[tokenIdsIdx++] = i;
                      }
                  }
                  // Downsize the array to fit.
                  assembly {
                      mstore(tokenIds, tokenIdsIdx)
                  }
                  return tokenIds;
              }
          }
          /**
           * @dev Returns an array of token IDs owned by `owner`.
           *
           * This function scans the ownership mapping and is O(totalSupply) in complexity.
           * It is meant to be called off-chain.
           *
           * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
           * multiple smaller scans if the collection is large enough to cause
           * an out-of-gas error (10K pfp collections should be fine).
           */
          function tokensOfOwner(address owner) external view override returns (uint256[] memory) {
              unchecked {
                  uint256 tokenIdsIdx;
                  address currOwnershipAddr;
                  uint256 tokenIdsLength = balanceOf(owner);
                  uint256[] memory tokenIds = new uint256[](tokenIdsLength);
                  TokenOwnership memory ownership;
                  for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
                      ownership = _ownerships[i];
                      if (ownership.burned) {
                          continue;
                      }
                      if (ownership.addr != address(0)) {
                          currOwnershipAddr = ownership.addr;
                      }
                      if (currOwnershipAddr == owner) {
                          tokenIds[tokenIdsIdx++] = i;
                      }
                  }
                  return tokenIds;
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import '../IERC721A.sol';
      /**
       * @dev Interface of an ERC721AQueryable compliant contract.
       */
      interface IERC721AQueryable is IERC721A {
          /**
           * Invalid query range (`start` >= `stop`).
           */
          error InvalidQueryRange();
          /**
           * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
           *
           * If the `tokenId` is out of bounds:
           *   - `addr` = `address(0)`
           *   - `startTimestamp` = `0`
           *   - `burned` = `false`
           *
           * If the `tokenId` is burned:
           *   - `addr` = `<Address of owner before token was burned>`
           *   - `startTimestamp` = `<Timestamp when token was burned>`
           *   - `burned = `true`
           *
           * Otherwise:
           *   - `addr` = `<Address of owner>`
           *   - `startTimestamp` = `<Timestamp of start of ownership>`
           *   - `burned = `false`
           */
          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 pfp collections should be fine).
           */
          function tokensOfOwner(address owner) external view returns (uint256[] memory);
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
      import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
      /**
       * @dev Interface of an ERC721A compliant contract.
       */
      interface IERC721A is IERC721, IERC721Metadata {
          /**
           * The caller must own the token or be an approved operator.
           */
          error ApprovalCallerNotOwnerNorApproved();
          /**
           * The token does not exist.
           */
          error ApprovalQueryForNonexistentToken();
          /**
           * The caller cannot approve to their own address.
           */
          error ApproveToCaller();
          /**
           * The caller cannot approve to the current owner.
           */
          error ApprovalToCurrentOwner();
          /**
           * 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();
          // Compiler will pack this into a single 256bit word.
          struct TokenOwnership {
              // The address of the owner.
              address addr;
              // Keeps track of the start time of ownership with minimal overhead for tokenomics.
              uint64 startTimestamp;
              // Whether the token has been burned.
              bool burned;
          }
          // Compiler will pack this into a single 256bit word.
          struct AddressData {
              // Realistically, 2**64-1 is more than enough.
              uint64 balance;
              // Keeps track of mint count with minimal overhead for tokenomics.
              uint64 numberMinted;
              // Keeps track of burn count with minimal overhead for tokenomics.
              uint64 numberBurned;
              // For miscellaneous variable(s) pertaining to the address
              // (e.g. number of whitelist mint slots used).
              // If there are multiple variables, please pack them into a uint64.
              uint64 aux;
          }
          /**
           * @dev Returns the total amount of tokens stored by the contract.
           * 
           * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
           */
          function totalSupply() external view returns (uint256);
      }
      

      File 9 of 10: SIMCARD1
      // SPDX-License-Identifier: MIT
      pragma solidity >=0.8.9 <0.9.0;
      import 'erc721a/contracts/extensions/ERC721AQueryable.sol';
      import '@openzeppelin/contracts/access/Ownable.sol';
      import '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';
      import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
      contract SIMCARD1 is ERC721AQueryable, Ownable, ReentrancyGuard {
        using Strings for uint256;
        bytes32 public merkleRoot;
        mapping(address => bool) public whitelistClaimed;
        string public uriPrefix = '';
        string public uriSuffix = '.json';
        string public hiddenMetadataUri;
        
        uint256 public cost;
        uint256 public maxSupply;
        uint256 public maxMintAmountPerTx;
        bool public paused = true;
        bool public whitelistMintEnabled = false;
        bool public revealed = false;
        constructor(
          string memory _tokenName,
          string memory _tokenSymbol,
          uint256 _cost,
          uint256 _maxSupply,
          uint256 _maxMintAmountPerTx,
          string memory _hiddenMetadataUri
        ) ERC721A(_tokenName, _tokenSymbol) {
          setCost(_cost);
          maxSupply = _maxSupply;
          setMaxMintAmountPerTx(_maxMintAmountPerTx);
          setHiddenMetadataUri(_hiddenMetadataUri);
        }
        modifier mintCompliance(uint256 _mintAmount) {
          require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, 'Invalid mint amount!');
          require(totalSupply() + _mintAmount <= maxSupply, 'Max supply exceeded!');
          _;
        }
        modifier mintPriceCompliance(uint256 _mintAmount) {
          require(msg.value >= cost * _mintAmount, 'Insufficient funds!');
          _;
        }
        function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
          // Verify whitelist requirements
          require(whitelistMintEnabled, 'The whitelist sale is not enabled!');
          require(!whitelistClaimed[_msgSender()], 'Address already claimed!');
          bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));
          require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), 'Invalid proof!');
          whitelistClaimed[_msgSender()] = true;
          _safeMint(_msgSender(), _mintAmount);
        }
        function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {
          require(!paused, 'The contract is paused!');
          _safeMint(_msgSender(), _mintAmount);
        }
        
        function mintForAddress(uint256 _mintAmount, address _receiver) public mintCompliance(_mintAmount) onlyOwner {
          _safeMint(_receiver, _mintAmount);
        }
        function _startTokenId() internal view virtual override returns (uint256) {
          return 1;
        }
        function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {
          require(_exists(_tokenId), 'ERC721Metadata: URI query for nonexistent token');
          if (revealed == false) {
            return hiddenMetadataUri;
          }
          string memory currentBaseURI = _baseURI();
          return bytes(currentBaseURI).length > 0
              ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriSuffix))
              : '';
        }
        function setRevealed(bool _state) public onlyOwner {
          revealed = _state;
        }
        function setCost(uint256 _cost) public onlyOwner {
          cost = _cost;
        }
        function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner {
          maxMintAmountPerTx = _maxMintAmountPerTx;
        }
        function setHiddenMetadataUri(string memory _hiddenMetadataUri) public onlyOwner {
          hiddenMetadataUri = _hiddenMetadataUri;
        }
        function setUriPrefix(string memory _uriPrefix) public onlyOwner {
          uriPrefix = _uriPrefix;
        }
        function setUriSuffix(string memory _uriSuffix) public onlyOwner {
          uriSuffix = _uriSuffix;
        }
        function setPaused(bool _state) public onlyOwner {
          paused = _state;
        }
        function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner {
          merkleRoot = _merkleRoot;
        }
        function setWhitelistMintEnabled(bool _state) public onlyOwner {
          whitelistMintEnabled = _state;
        }
        function withdraw() public onlyOwner nonReentrant {
         
          // This will transfer the remaining contract balance to the owner.
          // Do not remove this otherwise you will not be able to withdraw the funds.
          // =============================================================================
          (bool os, ) = payable(owner()).call{value: address(this).balance}('');
          require(os);
          // =============================================================================
        }
        function _baseURI() internal view virtual override returns (string memory) {
          return uriPrefix;
        }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import './IERC721AQueryable.sol';
      import '../ERC721A.sol';
      /**
       * @title ERC721A Queryable
       * @dev ERC721A subclass with convenience query functions.
       */
      abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {
          /**
           * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
           *
           * If the `tokenId` is out of bounds:
           *   - `addr` = `address(0)`
           *   - `startTimestamp` = `0`
           *   - `burned` = `false`
           *
           * If the `tokenId` is burned:
           *   - `addr` = `<Address of owner before token was burned>`
           *   - `startTimestamp` = `<Timestamp when token was burned>`
           *   - `burned = `true`
           *
           * Otherwise:
           *   - `addr` = `<Address of owner>`
           *   - `startTimestamp` = `<Timestamp of start of ownership>`
           *   - `burned = `false`
           */
          function explicitOwnershipOf(uint256 tokenId) public view override returns (TokenOwnership memory) {
              TokenOwnership memory ownership;
              if (tokenId < _startTokenId() || tokenId >= _currentIndex) {
                  return ownership;
              }
              ownership = _ownerships[tokenId];
              if (ownership.burned) {
                  return ownership;
              }
              return _ownershipOf(tokenId);
          }
          /**
           * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order.
           * See {ERC721AQueryable-explicitOwnershipOf}
           */
          function explicitOwnershipsOf(uint256[] memory tokenIds) external view override returns (TokenOwnership[] memory) {
              unchecked {
                  uint256 tokenIdsLength = tokenIds.length;
                  TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength);
                  for (uint256 i; i != tokenIdsLength; ++i) {
                      ownerships[i] = explicitOwnershipOf(tokenIds[i]);
                  }
                  return ownerships;
              }
          }
          /**
           * @dev Returns an array of token IDs owned by `owner`,
           * in the range [`start`, `stop`)
           * (i.e. `start <= tokenId < stop`).
           *
           * This function allows for tokens to be queried if the collection
           * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}.
           *
           * Requirements:
           *
           * - `start` < `stop`
           */
          function tokensOfOwnerIn(
              address owner,
              uint256 start,
              uint256 stop
          ) external view override returns (uint256[] memory) {
              unchecked {
                  if (start >= stop) revert InvalidQueryRange();
                  uint256 tokenIdsIdx;
                  uint256 stopLimit = _currentIndex;
                  // Set `start = max(start, _startTokenId())`.
                  if (start < _startTokenId()) {
                      start = _startTokenId();
                  }
                  // Set `stop = min(stop, _currentIndex)`.
                  if (stop > stopLimit) {
                      stop = stopLimit;
                  }
                  uint256 tokenIdsMaxLength = balanceOf(owner);
                  // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`,
                  // to cater for cases where `balanceOf(owner)` is too big.
                  if (start < stop) {
                      uint256 rangeLength = stop - start;
                      if (rangeLength < tokenIdsMaxLength) {
                          tokenIdsMaxLength = rangeLength;
                      }
                  } else {
                      tokenIdsMaxLength = 0;
                  }
                  uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength);
                  if (tokenIdsMaxLength == 0) {
                      return tokenIds;
                  }
                  // We need to call `explicitOwnershipOf(start)`,
                  // because the slot at `start` may not be initialized.
                  TokenOwnership memory ownership = explicitOwnershipOf(start);
                  address currOwnershipAddr;
                  // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`.
                  // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range.
                  if (!ownership.burned) {
                      currOwnershipAddr = ownership.addr;
                  }
                  for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) {
                      ownership = _ownerships[i];
                      if (ownership.burned) {
                          continue;
                      }
                      if (ownership.addr != address(0)) {
                          currOwnershipAddr = ownership.addr;
                      }
                      if (currOwnershipAddr == owner) {
                          tokenIds[tokenIdsIdx++] = i;
                      }
                  }
                  // Downsize the array to fit.
                  assembly {
                      mstore(tokenIds, tokenIdsIdx)
                  }
                  return tokenIds;
              }
          }
          /**
           * @dev Returns an array of token IDs owned by `owner`.
           *
           * This function scans the ownership mapping and is O(totalSupply) in complexity.
           * It is meant to be called off-chain.
           *
           * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
           * multiple smaller scans if the collection is large enough to cause
           * an out-of-gas error (10K pfp collections should be fine).
           */
          function tokensOfOwner(address owner) external view override returns (uint256[] memory) {
              unchecked {
                  uint256 tokenIdsIdx;
                  address currOwnershipAddr;
                  uint256 tokenIdsLength = balanceOf(owner);
                  uint256[] memory tokenIds = new uint256[](tokenIdsLength);
                  TokenOwnership memory ownership;
                  for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
                      ownership = _ownerships[i];
                      if (ownership.burned) {
                          continue;
                      }
                      if (ownership.addr != address(0)) {
                          currOwnershipAddr = ownership.addr;
                      }
                      if (currOwnershipAddr == owner) {
                          tokenIds[tokenIdsIdx++] = i;
                      }
                  }
                  return tokenIds;
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
      pragma solidity ^0.8.0;
      import "../utils/Context.sol";
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract Ownable is Context {
          address private _owner;
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          constructor() {
              _transferOwnership(_msgSender());
          }
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              require(owner() == _msgSender(), "Ownable: caller is not the owner");
              _;
          }
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              _transferOwnership(address(0));
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              _transferOwnership(newOwner);
          }
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Internal function without access restriction.
           */
          function _transferOwnership(address newOwner) internal virtual {
              address oldOwner = _owner;
              _owner = newOwner;
              emit OwnershipTransferred(oldOwner, newOwner);
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev These functions deal with verification of Merkle Trees proofs.
       *
       * The proofs can be generated using the JavaScript library
       * https://github.com/miguelmota/merkletreejs[merkletreejs].
       * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
       *
       * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
       */
      library MerkleProof {
          /**
           * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
           * defined by `root`. For this, a `proof` must be provided, containing
           * sibling hashes on the branch from the leaf to the root of the tree. Each
           * pair of leaves and each pair of pre-images are assumed to be sorted.
           */
          function verify(
              bytes32[] memory proof,
              bytes32 root,
              bytes32 leaf
          ) internal pure returns (bool) {
              return processProof(proof, leaf) == root;
          }
          /**
           * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
           * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
           * hash matches the root of the tree. When processing the proof, the pairs
           * of leafs & pre-images are assumed to be sorted.
           *
           * _Available since v4.4._
           */
          function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
              bytes32 computedHash = leaf;
              for (uint256 i = 0; i < proof.length; i++) {
                  bytes32 proofElement = proof[i];
                  if (computedHash <= proofElement) {
                      // Hash(current computed hash + current element of the proof)
                      computedHash = _efficientHash(computedHash, proofElement);
                  } else {
                      // Hash(current element of the proof + current computed hash)
                      computedHash = _efficientHash(proofElement, computedHash);
                  }
              }
              return computedHash;
          }
          function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
              assembly {
                  mstore(0x00, a)
                  mstore(0x20, b)
                  value := keccak256(0x00, 0x40)
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Contract module that helps prevent reentrant calls to a function.
       *
       * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
       * available, which can be applied to functions to make sure there are no nested
       * (reentrant) calls to them.
       *
       * Note that because there is a single `nonReentrant` guard, functions marked as
       * `nonReentrant` may not call one another. This can be worked around by making
       * those functions `private`, and then adding `external` `nonReentrant` entry
       * points to them.
       *
       * TIP: If you would like to learn more about reentrancy and alternative ways
       * to protect against it, check out our blog post
       * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
       */
      abstract contract ReentrancyGuard {
          // Booleans are more expensive than uint256 or any type that takes up a full
          // word because each write operation emits an extra SLOAD to first read the
          // slot's contents, replace the bits taken up by the boolean, and then write
          // back. This is the compiler's defense against contract upgrades and
          // pointer aliasing, and it cannot be disabled.
          // The values being non-zero value makes deployment a bit more expensive,
          // but in exchange the refund on every call to nonReentrant will be lower in
          // amount. Since refunds are capped to a percentage of the total
          // transaction's gas, it is best to keep them low in cases like this one, to
          // increase the likelihood of the full refund coming into effect.
          uint256 private constant _NOT_ENTERED = 1;
          uint256 private constant _ENTERED = 2;
          uint256 private _status;
          constructor() {
              _status = _NOT_ENTERED;
          }
          /**
           * @dev Prevents a contract from calling itself, directly or indirectly.
           * Calling a `nonReentrant` function from another `nonReentrant`
           * function is not supported. It is possible to prevent this from happening
           * by making the `nonReentrant` function external, and making it call a
           * `private` function that does the actual work.
           */
          modifier nonReentrant() {
              // On the first call to nonReentrant, _notEntered will be true
              require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
              // Any calls to nonReentrant after this point will fail
              _status = _ENTERED;
              _;
              // By storing the original value once again, a refund is triggered (see
              // https://eips.ethereum.org/EIPS/eip-2200)
              _status = _NOT_ENTERED;
          }
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import '../IERC721A.sol';
      /**
       * @dev Interface of an ERC721AQueryable compliant contract.
       */
      interface IERC721AQueryable is IERC721A {
          /**
           * Invalid query range (`start` >= `stop`).
           */
          error InvalidQueryRange();
          /**
           * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.
           *
           * If the `tokenId` is out of bounds:
           *   - `addr` = `address(0)`
           *   - `startTimestamp` = `0`
           *   - `burned` = `false`
           *
           * If the `tokenId` is burned:
           *   - `addr` = `<Address of owner before token was burned>`
           *   - `startTimestamp` = `<Timestamp when token was burned>`
           *   - `burned = `true`
           *
           * Otherwise:
           *   - `addr` = `<Address of owner>`
           *   - `startTimestamp` = `<Timestamp of start of ownership>`
           *   - `burned = `false`
           */
          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 pfp collections should be fine).
           */
          function tokensOfOwner(address owner) external view returns (uint256[] memory);
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import './IERC721A.sol';
      import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
      import '@openzeppelin/contracts/utils/Address.sol';
      import '@openzeppelin/contracts/utils/Context.sol';
      import '@openzeppelin/contracts/utils/Strings.sol';
      import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
      /**
       * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
       * the Metadata extension. Built to optimize for lower gas during batch mints.
       *
       * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
       *
       * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
       *
       * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
       */
      contract ERC721A is Context, ERC165, IERC721A {
          using Address for address;
          using Strings for uint256;
          // The tokenId of the next token to be minted.
          uint256 internal _currentIndex;
          // The number of tokens burned.
          uint256 internal _burnCounter;
          // Token name
          string private _name;
          // Token symbol
          string private _symbol;
          // Mapping from token ID to ownership details
          // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
          mapping(uint256 => TokenOwnership) internal _ownerships;
          // Mapping owner address to address data
          mapping(address => AddressData) private _addressData;
          // Mapping from token ID to approved address
          mapping(uint256 => address) private _tokenApprovals;
          // Mapping from owner to operator approvals
          mapping(address => mapping(address => bool)) private _operatorApprovals;
          constructor(string memory name_, string memory symbol_) {
              _name = name_;
              _symbol = symbol_;
              _currentIndex = _startTokenId();
          }
          /**
           * To change the starting tokenId, please override this function.
           */
          function _startTokenId() internal view virtual returns (uint256) {
              return 0;
          }
          /**
           * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
           */
          function totalSupply() public view override returns (uint256) {
              // Counter underflow is impossible as _burnCounter cannot be incremented
              // more than _currentIndex - _startTokenId() times
              unchecked {
                  return _currentIndex - _burnCounter - _startTokenId();
              }
          }
          /**
           * Returns the total amount of tokens minted in the contract.
           */
          function _totalMinted() internal view returns (uint256) {
              // Counter underflow is impossible as _currentIndex does not decrement,
              // and it is initialized to _startTokenId()
              unchecked {
                  return _currentIndex - _startTokenId();
              }
          }
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
              return
                  interfaceId == type(IERC721).interfaceId ||
                  interfaceId == type(IERC721Metadata).interfaceId ||
                  super.supportsInterface(interfaceId);
          }
          /**
           * @dev See {IERC721-balanceOf}.
           */
          function balanceOf(address owner) public view override returns (uint256) {
              if (owner == address(0)) revert BalanceQueryForZeroAddress();
              return uint256(_addressData[owner].balance);
          }
          /**
           * Returns the number of tokens minted by `owner`.
           */
          function _numberMinted(address owner) internal view returns (uint256) {
              return uint256(_addressData[owner].numberMinted);
          }
          /**
           * Returns the number of tokens burned by or on behalf of `owner`.
           */
          function _numberBurned(address owner) internal view returns (uint256) {
              return uint256(_addressData[owner].numberBurned);
          }
          /**
           * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
           */
          function _getAux(address owner) internal view returns (uint64) {
              return _addressData[owner].aux;
          }
          /**
           * Sets the auxillary 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 {
              _addressData[owner].aux = aux;
          }
          /**
           * Gas spent here starts off proportional to the maximum mint batch size.
           * It gradually moves to O(1) as tokens get transferred around in the collection over time.
           */
          function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
              uint256 curr = tokenId;
              unchecked {
                  if (_startTokenId() <= curr) if (curr < _currentIndex) {
                      TokenOwnership memory ownership = _ownerships[curr];
                      if (!ownership.burned) {
                          if (ownership.addr != address(0)) {
                              return ownership;
                          }
                          // Invariant:
                          // There will always be an ownership that has an address and is not burned
                          // before an ownership that does not have an address and is not burned.
                          // Hence, curr will not underflow.
                          while (true) {
                              curr--;
                              ownership = _ownerships[curr];
                              if (ownership.addr != address(0)) {
                                  return ownership;
                              }
                          }
                      }
                  }
              }
              revert OwnerQueryForNonexistentToken();
          }
          /**
           * @dev See {IERC721-ownerOf}.
           */
          function ownerOf(uint256 tokenId) public view override returns (address) {
              return _ownershipOf(tokenId).addr;
          }
          /**
           * @dev See {IERC721Metadata-name}.
           */
          function name() public view virtual override returns (string memory) {
              return _name;
          }
          /**
           * @dev See {IERC721Metadata-symbol}.
           */
          function symbol() public view virtual override returns (string memory) {
              return _symbol;
          }
          /**
           * @dev See {IERC721Metadata-tokenURI}.
           */
          function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
              if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
              string memory baseURI = _baseURI();
              return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : '';
          }
          /**
           * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
           * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
           * by default, can be overriden in child contracts.
           */
          function _baseURI() internal view virtual returns (string memory) {
              return '';
          }
          /**
           * @dev See {IERC721-approve}.
           */
          function approve(address to, uint256 tokenId) public override {
              address owner = ERC721A.ownerOf(tokenId);
              if (to == owner) revert ApprovalToCurrentOwner();
              if (_msgSender() != owner) if(!isApprovedForAll(owner, _msgSender())) {
                  revert ApprovalCallerNotOwnerNorApproved();
              }
              _approve(to, tokenId, owner);
          }
          /**
           * @dev See {IERC721-getApproved}.
           */
          function getApproved(uint256 tokenId) public view override returns (address) {
              if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
              return _tokenApprovals[tokenId];
          }
          /**
           * @dev See {IERC721-setApprovalForAll}.
           */
          function setApprovalForAll(address operator, bool approved) public virtual override {
              if (operator == _msgSender()) revert ApproveToCaller();
              _operatorApprovals[_msgSender()][operator] = approved;
              emit ApprovalForAll(_msgSender(), operator, approved);
          }
          /**
           * @dev See {IERC721-isApprovedForAll}.
           */
          function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
              return _operatorApprovals[owner][operator];
          }
          /**
           * @dev See {IERC721-transferFrom}.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              _transfer(from, to, tokenId);
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              safeTransferFrom(from, to, tokenId, '');
          }
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) public virtual override {
              _transfer(from, to, tokenId);
              if (to.isContract()) if(!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                  revert TransferToNonERC721ReceiverImplementer();
              }
          }
          /**
           * @dev Returns whether `tokenId` exists.
           *
           * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
           *
           * Tokens start existing when they are minted (`_mint`),
           */
          function _exists(uint256 tokenId) internal view returns (bool) {
              return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;
          }
          /**
           * @dev Equivalent to `_safeMint(to, quantity, '')`.
           */
          function _safeMint(address to, uint256 quantity) internal {
              _safeMint(to, 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.
           *
           * Emits a {Transfer} event.
           */
          function _safeMint(
              address to,
              uint256 quantity,
              bytes memory _data
          ) internal {
              uint256 startTokenId = _currentIndex;
              if (to == address(0)) revert MintToZeroAddress();
              if (quantity == 0) revert MintZeroQuantity();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are incredibly unrealistic.
              // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
              // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
              unchecked {
                  _addressData[to].balance += uint64(quantity);
                  _addressData[to].numberMinted += uint64(quantity);
                  _ownerships[startTokenId].addr = to;
                  _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
                  uint256 updatedIndex = startTokenId;
                  uint256 end = updatedIndex + quantity;
                  if (to.isContract()) {
                      do {
                          emit Transfer(address(0), to, updatedIndex);
                          if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
                              revert TransferToNonERC721ReceiverImplementer();
                          }
                      } while (updatedIndex < end);
                      // Reentrancy protection
                      if (_currentIndex != startTokenId) revert();
                  } else {
                      do {
                          emit Transfer(address(0), to, updatedIndex++);
                      } while (updatedIndex < end);
                  }
                  _currentIndex = updatedIndex;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
          /**
           * @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.
           */
          function _mint(address to, uint256 quantity) internal {
              uint256 startTokenId = _currentIndex;
              if (to == address(0)) revert MintToZeroAddress();
              if (quantity == 0) revert MintZeroQuantity();
              _beforeTokenTransfers(address(0), to, startTokenId, quantity);
              // Overflows are incredibly unrealistic.
              // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
              // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
              unchecked {
                  _addressData[to].balance += uint64(quantity);
                  _addressData[to].numberMinted += uint64(quantity);
                  _ownerships[startTokenId].addr = to;
                  _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
                  uint256 updatedIndex = startTokenId;
                  uint256 end = updatedIndex + quantity;
                  do {
                      emit Transfer(address(0), to, updatedIndex++);
                  } while (updatedIndex < end);
                  _currentIndex = updatedIndex;
              }
              _afterTokenTransfers(address(0), to, startTokenId, quantity);
          }
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           *
           * Emits a {Transfer} event.
           */
          function _transfer(
              address from,
              address to,
              uint256 tokenId
          ) private {
              TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
              if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
              bool isApprovedOrOwner = (_msgSender() == from ||
                  isApprovedForAll(from, _msgSender()) ||
                  getApproved(tokenId) == _msgSender());
              if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
              if (to == address(0)) revert TransferToZeroAddress();
              _beforeTokenTransfers(from, to, tokenId, 1);
              // Clear approvals from the previous owner
              _approve(address(0), tokenId, from);
              // 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 {
                  _addressData[from].balance -= 1;
                  _addressData[to].balance += 1;
                  TokenOwnership storage currSlot = _ownerships[tokenId];
                  currSlot.addr = to;
                  currSlot.startTimestamp = uint64(block.timestamp);
                  // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
                  // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
                  uint256 nextTokenId = tokenId + 1;
                  TokenOwnership storage nextSlot = _ownerships[nextTokenId];
                  if (nextSlot.addr == address(0)) {
                      // This will suffice for checking _exists(nextTokenId),
                      // as a burned slot cannot contain the zero address.
                      if (nextTokenId != _currentIndex) {
                          nextSlot.addr = from;
                          nextSlot.startTimestamp = prevOwnership.startTimestamp;
                      }
                  }
              }
              emit Transfer(from, to, tokenId);
              _afterTokenTransfers(from, to, tokenId, 1);
          }
          /**
           * @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 {
              TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
              address from = prevOwnership.addr;
              if (approvalCheck) {
                  bool isApprovedOrOwner = (_msgSender() == from ||
                      isApprovedForAll(from, _msgSender()) ||
                      getApproved(tokenId) == _msgSender());
                  if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
              }
              _beforeTokenTransfers(from, address(0), tokenId, 1);
              // Clear approvals from the previous owner
              _approve(address(0), tokenId, from);
              // 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 {
                  AddressData storage addressData = _addressData[from];
                  addressData.balance -= 1;
                  addressData.numberBurned += 1;
                  // Keep track of who burned the token, and the timestamp of burning.
                  TokenOwnership storage currSlot = _ownerships[tokenId];
                  currSlot.addr = from;
                  currSlot.startTimestamp = uint64(block.timestamp);
                  currSlot.burned = true;
                  // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
                  // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
                  uint256 nextTokenId = tokenId + 1;
                  TokenOwnership storage nextSlot = _ownerships[nextTokenId];
                  if (nextSlot.addr == address(0)) {
                      // This will suffice for checking _exists(nextTokenId),
                      // as a burned slot cannot contain the zero address.
                      if (nextTokenId != _currentIndex) {
                          nextSlot.addr = from;
                          nextSlot.startTimestamp = prevOwnership.startTimestamp;
                      }
                  }
              }
              emit Transfer(from, address(0), tokenId);
              _afterTokenTransfers(from, address(0), tokenId, 1);
              // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
              unchecked {
                  _burnCounter++;
              }
          }
          /**
           * @dev Approve `to` to operate on `tokenId`
           *
           * Emits a {Approval} event.
           */
          function _approve(
              address to,
              uint256 tokenId,
              address owner
          ) private {
              _tokenApprovals[tokenId] = to;
              emit Approval(owner, to, tokenId);
          }
          /**
           * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
           *
           * @param from address representing the previous owner of the given token ID
           * @param to target address that will receive the tokens
           * @param tokenId uint256 ID of the token to be transferred
           * @param _data bytes optional data to send along with the call
           * @return bool whether the call correctly returned the expected magic value
           */
          function _checkContractOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) private returns (bool) {
              try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                  return retval == IERC721Receiver(to).onERC721Received.selector;
              } catch (bytes memory reason) {
                  if (reason.length == 0) {
                      revert TransferToNonERC721ReceiverImplementer();
                  } else {
                      assembly {
                          revert(add(32, reason), mload(reason))
                      }
                  }
              }
          }
          /**
           * @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 {}
      }
      // SPDX-License-Identifier: MIT
      // ERC721A Contracts v3.3.0
      // Creator: Chiru Labs
      pragma solidity ^0.8.4;
      import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
      import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
      /**
       * @dev Interface of an ERC721A compliant contract.
       */
      interface IERC721A is IERC721, IERC721Metadata {
          /**
           * The caller must own the token or be an approved operator.
           */
          error ApprovalCallerNotOwnerNorApproved();
          /**
           * The token does not exist.
           */
          error ApprovalQueryForNonexistentToken();
          /**
           * The caller cannot approve to their own address.
           */
          error ApproveToCaller();
          /**
           * The caller cannot approve to the current owner.
           */
          error ApprovalToCurrentOwner();
          /**
           * 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();
          // Compiler will pack this into a single 256bit word.
          struct TokenOwnership {
              // The address of the owner.
              address addr;
              // Keeps track of the start time of ownership with minimal overhead for tokenomics.
              uint64 startTimestamp;
              // Whether the token has been burned.
              bool burned;
          }
          // Compiler will pack this into a single 256bit word.
          struct AddressData {
              // Realistically, 2**64-1 is more than enough.
              uint64 balance;
              // Keeps track of mint count with minimal overhead for tokenomics.
              uint64 numberMinted;
              // Keeps track of burn count with minimal overhead for tokenomics.
              uint64 numberBurned;
              // For miscellaneous variable(s) pertaining to the address
              // (e.g. number of whitelist mint slots used).
              // If there are multiple variables, please pack them into a uint64.
              uint64 aux;
          }
          /**
           * @dev Returns the total amount of tokens stored by the contract.
           * 
           * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
           */
          function totalSupply() external view returns (uint256);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
      pragma solidity ^0.8.0;
      import "../../utils/introspection/IERC165.sol";
      /**
       * @dev Required interface of an ERC721 compliant contract.
       */
      interface IERC721 is IERC165 {
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
          /**
           * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
          /**
           * @dev Returns the number of tokens in ``owner``'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, 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
          ) external;
          /**
           * @dev Transfers `tokenId` token 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;
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external;
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
          /**
           * @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 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);
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes calldata data
          ) external;
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
      pragma solidity ^0.8.0;
      import "../IERC721.sol";
      /**
       * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
       * @dev See https://eips.ethereum.org/EIPS/eip-721
       */
      interface IERC721Metadata is IERC721 {
          /**
           * @dev Returns the token collection name.
           */
          function name() external view returns (string memory);
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() external view returns (string memory);
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) external view returns (string memory);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165 {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
      pragma solidity ^0.8.0;
      /**
       * @title ERC721 token receiver interface
       * @dev Interface for any contract that wants to support safeTransfers
       * from ERC721 asset contracts.
       */
      interface IERC721Receiver {
          /**
           * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
           * by `operator` from `from`, this function is called.
           *
           * It must return its Solidity selector to confirm the token transfer.
           * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
           *
           * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
           */
          function onERC721Received(
              address operator,
              address from,
              uint256 tokenId,
              bytes calldata data
          ) external returns (bytes4);
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
      pragma solidity ^0.8.1;
      /**
       * @dev Collection of functions related to the address type
       */
      library Address {
          /**
           * @dev Returns true if `account` is a contract.
           *
           * [IMPORTANT]
           * ====
           * It is unsafe to assume that an address for which this function returns
           * false is an externally-owned account (EOA) and not a contract.
           *
           * Among others, `isContract` will return false for the following
           * types of addresses:
           *
           *  - an externally-owned account
           *  - a contract in construction
           *  - an address where a contract will be created
           *  - an address where a contract lived, but was destroyed
           * ====
           *
           * [IMPORTANT]
           * ====
           * You shouldn't rely on `isContract` to protect against flash loan attacks!
           *
           * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
           * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
           * constructor.
           * ====
           */
          function isContract(address account) internal view returns (bool) {
              // This method relies on extcodesize/address.code.length, which returns 0
              // for contracts in construction, since the code is only stored at the end
              // of the constructor execution.
              return account.code.length > 0;
          }
          /**
           * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
           * `recipient`, forwarding all available gas and reverting on errors.
           *
           * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
           * of certain opcodes, possibly making contracts go over the 2300 gas limit
           * imposed by `transfer`, making them unable to receive funds via
           * `transfer`. {sendValue} removes this limitation.
           *
           * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
           *
           * IMPORTANT: because control is transferred to `recipient`, care must be
           * taken to not create reentrancy vulnerabilities. Consider using
           * {ReentrancyGuard} or the
           * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
           */
          function sendValue(address payable recipient, uint256 amount) internal {
              require(address(this).balance >= amount, "Address: insufficient balance");
              (bool success, ) = recipient.call{value: amount}("");
              require(success, "Address: unable to send value, recipient may have reverted");
          }
          /**
           * @dev Performs a Solidity function call using a low level `call`. A
           * plain `call` is an unsafe replacement for a function call: use this
           * function instead.
           *
           * If `target` reverts with a revert reason, it is bubbled up by this
           * function (like regular Solidity function calls).
           *
           * Returns the raw returned data. To convert to the expected return value,
           * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
           *
           * Requirements:
           *
           * - `target` must be a contract.
           * - calling `target` with `data` must not revert.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionCall(target, data, "Address: low-level call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
           * `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but also transferring `value` wei to `target`.
           *
           * Requirements:
           *
           * - the calling contract must have an ETH balance of at least `value`.
           * - the called Solidity function must be `payable`.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
          }
          /**
           * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
           * with `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(address(this).balance >= value, "Address: insufficient balance for call");
              require(isContract(target), "Address: call to non-contract");
              (bool success, bytes memory returndata) = target.call{value: value}(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
              return functionStaticCall(target, data, "Address: low-level static call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              require(isContract(target), "Address: static call to non-contract");
              (bool success, bytes memory returndata) = target.staticcall(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionDelegateCall(target, data, "Address: low-level delegate call failed");
          }
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(isContract(target), "Address: delegate call to non-contract");
              (bool success, bytes memory returndata) = target.delegatecall(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
          /**
           * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
           * revert reason using the provided one.
           *
           * _Available since v4.3._
           */
          function verifyCallResult(
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal pure returns (bytes memory) {
              if (success) {
                  return returndata;
              } else {
                  // Look for revert reason and bubble it up if present
                  if (returndata.length > 0) {
                      // The easiest way to bubble the revert reason is using memory via assembly
                      assembly {
                          let returndata_size := mload(returndata)
                          revert(add(32, returndata), returndata_size)
                      }
                  } else {
                      revert(errorMessage);
                  }
              }
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev Provides information about the current execution context, including the
       * sender of the transaction and its data. While these are generally available
       * via msg.sender and msg.data, they should not be accessed in such a direct
       * manner, since when dealing with meta-transactions the account sending and
       * paying for execution may not be the actual sender (as far as an application
       * is concerned).
       *
       * This contract is only required for intermediate, library-like contracts.
       */
      abstract contract Context {
          function _msgSender() internal view virtual returns (address) {
              return msg.sender;
          }
          function _msgData() internal view virtual returns (bytes calldata) {
              return msg.data;
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
      pragma solidity ^0.8.0;
      /**
       * @dev String operations.
       */
      library Strings {
          bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
          /**
           * @dev Converts a `uint256` to its ASCII `string` decimal representation.
           */
          function toString(uint256 value) internal pure returns (string memory) {
              // Inspired by OraclizeAPI's implementation - MIT licence
              // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
              if (value == 0) {
                  return "0";
              }
              uint256 temp = value;
              uint256 digits;
              while (temp != 0) {
                  digits++;
                  temp /= 10;
              }
              bytes memory buffer = new bytes(digits);
              while (value != 0) {
                  digits -= 1;
                  buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
                  value /= 10;
              }
              return string(buffer);
          }
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
           */
          function toHexString(uint256 value) internal pure returns (string memory) {
              if (value == 0) {
                  return "0x00";
              }
              uint256 temp = value;
              uint256 length = 0;
              while (temp != 0) {
                  length++;
                  temp >>= 8;
              }
              return toHexString(value, length);
          }
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
           */
          function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
              bytes memory buffer = new bytes(2 * length + 2);
              buffer[0] = "0";
              buffer[1] = "x";
              for (uint256 i = 2 * length + 1; i > 1; --i) {
                  buffer[i] = _HEX_SYMBOLS[value & 0xf];
                  value >>= 4;
              }
              require(value == 0, "Strings: hex length insufficient");
              return string(buffer);
          }
      }
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
      pragma solidity ^0.8.0;
      import "./IERC165.sol";
      /**
       * @dev Implementation of the {IERC165} interface.
       *
       * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
       * for the additional interface id that will be supported. For example:
       *
       * ```solidity
       * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
       *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
       * }
       * ```
       *
       * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
       */
      abstract contract ERC165 is IERC165 {
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              return interfaceId == type(IERC165).interfaceId;
          }
      }
      

      File 10 of 10: Dropicall
      // SPDX-License-Identifier: MIT
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
      
      pragma solidity ^0.8.0;
      
      /**
       * @dev Interface of the ERC165 standard, as defined in the
       * https://eips.ethereum.org/EIPS/eip-165[EIP].
       *
       * Implementers can declare support of contract interfaces, which can then be
       * queried by others ({ERC165Checker}).
       *
       * For an implementation, see {ERC165}.
       */
      interface IERC165 {
          /**
           * @dev Returns true if this contract implements the interface defined by
           * `interfaceId`. See the corresponding
           * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
           * to learn more about how these ids are created.
           *
           * This function call must use less than 30 000 gas.
           */
          function supportsInterface(bytes4 interfaceId) external view returns (bool);
      }
      
      // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
      
      
      
      /**
       * @dev String operations.
       */
      library Strings {
          bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
      
          /**
           * @dev Converts a `uint256` to its ASCII `string` decimal representation.
           */
          function toString(uint256 value) internal pure returns (string memory) {
              // Inspired by OraclizeAPI's implementation - MIT licence
              // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
      
              if (value == 0) {
                  return "0";
              }
              uint256 temp = value;
              uint256 digits;
              while (temp != 0) {
                  digits++;
                  temp /= 10;
              }
              bytes memory buffer = new bytes(digits);
              while (value != 0) {
                  digits -= 1;
                  buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
                  value /= 10;
              }
              return string(buffer);
          }
      
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
           */
          function toHexString(uint256 value) internal pure returns (string memory) {
              if (value == 0) {
                  return "0x00";
              }
              uint256 temp = value;
              uint256 length = 0;
              while (temp != 0) {
                  length++;
                  temp >>= 8;
              }
              return toHexString(value, length);
          }
      
          /**
           * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
           */
          function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
              bytes memory buffer = new bytes(2 * length + 2);
              buffer[0] = "0";
              buffer[1] = "x";
              for (uint256 i = 2 * length + 1; i > 1; --i) {
                  buffer[i] = _HEX_SYMBOLS[value & 0xf];
                  value >>= 4;
              }
              require(value == 0, "Strings: hex length insufficient");
              return string(buffer);
          }
      }
      
      // OpenZeppelin Contracts v4.4.1 (utils/Context.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 Context {
          function _msgSender() internal view virtual returns (address) {
              return msg.sender;
          }
      
          function _msgData() internal view virtual returns (bytes calldata) {
              return msg.data;
          }
      }
      
      /**
       * @dev Required interface of an ERC721 compliant contract.
       */
      interface IERC721 is IERC165 {
          /**
           * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
           */
          event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
           */
          event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
      
          /**
           * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
           */
          event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
      
          /**
           * @dev Returns the number of tokens in ``owner``'s account.
           */
          function balanceOf(address owner) external view returns (uint256 balance);
      
          /**
           * @dev Returns the owner of the `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function ownerOf(uint256 tokenId) external view returns (address owner);
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, 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
          ) external;
      
          /**
           * @dev Transfers `tokenId` token 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;
      
          /**
           * @dev Gives permission to `to` to transfer `tokenId` token to another account.
           * The approval is cleared when the token is transferred.
           *
           * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
           *
           * Requirements:
           *
           * - The caller must own the token or be an approved operator.
           * - `tokenId` must exist.
           *
           * Emits an {Approval} event.
           */
          function approve(address to, uint256 tokenId) external;
      
          /**
           * @dev Returns the account approved for `tokenId` token.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function getApproved(uint256 tokenId) external view returns (address operator);
      
          /**
           * @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 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);
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes calldata data
          ) external;
      }
      /**
       * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
       * @dev See https://eips.ethereum.org/EIPS/eip-721
       */
      interface IERC721Enumerable is IERC721 {
          /**
           * @dev Returns the total amount of tokens stored by the contract.
           */
          function totalSupply() external view returns (uint256);
      
          /**
           * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
           * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
           */
          function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
      
          /**
           * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
           * Use along with {totalSupply} to enumerate all tokens.
           */
          function tokenByIndex(uint256 index) external view returns (uint256);
      }
      
      
      
      
      //Copyleft (ɔ) All Rights Reversed
      
      
      
      
      // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
      
      
      
      
      
      /**
       * @dev Contract module which provides a basic access control mechanism, where
       * there is an account (an owner) that can be granted exclusive access to
       * specific functions.
       *
       * By default, the owner account will be the one that deploys the contract. This
       * can later be changed with {transferOwnership}.
       *
       * This module is used through inheritance. It will make available the modifier
       * `onlyOwner`, which can be applied to your functions to restrict their use to
       * the owner.
       */
      abstract contract Ownable is Context {
          address private _owner;
      
          event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
      
          /**
           * @dev Initializes the contract setting the deployer as the initial owner.
           */
          constructor() {
              _transferOwnership(_msgSender());
          }
      
          /**
           * @dev Returns the address of the current owner.
           */
          function owner() public view virtual returns (address) {
              return _owner;
          }
      
          /**
           * @dev Throws if called by any account other than the owner.
           */
          modifier onlyOwner() {
              require(owner() == _msgSender(), "Ownable: caller is not the owner");
              _;
          }
      
          /**
           * @dev Leaves the contract without owner. It will not be possible to call
           * `onlyOwner` functions anymore. Can only be called by the current owner.
           *
           * NOTE: Renouncing ownership will leave the contract without an owner,
           * thereby removing any functionality that is only available to the owner.
           */
          function renounceOwnership() public virtual onlyOwner {
              _transferOwnership(address(0));
          }
      
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Can only be called by the current owner.
           */
          function transferOwnership(address newOwner) public virtual onlyOwner {
              require(newOwner != address(0), "Ownable: new owner is the zero address");
              _transferOwnership(newOwner);
          }
      
          /**
           * @dev Transfers ownership of the contract to a new account (`newOwner`).
           * Internal function without access restriction.
           */
          function _transferOwnership(address newOwner) internal virtual {
              address oldOwner = _owner;
              _owner = newOwner;
              emit OwnershipTransferred(oldOwner, newOwner);
          }
      }
      
      
      
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)
      
      
      
      
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)
      
      
      
      
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
      
      
      
      
      
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
      
      
      
      /**
       * @title ERC721 token receiver interface
       * @dev Interface for any contract that wants to support safeTransfers
       * from ERC721 asset contracts.
       */
      interface IERC721Receiver {
          /**
           * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
           * by `operator` from `from`, this function is called.
           *
           * It must return its Solidity selector to confirm the token transfer.
           * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
           *
           * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
           */
          function onERC721Received(
              address operator,
              address from,
              uint256 tokenId,
              bytes calldata data
          ) external returns (bytes4);
      }
      
      
      // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
      
      
      
      
      
      /**
       * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
       * @dev See https://eips.ethereum.org/EIPS/eip-721
       */
      interface IERC721Metadata is IERC721 {
          /**
           * @dev Returns the token collection name.
           */
          function name() external view returns (string memory);
      
          /**
           * @dev Returns the token collection symbol.
           */
          function symbol() external view returns (string memory);
      
          /**
           * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
           */
          function tokenURI(uint256 tokenId) external view returns (string memory);
      }
      
      
      // OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
      
      
      
      /**
       * @dev Collection of functions related to the address type
       */
      library Address {
          /**
           * @dev Returns true if `account` is a contract.
           *
           * [IMPORTANT]
           * ====
           * It is unsafe to assume that an address for which this function returns
           * false is an externally-owned account (EOA) and not a contract.
           *
           * Among others, `isContract` will return false for the following
           * types of addresses:
           *
           *  - an externally-owned account
           *  - a contract in construction
           *  - an address where a contract will be created
           *  - an address where a contract lived, but was destroyed
           * ====
           *
           * [IMPORTANT]
           * ====
           * You shouldn't rely on `isContract` to protect against flash loan attacks!
           *
           * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
           * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
           * constructor.
           * ====
           */
          function isContract(address account) internal view returns (bool) {
              // This method relies on extcodesize/address.code.length, which returns 0
              // for contracts in construction, since the code is only stored at the end
              // of the constructor execution.
      
              return account.code.length > 0;
          }
      
          /**
           * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
           * `recipient`, forwarding all available gas and reverting on errors.
           *
           * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
           * of certain opcodes, possibly making contracts go over the 2300 gas limit
           * imposed by `transfer`, making them unable to receive funds via
           * `transfer`. {sendValue} removes this limitation.
           *
           * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
           *
           * IMPORTANT: because control is transferred to `recipient`, care must be
           * taken to not create reentrancy vulnerabilities. Consider using
           * {ReentrancyGuard} or the
           * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
           */
          function sendValue(address payable recipient, uint256 amount) internal {
              require(address(this).balance >= amount, "Address: insufficient balance");
      
              (bool success, ) = recipient.call{value: amount}("");
              require(success, "Address: unable to send value, recipient may have reverted");
          }
      
          /**
           * @dev Performs a Solidity function call using a low level `call`. A
           * plain `call` is an unsafe replacement for a function call: use this
           * function instead.
           *
           * If `target` reverts with a revert reason, it is bubbled up by this
           * function (like regular Solidity function calls).
           *
           * Returns the raw returned data. To convert to the expected return value,
           * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
           *
           * Requirements:
           *
           * - `target` must be a contract.
           * - calling `target` with `data` must not revert.
           *
           * _Available since v3.1._
           */
          function functionCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionCall(target, data, "Address: low-level call failed");
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
           * `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, 0, errorMessage);
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but also transferring `value` wei to `target`.
           *
           * Requirements:
           *
           * - the calling contract must have an ETH balance of at least `value`.
           * - the called Solidity function must be `payable`.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value
          ) internal returns (bytes memory) {
              return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
          }
      
          /**
           * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
           * with `errorMessage` as a fallback revert reason when `target` reverts.
           *
           * _Available since v3.1._
           */
          function functionCallWithValue(
              address target,
              bytes memory data,
              uint256 value,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(address(this).balance >= value, "Address: insufficient balance for call");
              require(isContract(target), "Address: call to non-contract");
      
              (bool success, bytes memory returndata) = target.call{value: value}(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
              return functionStaticCall(target, data, "Address: low-level static call failed");
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a static call.
           *
           * _Available since v3.3._
           */
          function functionStaticCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal view returns (bytes memory) {
              require(isContract(target), "Address: static call to non-contract");
      
              (bool success, bytes memory returndata) = target.staticcall(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
              return functionDelegateCall(target, data, "Address: low-level delegate call failed");
          }
      
          /**
           * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
           * but performing a delegate call.
           *
           * _Available since v3.4._
           */
          function functionDelegateCall(
              address target,
              bytes memory data,
              string memory errorMessage
          ) internal returns (bytes memory) {
              require(isContract(target), "Address: delegate call to non-contract");
      
              (bool success, bytes memory returndata) = target.delegatecall(data);
              return verifyCallResult(success, returndata, errorMessage);
          }
      
          /**
           * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
           * revert reason using the provided one.
           *
           * _Available since v4.3._
           */
          function verifyCallResult(
              bool success,
              bytes memory returndata,
              string memory errorMessage
          ) internal pure returns (bytes memory) {
              if (success) {
                  return returndata;
              } else {
                  // Look for revert reason and bubble it up if present
                  if (returndata.length > 0) {
                      // The easiest way to bubble the revert reason is using memory via assembly
      
                      assembly {
                          let returndata_size := mload(returndata)
                          revert(add(32, returndata), returndata_size)
                      }
                  } else {
                      revert(errorMessage);
                  }
              }
          }
      }
      
      
      
      
      // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
      
      
      
      
      
      /**
       * @dev Implementation of the {IERC165} interface.
       *
       * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
       * for the additional interface id that will be supported. For example:
       *
       * ```solidity
       * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
       *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
       * }
       * ```
       *
       * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
       */
      abstract contract ERC165 is IERC165 {
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
              return interfaceId == type(IERC165).interfaceId;
          }
      }
      
      
      /**
       * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
       * the Metadata extension, but not including the Enumerable extension, which is available separately as
       * {ERC721Enumerable}.
       */
      contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
          using Address for address;
          using Strings for uint256;
      
          // Token name
          string private _name;
      
          // Token symbol
          string private _symbol;
      
          // Mapping from token ID to owner address
          mapping(uint256 => address) private _owners;
      
          // Mapping owner address to token count
          mapping(address => uint256) private _balances;
      
          // Mapping from token ID to approved address
          mapping(uint256 => address) private _tokenApprovals;
      
          // Mapping from owner to operator approvals
          mapping(address => mapping(address => bool)) private _operatorApprovals;
      
          /**
           * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
           */
          constructor(string memory name_, string memory symbol_) {
              _name = name_;
              _symbol = symbol_;
          }
      
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
              return
                  interfaceId == type(IERC721).interfaceId ||
                  interfaceId == type(IERC721Metadata).interfaceId ||
                  super.supportsInterface(interfaceId);
          }
      
          /**
           * @dev See {IERC721-balanceOf}.
           */
          function balanceOf(address owner) public view virtual override returns (uint256) {
              require(owner != address(0), "ERC721: balance query for the zero address");
              return _balances[owner];
          }
      
          /**
           * @dev See {IERC721-ownerOf}.
           */
          function ownerOf(uint256 tokenId) public view virtual override returns (address) {
              address owner = _owners[tokenId];
              require(owner != address(0), "ERC721: owner query for nonexistent token");
              return owner;
          }
      
          /**
           * @dev See {IERC721Metadata-name}.
           */
          function name() public view virtual override returns (string memory) {
              return _name;
          }
      
          /**
           * @dev See {IERC721Metadata-symbol}.
           */
          function symbol() public view virtual override returns (string memory) {
              return _symbol;
          }
      
          /**
           * @dev See {IERC721Metadata-tokenURI}.
           */
          function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
              require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
      
              string memory baseURI = _baseURI();
              return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
          }
      
          /**
           * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
           * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
           * by default, can be overriden in child contracts.
           */
          function _baseURI() internal view virtual returns (string memory) {
              return "";
          }
      
          /**
           * @dev See {IERC721-approve}.
           */
          function approve(address to, uint256 tokenId) public virtual override {
              address owner = ERC721.ownerOf(tokenId);
              require(to != owner, "ERC721: approval to current owner");
      
              require(
                  _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
                  "ERC721: approve caller is not owner nor approved for all"
              );
      
              _approve(to, tokenId);
          }
      
          /**
           * @dev See {IERC721-getApproved}.
           */
          function getApproved(uint256 tokenId) public view virtual override returns (address) {
              require(_exists(tokenId), "ERC721: approved query for nonexistent token");
      
              return _tokenApprovals[tokenId];
          }
      
          /**
           * @dev See {IERC721-setApprovalForAll}.
           */
          function setApprovalForAll(address operator, bool approved) public virtual override {
              _setApprovalForAll(_msgSender(), operator, approved);
          }
      
          /**
           * @dev See {IERC721-isApprovedForAll}.
           */
          function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
              return _operatorApprovals[owner][operator];
          }
      
          /**
           * @dev See {IERC721-transferFrom}.
           */
          function transferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              //solhint-disable-next-line max-line-length
              require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
      
              _transfer(from, to, tokenId);
          }
      
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId
          ) public virtual override {
              safeTransferFrom(from, to, tokenId, "");
          }
      
          /**
           * @dev See {IERC721-safeTransferFrom}.
           */
          function safeTransferFrom(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) public virtual override {
              require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
              _safeTransfer(from, to, tokenId, _data);
          }
      
          /**
           * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
           * are aware of the ERC721 protocol to prevent tokens from being forever locked.
           *
           * `_data` is additional data, it has no specified format and it is sent in call to `to`.
           *
           * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
           * implement alternative mechanisms to perform token transfer, such as signature-based.
           *
           * Requirements:
           *
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           * - `tokenId` token must exist and be owned by `from`.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function _safeTransfer(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) internal virtual {
              _transfer(from, to, tokenId);
              require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
          }
      
          /**
           * @dev Returns whether `tokenId` exists.
           *
           * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
           *
           * Tokens start existing when they are minted (`_mint`),
           * and stop existing when they are burned (`_burn`).
           */
          function _exists(uint256 tokenId) internal view virtual returns (bool) {
              return _owners[tokenId] != address(0);
          }
      
          /**
           * @dev Returns whether `spender` is allowed to manage `tokenId`.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           */
          function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
              require(_exists(tokenId), "ERC721: operator query for nonexistent token");
              address owner = ERC721.ownerOf(tokenId);
              return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
          }
      
          /**
           * @dev Safely mints `tokenId` and transfers it to `to`.
           *
           * Requirements:
           *
           * - `tokenId` must not exist.
           * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
           *
           * Emits a {Transfer} event.
           */
          function _safeMint(address to, uint256 tokenId) internal virtual {
              _safeMint(to, tokenId, "");
          }
      
          /**
           * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
           * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
           */
          function _safeMint(
              address to,
              uint256 tokenId,
              bytes memory _data
          ) internal virtual {
              _mint(to, tokenId);
              require(
                  _checkOnERC721Received(address(0), to, tokenId, _data),
                  "ERC721: transfer to non ERC721Receiver implementer"
              );
          }
      
          /**
           * @dev Mints `tokenId` and transfers it to `to`.
           *
           * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
           *
           * Requirements:
           *
           * - `tokenId` must not exist.
           * - `to` cannot be the zero address.
           *
           * Emits a {Transfer} event.
           */
          function _mint(address to, uint256 tokenId) internal virtual {
              require(to != address(0), "ERC721: mint to the zero address");
              require(!_exists(tokenId), "ERC721: token already minted");
      
              _beforeTokenTransfer(address(0), to, tokenId);
      
              _balances[to] += 1;
              _owners[tokenId] = to;
      
              emit Transfer(address(0), to, tokenId);
      
              _afterTokenTransfer(address(0), to, tokenId);
          }
      
          /**
           * @dev Destroys `tokenId`.
           * The approval is cleared when the token is burned.
           *
           * Requirements:
           *
           * - `tokenId` must exist.
           *
           * Emits a {Transfer} event.
           */
          function _burn(uint256 tokenId) internal virtual {
              address owner = ERC721.ownerOf(tokenId);
      
              _beforeTokenTransfer(owner, address(0), tokenId);
      
              // Clear approvals
              _approve(address(0), tokenId);
      
              _balances[owner] -= 1;
              delete _owners[tokenId];
      
              emit Transfer(owner, address(0), tokenId);
      
              _afterTokenTransfer(owner, address(0), tokenId);
          }
      
          /**
           * @dev Transfers `tokenId` from `from` to `to`.
           *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
           *
           * Requirements:
           *
           * - `to` cannot be the zero address.
           * - `tokenId` token must be owned by `from`.
           *
           * Emits a {Transfer} event.
           */
          function _transfer(
              address from,
              address to,
              uint256 tokenId
          ) internal virtual {
              require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
              require(to != address(0), "ERC721: transfer to the zero address");
      
              _beforeTokenTransfer(from, to, tokenId);
      
              // Clear approvals from the previous owner
              _approve(address(0), tokenId);
      
              _balances[from] -= 1;
              _balances[to] += 1;
              _owners[tokenId] = to;
      
              emit Transfer(from, to, tokenId);
      
              _afterTokenTransfer(from, to, tokenId);
          }
      
          /**
           * @dev Approve `to` to operate on `tokenId`
           *
           * Emits a {Approval} event.
           */
          function _approve(address to, uint256 tokenId) internal virtual {
              _tokenApprovals[tokenId] = to;
              emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
          }
      
          /**
           * @dev Approve `operator` to operate on all of `owner` tokens
           *
           * Emits a {ApprovalForAll} event.
           */
          function _setApprovalForAll(
              address owner,
              address operator,
              bool approved
          ) internal virtual {
              require(owner != operator, "ERC721: approve to caller");
              _operatorApprovals[owner][operator] = approved;
              emit ApprovalForAll(owner, operator, approved);
          }
      
          /**
           * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
           * The call is not executed if the target address is not a contract.
           *
           * @param from address representing the previous owner of the given token ID
           * @param to target address that will receive the tokens
           * @param tokenId uint256 ID of the token to be transferred
           * @param _data bytes optional data to send along with the call
           * @return bool whether the call correctly returned the expected magic value
           */
          function _checkOnERC721Received(
              address from,
              address to,
              uint256 tokenId,
              bytes memory _data
          ) private returns (bool) {
              if (to.isContract()) {
                  try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                      return retval == IERC721Receiver.onERC721Received.selector;
                  } catch (bytes memory reason) {
                      if (reason.length == 0) {
                          revert("ERC721: transfer to non ERC721Receiver implementer");
                      } else {
                          assembly {
                              revert(add(32, reason), mload(reason))
                          }
                      }
                  }
              } else {
                  return true;
              }
          }
      
          /**
           * @dev Hook that is called before any token transfer. This includes minting
           * and burning.
           *
           * 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, ``from``'s `tokenId` will be burned.
           * - `from` and `to` are never both zero.
           *
           * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
           */
          function _beforeTokenTransfer(
              address from,
              address to,
              uint256 tokenId
          ) internal virtual {}
      
          /**
           * @dev Hook that is called after any transfer of tokens. This includes
           * minting and burning.
           *
           * Calling conditions:
           *
           * - when `from` and `to` are both non-zero.
           * - `from` and `to` are never both zero.
           *
           * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
           */
          function _afterTokenTransfer(
              address from,
              address to,
              uint256 tokenId
          ) internal virtual {}
      }
      
      
      
      /**
       * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
       * enumerability of all the token ids in the contract as well as all token ids owned by each
       * account.
       */
      abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
          // Mapping from owner to list of owned token IDs
          mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
      
          // Mapping from token ID to index of the owner tokens list
          mapping(uint256 => uint256) private _ownedTokensIndex;
      
          // Array with all token ids, used for enumeration
          uint256[] private _allTokens;
      
          // Mapping from token id to position in the allTokens array
          mapping(uint256 => uint256) private _allTokensIndex;
      
          /**
           * @dev See {IERC165-supportsInterface}.
           */
          function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
              return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
          }
      
          /**
           * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
           */
          function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
              require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
              return _ownedTokens[owner][index];
          }
      
          /**
           * @dev See {IERC721Enumerable-totalSupply}.
           */
          function totalSupply() public view virtual override returns (uint256) {
              return _allTokens.length;
          }
      
          /**
           * @dev See {IERC721Enumerable-tokenByIndex}.
           */
          function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
              require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
              return _allTokens[index];
          }
      
          /**
           * @dev Hook that is called before any token transfer. This includes minting
           * and burning.
           *
           * 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, ``from``'s `tokenId` will be burned.
           * - `from` cannot be the zero address.
           * - `to` cannot be the zero address.
           *
           * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
           */
          function _beforeTokenTransfer(
              address from,
              address to,
              uint256 tokenId
          ) internal virtual override {
              super._beforeTokenTransfer(from, to, tokenId);
      
              if (from == address(0)) {
                  _addTokenToAllTokensEnumeration(tokenId);
              } else if (from != to) {
                  _removeTokenFromOwnerEnumeration(from, tokenId);
              }
              if (to == address(0)) {
                  _removeTokenFromAllTokensEnumeration(tokenId);
              } else if (to != from) {
                  _addTokenToOwnerEnumeration(to, tokenId);
              }
          }
      
          /**
           * @dev Private function to add a token to this extension's ownership-tracking data structures.
           * @param to address representing the new owner of the given token ID
           * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
           */
          function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
              uint256 length = ERC721.balanceOf(to);
              _ownedTokens[to][length] = tokenId;
              _ownedTokensIndex[tokenId] = length;
          }
      
          /**
           * @dev Private function to add a token to this extension's token tracking data structures.
           * @param tokenId uint256 ID of the token to be added to the tokens list
           */
          function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
              _allTokensIndex[tokenId] = _allTokens.length;
              _allTokens.push(tokenId);
          }
      
          /**
           * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
           * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
           * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
           * This has O(1) time complexity, but alters the order of the _ownedTokens array.
           * @param from address representing the previous owner of the given token ID
           * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
           */
          function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
              // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
              // then delete the last slot (swap and pop).
      
              uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
              uint256 tokenIndex = _ownedTokensIndex[tokenId];
      
              // When the token to delete is the last token, the swap operation is unnecessary
              if (tokenIndex != lastTokenIndex) {
                  uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
      
                  _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
                  _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
              }
      
              // This also deletes the contents at the last position of the array
              delete _ownedTokensIndex[tokenId];
              delete _ownedTokens[from][lastTokenIndex];
          }
      
          /**
           * @dev Private function to remove a token from this extension's token tracking data structures.
           * This has O(1) time complexity, but alters the order of the _allTokens array.
           * @param tokenId uint256 ID of the token to be removed from the tokens list
           */
          function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
              // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
              // then delete the last slot (swap and pop).
      
              uint256 lastTokenIndex = _allTokens.length - 1;
              uint256 tokenIndex = _allTokensIndex[tokenId];
      
              // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
              // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
              // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
              uint256 lastTokenId = _allTokens[lastTokenIndex];
      
              _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
              _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
      
              // This also deletes the contents at the last position of the array
              delete _allTokensIndex[tokenId];
              _allTokens.pop();
          }
      }
      
      
      
      struct Shareholder {
      	address addr;
      	uint256 percent;
      }
      contract Dropicall is ERC721Enumerable, Ownable {
      
      	mapping(address => uint256) private share_pool;
      	address[] private share_addr; // [i]
      
      	// [addr][id] (usually i,j)
      	// Contains "unrolled" share amounts to distribute.
      	uint256[][] private share_price_matrix;
      	// [j]
      	// Pairs of [price,count]
      	uint256[2][] private prices_n;
      
      	uint256 public immutable item_count;
      
      	bool private sale_data_ok = false;
      
      	uint256 private immutable max_supply;
      	function get_mint_price(uint j) public view returns(uint256) {
      		require(j < prices_n.length);
      		return prices_n[j][0] * prices_n[j][1];
      	}
      	function get_mint_count(uint j) public view returns(uint256) {
      		require(j < prices_n.length);
      		return prices_n[j][1];
      	}
      	function pay_and_mint(uint j) private {
      		require( j < prices_n.length, "Invalid mint option." );
      		require(msg.value == get_mint_price(j), "Incorrect value paid.");
      		require(totalSupply() + prices_n[j][1] <= max_supply, "Not enough left.");
      		distribute_share(j);
      		uint ts = totalSupply() + 1;
      		for (uint i = 0; i < prices_n[j][1]; i++) {
      			_safeMint(msg.sender, ts + i);
      		}
      	}
      	function distribute_share(uint256 j) private {
      		for ( uint i = 0; i < share_addr.length; i++ ) {
      			share_pool[share_addr[i]] += share_price_matrix[i][j];
      		}
      	}
      	function init_sale_data(Shareholder[] memory shareholders, uint256[2][] memory amounts_prices ) private {
      		require(!sale_data_ok, "Already initialized");
      		require(shareholders.length > 0, "Must provide at least one shareholder.");
      		require(amounts_prices.length > 0, "Must provide prices.");
      		prices_n = amounts_prices;
      		uint256 p = 0;
      		for ( uint256 i = 0; i < shareholders.length; i++ ) {
      			require( shareholders[i].percent > 0 && shareholders[i].percent <= 100, "Percentage out of range." );
      			p += shareholders[i].percent;
      			share_addr.push(shareholders[i].addr);
      			share_price_matrix.push();
      			for ( uint256 j = 0; j < amounts_prices.length; j++ ) {
      				require( amounts_prices[j][0] % 100 == 0, "Prices must each be a multiple of 100 Wei." );
      				uint256 v = (amounts_prices[j][0] / 100) * shareholders[i].percent;
      				share_price_matrix[i].push(v * amounts_prices[j][1]);
      			}
      		}
      		require( p == 100, "Combined shares do not add up to 100 percent." );
      		sale_data_ok = true;
      		/* Deactivate for less constructor gas * /
      		for ( uint256 j = 0; j < amounts_prices.length; j++ ) {
      			uint256 c = 0;
      			for ( uint256 i = 0; i < shareholders.length; i++ ) {
      				c += share_price_matrix[i][j];
      			}
      			assert( c == amounts_prices[j][0] * amounts_prices[j][1] ); // Unrolled prices do not add up to the original.
      		}
      		/ * */
      	}
      	function withdraw_share() public {
      		require(share_pool[msg.sender] > 0, "No shares for this address to withdraw." );
      		address payable dest = payable(msg.sender);
      		uint256 bounty = share_pool[msg.sender];
      		share_pool[msg.sender] = 0;
      		dest.transfer(bounty);
      	}
      
      	///////////////
      
      	string private __baseURI;
      	function _baseURI() internal view virtual override returns (string memory) {
      		return __baseURI;
      	}
      	function _setBaseURI(string memory baseURI_) internal virtual {
      		__baseURI = baseURI_;
      	}
      	function setBaseURI(string memory baseURI) public onlyOwner {
      		_setBaseURI(baseURI);
      	}
      
      	string private __contractURI;
      	function _contractURI() internal view virtual returns (string memory) {
      		return __contractURI;
      	}
      	function _setContractURI(string memory contractURI_) internal virtual {
      		__contractURI = contractURI_;
      	}
      	function setContractURI(string memory contractURI) public onlyOwner {
      		_setContractURI(contractURI);
      	}
      	///////////////
      
      	bool premint_started;
      	bool mint_started;
      
      	mapping(address => bool) public whitelist;
      
      	function mint_main(uint256 option_id) public payable {
      		require( mint_started || ( premint_started && whitelist[msg.sender] ), "You may not mint at this time." );
      		pay_and_mint( option_id );
      	}
      
      	function start_premint() public onlyOwner {
      		premint_started = true;
      	}
      	function start_mint() public onlyOwner {
      		require( premint_started, "Starting mint without premint first, did you press the wrong button?" );
      		mint_started = true;
      	}
      
      	constructor() ERC721(
      		"Dropicall",
      		"DRCA"
      	) {
      		Shareholder[] memory sh = new Shareholder[](2);
      		sh[0] = Shareholder( { addr: 0xB520F068a908A1782a543aAcC3847ADB77A04778, percent: 10 } ); // remco
      		sh[1] = Shareholder( { addr: 0x4dDAc376f28BE60e1F7642A4D302C6Cf6CAe1D92, percent: 90 } ); // mezza
      
      		// Why? So that you can query this (it's public)
      		item_count = 3;
      		uint256[2][] memory price_table = new uint256[2][](item_count);		
      		price_table[0] = [ uint256(8e7 gwei), 1 ];
      		price_table[1] = [ uint256(7e7 gwei), 5 ];
      		price_table[2] = [ uint256(6e7 gwei), 10 ];
      
      		max_supply = 3333;
      
      		init_sale_data( sh, price_table );
      
      		// _setContractURI( "this is a very long string about mice. squeak are mice making a home in your code??" );
      		// _setBaseURI( "this is a very long string about mice. actually this is for more conservative gas estimates.." );
      
      		whitelist[0x2cc2149D905fe27841055CC31700641e0E6C944D] = true;
      		whitelist[0x9508d995ca98DAc918D0a4F18Acd67BC545C8b92] = true;
      		whitelist[0x1077011F38c120973238eF266Dd45edad4a78E99] = true;
      		whitelist[0x32E094eeD5995331a45F2eb8727Da81156845Ff0] = true;
      		whitelist[0x88923378021BeA85f9b09Ce571a309E12C7D2262] = true;
      		whitelist[0x87CBd58ba04C8a0D26A0242d5Ac06f30269a96c5] = true;
      		whitelist[0xf5D4E11f6392a138cDaD459367C45Fe8B90dB704] = true;
      		whitelist[0xF9f5a72142bd0bdb9A6053191104c010d912c1BD] = true;
      		whitelist[0x2ec970270130EdbA7D9B1f0f7cE7DFb3d1f6Cf6a] = true;
      		whitelist[0x32918DBB0Dad6C0E92eBc72F024A61FB8507277E] = true;
      		whitelist[0x8694EC6954a576D42e5a95488ae2C175A959f04c] = true;
      		whitelist[0x98c1d8A5cd2e6FA559ba6ae0680B388b799AC231] = true;
      		whitelist[0xFB52e265F03e1783e222f30106418a4a1487D0e7] = true;
      		whitelist[0x1F38EbCFfb0Be993b981225a917aAA8a6d6A4E52] = true;
      		whitelist[0xA7b2A23fF93f04D9D04a645Fc90450845106f19c] = true;
      		whitelist[0x104B2edadfe9F12E99C422E6823D1eEa40343564] = true;
      		whitelist[0xF7C53Fd0599632cAa643C8bC7b195ffE041F9134] = true;
      		whitelist[0x32Cc2EC897F21a77A704e9a7313af6a640c47BB5] = true;
      		whitelist[0xdDe74f034163192dd2170BB56B9CAc2d45Ce0a36] = true;
      		whitelist[0xDC89B615F0e36261c02b0B7d92bBcBD31C3C6269] = true;
      		whitelist[0x984b18B1823Fef04A4Ca7cF1e8A0eF5359fA522F] = true;
      		whitelist[0xd42d08ca1A876ac9BD2bFe631eE7D997cAE39229] = true;
      		whitelist[0x56C82d09b490F63531656E25838536C97e10610f] = true;
      		whitelist[0x0503bF05c49F96faaC2B0f5fD394672eD4603C52] = true;
      		whitelist[0x768058a4b0054dc1cb025889B2eFD9C2051d2Bf6] = true;
      		whitelist[0x76fC54b4eC08917fc4a7FC6a72d0BaAff9861ad7] = true;
      		whitelist[0xF43E468e6E39F490E7198cDe92c6995e843ef4c5] = true;
      		whitelist[0xD31D14f6B5AeFDaB5fE16DeA29fA46F6B8c15bF2] = true;
      		whitelist[0xB1Bb9A663765255542221B8C2106660c84E0B7ce] = true;
      		whitelist[0xF7C53Fd0599632cAa643C8bC7b195ffE041F9134] = true;
      		whitelist[0x8694EC6954a576D42e5a95488ae2C175A959f04c] = true;
      		whitelist[0x8d586f380846dCA988cB3B345231AF02F989C411] = true;
      		whitelist[0xe4A24b53C97A25A21fe0Ee6a1a1F652A5dAFe88f] = true;
      		whitelist[0x0EDb2533655876b1656243fd6ee9B16401281df8] = true;
      		whitelist[0xe958a38D6819bBa0501020e37e1F7C0e54584FAA] = true;
      		whitelist[0x008BA4907924f86C62fBb31Fe4A0dFE91c0e6acc] = true;
      		whitelist[0xe81FC42336c9314A9Be1EDB3F50eA9e275C93df3] = true;
      		whitelist[0xB7E64cb5B81cc275024B056DBDb8eB4afd84b4EA] = true;
      		whitelist[0x2A1Ca52f11A7F0aA923A6739d49c69004C7246e1] = true;
      		whitelist[0x1AC76Ec4c02c5488E8DcB892272e9E284d5Fe295] = true;
      		whitelist[0xE0E7745713Cca16eE73e231428921B424f419b10] = true;
      		whitelist[0x001Bf5f51453E74aa44dE9eE47F9deB6E896Ca29] = true;
      		whitelist[0x2227de445Dbfd90712C48bCD74D492CccA1Cb242] = true;
      		whitelist[0x767A60F295AEDd958932088F9Cd6a4951D8739b6] = true;
      		whitelist[0x10455d2469b5235F95C2512026307bD77b1511d2] = true;
      		whitelist[0x00000000000Cd56832cE5dfBcBFf02e7eC639BC9] = true;
      		whitelist[0xcb9F176f3C90837a727E4678e29515cB2D557F18] = true;
      		whitelist[0x5ea7e5e100aE141d1f0Fa98852e335CBa9A9f374] = true;
      		whitelist[0xb6E34A8A93031a24C264Be59D0BaC00bcaeF9051] = true;
      		whitelist[0x8149DC18D39FDBa137E43C871e7801E7CF566D41] = true;
      		whitelist[0xda1D4Bd894709DbD9a140c05bdaedd19afE7fb00] = true;
      		whitelist[0x4EfeceA2A42E1E73737e4dda7234e999A84Ca60B] = true;
      		whitelist[0x49AAD19d4f36EB41dDF3d54151D5ba0c0531A888] = true;
      		whitelist[0xdAE4012B41657B7118324Fe13aF91eEc0EC95acD] = true;
      		whitelist[0xAf981AFA2f5fd50ffEDBB5728FA0fFd2a99b93CE] = true;
      		whitelist[0x25a61B9CB2D749b062fA87b792ca60faEdDdF851] = true;
      		whitelist[0x10172b1A8fD270C2F4F45561617747ad2a35B31E] = true;
      		whitelist[0x885dA0E56F2B1aEd633f9A3847D3b057832a5463] = true;
      		whitelist[0x9294bb652f4B1392Ff8c266Cc75BA45ba312c124] = true;
      		whitelist[0xCbE7396ea129242438C565Ec5dCB8A37f187E639] = true;
      		whitelist[0x5C45b39E13c4129dF392072045747DDbcedA1eB9] = true;
      		whitelist[0x84a6C06CCEfE63C5C8df52dFff3101a480aD3760] = true;
      		whitelist[0x2bFaC2D8D79D13D45862EA64ce0f25C5D34e9cA8] = true;
      		whitelist[0xC41CfcEc2b5f65A2c6bF70869cbC116Aa0ec0Ada] = true;
      		whitelist[0x2378598aEf5768d12df9ab72dee9AF37a2741F5A] = true;
      		whitelist[0x8205F2AB276C78d06a8F9bE9b1C97A776C7dD805] = true;
      		whitelist[0xe5A7a206E9a8769f90ca792EbB68E9268231F717] = true;
      		whitelist[0x1258436bc2Ce96f60e0032b07DA166Ac588f1a00] = true;
      		whitelist[0x4218bA2E10E56aAC410205A7576d8FBc3DD54420] = true;
      		whitelist[0xc2086C494819b15EF371585e45682C50CbC20aF5] = true;
      		whitelist[0xce0E1766269e63a87FB1C1e5C745B1db32b5713d] = true;
      		whitelist[0xDc610C4766450E3184AfC312ef2224702299219b] = true;
      		whitelist[0x3bfd26bCF88E595F65e1583AfbdFcd6CF87EA169] = true;
      		whitelist[0xdc52C2E7FC45B30bd5636f8D45BBEBAE4CE87f46] = true;
      		whitelist[0x264B6B1D31F95c01876C17a8b30D3Ce68dF1371C] = true;
      		whitelist[0x2705045Ef16d185a84AEF570cdddE535A0A95d1f] = true;
      		whitelist[0x9Be8cbE548110b4F09D932cdfbaC082c9dD98899] = true;
      		whitelist[0xbb5D3Fc1E82dCAD48d07ADac292a08d765FD1eFf] = true;
      		whitelist[0x419fD53f8c5c957Ae2c52A7df6904e986E59db62] = true;
      		whitelist[0x284643Cea4d1Aa85596C69195557967408Fc18F7] = true;
      		whitelist[0x91cE2EaAa0ae31B8b109E4a2038Fa7aC3e83034f] = true;
      		whitelist[0x38b3bb561700fc263240c4bCfA6F9a5A10167556] = true;
      		whitelist[0x4FB54f1F8c545cf31619978E97A3F8396894C88f] = true;
      		whitelist[0xc6F236891c3099ce4b210793BB1b3030fFfBaA67] = true;
      		whitelist[0x6232d7a6085D0Ab8F885292078eEb723064a376B] = true;
      		whitelist[0x0f0924A3a5111e7987A23a49Af826D2Ba431342e] = true;
      		whitelist[0xC273ee810842f9fFc9Ce781e4AeD4533A4bdd6De] = true;
      		whitelist[0xa58112df57A29a5DFd7a22164a38216b56f39960] = true;
      		whitelist[0x33d704D1347bBf81C05104bC41beE19e83C02205] = true;
      		whitelist[0x389fb1a81410D20cB6119c134A727E21ebBFEA59] = true;
      		whitelist[0xA381D21bc2bc9e349dc4332854788d1036BBD107] = true;
      		whitelist[0x89032c0cFF4abb9bc490dF104Ec89eff27314909] = true;
      		whitelist[0xdb29C08D0A11D376A54EAABbaa89EB7853e32da5] = true;
      		whitelist[0x32E094eeD5995331a45F2eb8727Da81156845Ff0] = true;
      		whitelist[0xF896E426615E44a2610F4C3D5343B63b557E11e2] = true;
      		whitelist[0xa4939a893C7AEfE9629d7525BE3Db799a9E1045B] = true;
      		whitelist[0x36ABc45216Ee411581DA092B9caa98Ac460afc45] = true;
      		whitelist[0x657A38e6994CB578351376dCDb077330D00665d6] = true;
      		whitelist[0x459B3154699F7e49F7FBcf9591dEfa0a1f1177fc] = true;
      		whitelist[0x9b7657D46ea863bfDD0c48b4C41794D47e95E6De] = true;
      		whitelist[0xcE20b5aF05868d1d39a65FA47ec285067145686a] = true;
      		whitelist[0x40b1ED5efC7aE8a8B50F34963bA89984DcB0529d] = true;
      		whitelist[0xB35248FeEB246b850Fac690a1BEaF5130dC71894] = true;
      		whitelist[0xad9df182acaDfAd985E854FB93F52F62C0Af6db4] = true;
      		whitelist[0x84572C31ACdd30c03982e27b809D30b1eFbCD8f2] = true;
      		whitelist[0x018881270dD7738aE1D74dCBc48Ed70A0B47E5A5] = true;
      		whitelist[0x8Bfd22d7fa34839447af3B4ED35B847DE5882dC5] = true;
      		whitelist[0x9f3BcE237ea107ffad3aa7852F8Dd847e6b82A5D] = true;
      		whitelist[0x354d4D759c49094f60D537bfD7177c05b70c20cC] = true;
      		whitelist[0xf89C94f43B36719046b55E2AE60BacBfc0dB1C6a] = true;
      		whitelist[0xA1830E8d9F019FEB448478a171Bb37Cc6C4c0482] = true;
      		whitelist[0x40f465F1ba4c2Aba91c0C896cb92bbe4c7e545DF] = true;
      		whitelist[0x57a879266C02bD29d11C956156E9a524de4483D7] = true;
      		whitelist[0xFaED43c98a40711e9521859f9ad80a90B6a84968] = true;
      		whitelist[0xAB723364C7Acb9b26029f002f942d2C8ed789a3B] = true;
      		whitelist[0x3E09005C7B9FC14B4f035260aA4a38B44566dd62] = true;
      		whitelist[0x1F4FD7F98275D44A48E1DDFB184aa125dC8Aa9AE] = true;
      		whitelist[0x5ad3b640c760CA369321682A0FfBf866C07b2b5a] = true;
      		whitelist[0x0B0b8696f89Ba073FC8515FF649618A4fb361885] = true;
      		whitelist[0x8CFBD1994cF924d80ec7891CafcEc51CcE4f999b] = true;
      		whitelist[0xab88C3E77D9CEB047Face254612653Ee35C9ff0e] = true;
      		whitelist[0xF8eF2dD0Bd0D7cD6f60DDa52ab01da6cD2AbE7B1] = true;
      		whitelist[0x7417E3bCdE8726908895152A8F3925a756b1894D] = true;
      		whitelist[0x0FdbfDc79ad0e2e3F76cC8b7Be6e8bE901E57552] = true;
      		whitelist[0xA23FcB4645cc618549Da1b61b8564429C2C32Ff9] = true;
      		whitelist[0xCAc5EE14B2155bDf3c7CACAF091c9b481fB47bD2] = true;
      		whitelist[0xF405f10feDE59e1D7350c3A3fF8488C33a1f07fa] = true;
      		whitelist[0x6ae615835aa020fF1239DEC4DD7A3A5e8b975649] = true;
      		whitelist[0x730Ca048cab18D4F09F2A295936325adDfeE7BcF] = true;
      		whitelist[0xC9582D09acDec05aa8Fee7fdebb5F10B7E9d039f] = true;
      		whitelist[0xE16491e0c975E0394D30e356dE7495Ad8550eAfa] = true;
      		whitelist[0x5bd3bf853B9970D93Da64d7628919997C1a06a6c] = true;
      		whitelist[0x98CaC89Bba31cE2B18f8CfdF34dAEdF29F383B2E] = true;
      		whitelist[0x04ceFD6166D0Ee8f8112Cae7237Bb9207a0ef253] = true;
      		whitelist[0x3F38FD15b1Ac453410d8D55e0Ec6696E70BE93a1] = true;
      		whitelist[0xE9fAD6906bF563732012Ebf6c30BD47E5E96EbC8] = true;
      		whitelist[0x4F64C6b8333F74890b0ba0AF4d480d8ecce01e17] = true;
      		whitelist[0xa8A2Aa7200B360e9B76fAFe60950a587449a0ed4] = true;
      		whitelist[0x08295076180ee8A6De5a4221Ab5bcD3f7A61200B] = true;
      		whitelist[0xEf6c1456A2467c9016a443812D0c182706FDF722] = true;
      		whitelist[0x11A6cdf624b0e32B377c6097606edFAB3f0f326E] = true;
      		whitelist[0x003dfd836b5AecC95F0E42F1E1F21879C31E8F46] = true;
      		whitelist[0xCcb147f3ef9Cb2e8E616D5bF55C1147d0Be6b371] = true;
      		whitelist[0x7Ed716a3c0a634fa033CAD0e53BC5fDBc838e23B] = true;
      		whitelist[0xeAc5f9b3cd48123a69FE69CE93A7F58100A56552] = true;
      		whitelist[0xF9567F184dE6B1fcF617850dE093F78f6c78b0f6] = true;
      		whitelist[0x788F93C6165B1Ae7A1297527d0037160A32C1252] = true;
      		whitelist[0xd35fC346e15BA5b446917C9fD23A9471d6144701] = true;
      		whitelist[0xF3D9281fa183B74F32B96E1c5244596045f4edE8] = true;
      		whitelist[0x7302bC5b47F5588174A148C90747a88CB528A8c1] = true;
      		whitelist[0xAca3b4110403F3c4dacb35A7B3Aa0a84eFb6A3e9] = true;
      		whitelist[0x8F8B4759dC93CA55bD6997DF719F20F581F10F5C] = true;
      		whitelist[0x69469f819AbdF47f0164b7fe905993EBDF09bbE8] = true;
      		whitelist[0xb9ab9578a34a05c86124c399735fdE44dEc80E7F] = true;
      		whitelist[0x327F66c77330AD01CBe89DE9523811CBA0c33fE6] = true;
      		whitelist[0x0EC666C5901ba8829138716176Fb44CF214939ed] = true;
      		whitelist[0xD68faC38f2AA31c499DF26e3C432Efe3bB019164] = true;
      		whitelist[0x3BA3D09f70CED571FE3F629Adc234e200ef5EA46] = true;
      		whitelist[0x08cF1208e638a5A3623be58d600e35c6199baa9C] = true;
      		whitelist[0x59e147Ec5BB417745356A1e2d9433F3A07D74419] = true;
      		whitelist[0x87933405d041141e3564cDD7a2D4b62411E76e89] = true;
      		whitelist[0x40CbFEd4ce554C018306207A597586603428152d] = true;
      		whitelist[0xb761b98E4A80A3b2d899Bd5cD7E04288952F614a] = true;
      		whitelist[0x06687d0C06053124BF67B83a71dB1Dfb50A88527] = true;
      		whitelist[0xe425FbdDA869433Db7a123F55d1Aa476947e8040] = true;
      		whitelist[0x439EEc211024b3389D38972003cB9D845cF420ce] = true;
      		whitelist[0xb540b333FD631F8c4bb389c6E81A99dd50C811C4] = true;
      		whitelist[0xfE505FDC65030dD93F44c5bAE1B0F36a55b50291] = true;
      		whitelist[0x1ad0b2a3760E4148479bC882c4f148558F17Fcd1] = true;
      		whitelist[0xdB39DD32A6203840dB4D7406D780aB3125b66588] = true;
      		whitelist[0xcC833833C2B9B0fd7e3122d92AaCb72B53633768] = true;
      		whitelist[0xEa506b68aA88120a939372aB746A1b35551AF6F9] = true;
      		whitelist[0x9d528bfDef21538303A59D5284801299DdF64e37] = true;
      		whitelist[0x80b1960Ce559fDF3f7543B0d87fbB5381f8C3903] = true;
      		whitelist[0x82674C58211C0134348B016810Db718b832d4233] = true;
      		whitelist[0x8029D8D22610E457360e7Bdfb388e138A7730DA5] = true;
      		whitelist[0x97e167a835C54FdeB1F55433ff8bFb94E3359514] = true;
      		whitelist[0xD26593E8A99999d418bC58d7C77Ca10611731162] = true;
      		whitelist[0x159Ae2b05b03460954fe7b6C0984157DA1A64ea6] = true;
      		whitelist[0x1dFbCA42cC60Fbbf3b5FADc3BDF55353B1EA807f] = true;
      		whitelist[0x23B2b77c050c4f4fB2EFEb8A6755719A179e7430] = true;
      		whitelist[0x681Cbae1C41e5eeC8411dD8e009fA71F81D03F7F] = true;
      		whitelist[0xc8664B56Df7ea10C57a8499B10AfC70C78b0650e] = true;
      		whitelist[0xbE863eADD096Fe478D3589d6879d15794d729764] = true;
      		whitelist[0x5b44a8aBf5b5280cD93fc7E481FbF1Fd46bEdB1A] = true;
      		whitelist[0xe6B31e9FC87A81a9bdBFfadBD0c9809f53723efA] = true;
      		whitelist[0xa6D3465aE5Da55e36aE33d508154c91F1fF0Bb17] = true;
      		whitelist[0x517eCA408D25F7058812943f0682271A4271BF08] = true;
      		whitelist[0x2DcCbFFB389576d2Da4e9B71A9016E213bbD5ec7] = true;
      		whitelist[0x1f8A12Ad2F144193B12543ba7fd0410351142858] = true;
      		whitelist[0x2A121375edF522F3bf8e0704661626Eb5C86aC8A] = true;
      		whitelist[0xD30F2888E7928b52EA5bF4cb1D323e0531aFe272] = true;
      		whitelist[0x3B570118B74fa0A39AD7C7FCfd75EF7A7A3e3301] = true;
      		whitelist[0x25A6BBD4D8f041B4B14CD703560995a09A74B464] = true;
      		whitelist[0x42a32D733BDf680c8741C9d2C286D4adF73C0867] = true;
      		whitelist[0x5b2094bc95238Cd5A861eA3Bc8f2e3c0C4678ad6] = true;
      		whitelist[0x70B0013c64E3439dE45bAcAa1978146b14cC9F2C] = true;
      		whitelist[0x528d4e4E0dbF071eC23013f06D8487BaD5A8a68B] = true;
      		whitelist[0x35B64947F786c8B756b35Fd25ef2B9917aCC25d3] = true;
      		whitelist[0x3F138407A8893f20FC47b4ef0A9c972c19084a57] = true;
      		whitelist[0x8e50b222b2C027259392f9F4d6E39e59c24edfC8] = true;
      		whitelist[0xE1fc8b4c3566F5459923CBfadDc1B7741a997c58] = true;
      		whitelist[0xA4f76fd64aD5cd460c6FB918Fc075EBCef8b5F9E] = true;
      		whitelist[0xDAE7ed1ce27D9fF542Ab03c4aD845ACeb2B23E0C] = true;
      		whitelist[0xF1140e2fBE438188dFD2FE1a01C6D24D90eF0CA3] = true;
      		whitelist[0xB7a0cF8cc33025A654A73dbae1256828c004b7dc] = true;
      		whitelist[0x9349F2246D266445f0D40055c9529F084a3ea74F] = true;
      		whitelist[0xa8C14D9Fe2cbDF56E610f8F4647c2776c3505526] = true;
      		whitelist[0xbFCf0663Ec8eAbd2090Fdcb36534fc8352BDc042] = true;
      		whitelist[0xAF77E6ce8FEf4b096E909Ebe6c475Cb991c27675] = true;
      		whitelist[0xBac3346e78f18485575B94AD0b1132017Eccb62f] = true;
      		whitelist[0x4F7f9811De292Aa6E7FbBada8a1EB0eAB5d60254] = true;
      		whitelist[0x849117D3722dC581e588C1F3B02cB7828BdEf2EF] = true;
      		whitelist[0x6c0ea11E09f138d56E61b9dbb86cB7422d4e7183] = true;
      		whitelist[0x6661280D2363f69A615AE69f57aDF936a89644ca] = true;
      		whitelist[0xbAc9E1Da19FF794Cf1037eC332558C7987C6c506] = true;
      		whitelist[0x0B01F1310e7224DAfEd24C3B62d53CeC37d9fAf8] = true;
      		whitelist[0x82A0F25b6FE7E406c2c6E7884342164D7A9438c0] = true;
      		whitelist[0x297cF79ad1CA102DE119fd5C4593E7c4CD99b13C] = true;
      		whitelist[0x52734AA7B37A023BD650355A7Ed91025B1A2147E] = true;
      		whitelist[0x418e2e450B7dE452Bc479A4efCd7f4262c6cf79c] = true;
      		whitelist[0x97A554cb95EDEc7037292dEAa883864Cb35BC668] = true;
      		whitelist[0x16D9fd80d8e3f055ba7793794E811712dcbdD9c2] = true;
      		whitelist[0x7EB91dAD1fb797EF65887105f0DF3d0ceafb871C] = true;
      		whitelist[0xDf4abd11D93cba45F8bE55E3A41c1c18c6f8e9C1] = true;
      		whitelist[0xC17f20335080cD0b7283e042C89F16605f3A085f] = true;
      		whitelist[0x542a5651F84145EfAaf8dC470e2adC2922877807] = true;
      		whitelist[0xC1Ba5d206EE1F07E54185dA06bfAfbF83367BFDd] = true;
      		whitelist[0x4dce3bB119FD5785f5f40B1394fb9b3F4d78096b] = true;
      		whitelist[0xE55c69cfD20Cfa25651c72b84383dE6104104Eb4] = true;
      		whitelist[0x1077011F38c120973238eF266Dd45edad4a78E99] = true;
      		whitelist[0x536122207cdE9c0b261ce01E9Af0EE2743c790bA] = true;
      		whitelist[0x92d0060BF437A8f6BD9AC72233Ab8cB866BC63a0] = true;
      		whitelist[0x6BD662F8b7258D0e371E18A23d509D045e486635] = true;
      		whitelist[0xBA2f3CfC765cCE262579aB6Db69Ac7022bfDf0f2] = true;
      		whitelist[0x21426471eBF0b7db0F07216d81a897B5F5554394] = true;
      		whitelist[0x6EFc434b7858fc7307d0215142b3c019eeee7F72] = true;
      		whitelist[0x13afD331C4D411c0dd81Ea257d6C42b6B8a4BBDd] = true;
      		whitelist[0x269e5f8AddFAF05dDfaef856f6A36fa27fbaCc38] = true;
      		whitelist[0xE37523f553606C6BbB0d5bD78da6C760B368CA2f] = true;
      		whitelist[0x2eFf70000afa05066aF0134A1dF455bd2Cb41763] = true;
      		whitelist[0xFA8479b6933EBD2A5921eBe82EE2734f494E3f26] = true;
      		whitelist[0x5138C21b2A1a4898ee232F00d57B8f68678A7D99] = true;
      		whitelist[0xd0C73ceB728bbD0eE113A7a7e312A0173c833E2c] = true;
      		whitelist[0x92eC90D6e692d39B189308621c9B12f33372dDB9] = true;
      		whitelist[0x189ecEbfa5D3c5EA82d5172b1069c3305a0a149A] = true;
      		whitelist[0x92Cee34282f5ef5F387abE41b2976af83296b316] = true;
      		whitelist[0x49E3cF47606a5Da7B11b270A790E2112a467485f] = true;
      		whitelist[0x552922eEdfF18324098A18b7CC143E96855db7Cf] = true;
      		whitelist[0x4E87AAb2ffC3ddDA8142981273c82Df2b5Cc76D7] = true;
      		whitelist[0x38865683F5DD59048CCA3A2e91064a731bdB45A2] = true;
      		whitelist[0x82509f1803d292FD4bb9A93abA54aA533D6609Db] = true;
      		whitelist[0x6Ac0b41B017347309119e13159878B1F3e3eb410] = true;
      		whitelist[0xe74a12e1bEFb0d65a399db1A6e231abD8Cf4E746] = true;
      		whitelist[0x0EE15685674C6A0B1fF634d23d02D1Cb650d883A] = true;
      		whitelist[0x0700D8a9c0B225946b60F8d24661878CAA6683A2] = true;
      		whitelist[0x853D18353Ac666E87dB98c59550F2C7068f55cD7] = true;
      		whitelist[0xE77d66e7F0903bCE55794E5f5828d521C27e1584] = true;
      		whitelist[0x0c6306c1ff8F0cA8432B761085d5Ce74160A499a] = true;
      		whitelist[0x6Ec06f8835F41Cc79BB4ADf25ba3DE13c7A5996a] = true;
      		whitelist[0x2bDFC32ed7B113D79d04254848C8550D6Be2057D] = true;
      		whitelist[0x6F3bA8A845D18D32bE6985650E449d7c29926F7F] = true;
      		whitelist[0xc3Ab4F4451d65299540242bb8Ab3C2c65154B3F6] = true;
      		whitelist[0x9Ef6aF5379c6C52a1e545Af2085D85015a6aa6Cd] = true;
      		whitelist[0xE2d43dA6A3b36B0E97430e42420BFDE4052D0262] = true;
      		whitelist[0xcc073E4c1930a974bbF9f07cfC845E639c3026af] = true;
      		whitelist[0xD114B66903A4Fe92a75Bb95e6b3059c0766ed0d9] = true;
      		whitelist[0xd2587e936569F12e4e553033C6be96d01440ecB7] = true;
      		whitelist[0xd61daEBC28274d1feaAf51F11179cd264e4105fB] = true;
      		whitelist[0x68e19ADa86678133FEfDc54A98558746bD56B067] = true;
      		whitelist[0x542a5651F84145EfAaf8dC470e2adC2922877807] = true;
      		whitelist[0x985B03CDC4Def39ED62785458F339DE0121be4D3] = true;
      		whitelist[0x681Cbae1C41e5eeC8411dD8e009fA71F81D03F7F] = true;
      		whitelist[0x71EAb2760e640775De36Eed89983741Ae83806C8] = true;
      		whitelist[0xd21f21Ed6B663028D6B9fC31f240e6D42A2E401b] = true;
      		whitelist[0x5877Af7FC64E26c695806E2Fd7e083c8511e61f1] = true;
      		whitelist[0x8149DC18D39FDBa137E43C871e7801E7CF566D41] = true;
      		whitelist[0x053E6294400a9268E35Df445624F58087C7F388f] = true;
      		whitelist[0x1434A664bbAF93AB2655fEf271E5eC4A2431c2D7] = true;
      		whitelist[0xff4160A2355B1fa42722cB63fA482E7061ee40e7] = true;
      		whitelist[0x10455d2469b5235F95C2512026307bD77b1511d2] = true;
      		whitelist[0x376275c4F9e4fffd8A89a90852F253F8e3373F67] = true;
      		whitelist[0x05603561a53de107Ce513fE12ED0B13Cc0Da4ed2] = true;
      		whitelist[0xD09bB703CBB6EB64034296Fc94488b6C6AC4d05F] = true;
      		whitelist[0x34b5f399cc5A1dD491666c9866941FB8E8D09746] = true;
      		whitelist[0x1CBD934Eaf49FE310Ba4E27606029c9dEF0168E3] = true;
      		whitelist[0x96Afed3Ea9A4238F860423B701AB94CAE084F369] = true;
      		whitelist[0x6232d7a6085D0Ab8F885292078eEb723064a376B] = true;
      		whitelist[0xb6E34A8A93031a24C264Be59D0BaC00bcaeF9051] = true;
      		whitelist[0x13280bA47862A393494F5a46c1910385aA292bd2] = true;
      		whitelist[0x1Ca049Ccd785d1400944070c665B3c3132684373] = true;
      		whitelist[0x0f0924A3a5111e7987A23a49Af826D2Ba431342e] = true;
      		whitelist[0xc7A0D765C3aF6E2710bA05A56c5E2cA190C2E11e] = true;
      		whitelist[0x8Da15F7e6bf20Eae393D0210d0F69eA98fC8Ea5e] = true;
      		whitelist[0x9975969F2083694d35448c2a4cC40AfF24566700] = true;
      		whitelist[0x564B5E5BEcDF359357C15810Ef172dD9d6Be6279] = true;
      		whitelist[0x64174450c49242535B4184e3988CC4145B80526C] = true;
      		whitelist[0xF7CB4396Dabe5f86128d03A6781bAFE7844bF6Ff] = true;
      		whitelist[0xA732BB434e43E007C74B5f26250EE92380c3d2B6] = true;
      		whitelist[0x717ba2d9AE88A92C98EB796D3D7dD2D09755a0d6] = true;
      		whitelist[0xb1821263a27069c37AD6c042950c7BA59A7c8eC2] = true;
      		whitelist[0xa1fC498f0D5ad41d3d1317Fc1dBcBA54e951a2fb] = true;
      		whitelist[0x88A92a8a56e21C51d8C0d402d9a84FC81CcfF60C] = true;
      		whitelist[0x4fEf654560d6ad788F4b35A5CD02ed185C12Fbbf] = true;
      		whitelist[0x8293Fdc6648dcd00b9194dfa0ab731b51E294F66] = true;
      		whitelist[0x3704E8d3a85e253b49cda9e5C6470979D6202336] = true;
      		whitelist[0x1793a9D2752A0E65EA66e1D5F536d59717D622a4] = true;
      		whitelist[0xe8d0587D82Ae54b0dd1F8E234bA3f0Ce1E2f047A] = true;
      		whitelist[0xe81FC42336c9314A9Be1EDB3F50eA9e275C93df3] = true;
      		whitelist[0x6a167aBE38959433aaaA984B3d50761aC60ee875] = true;
      		whitelist[0xD80Dae31104d2361402128937bcF92A59F13E6E3] = true;
      		whitelist[0xbb5D3Fc1E82dCAD48d07ADac292a08d765FD1eFf] = true;
      		whitelist[0x2bC99F6C868b14Ea6BdE976CE5310F6115DD1382] = true;
      		whitelist[0xAea6D987D521B0e61FD4af5164Ab743E00eeC94f] = true;
      		whitelist[0x8Fac841807E21807F511dAf3C04a34cd78661F4c] = true;
      		whitelist[0xaEE7E9BB015E1543c8ab3226a9d9615971C4C060] = true;
      		whitelist[0x5F652f6443d742078A9AbB1C9e453Ed009BB64F2] = true;
      		whitelist[0x8ba60b93055713b86A952102239d894dE4b85AB9] = true;
      		whitelist[0xdDF06174511F1467811Aa55cD6Eb4efe0DfFc2E8] = true;
      		whitelist[0x4dDAc376f28BE60e1F7642A4D302C6Cf6CAe1D92] = true;
      		whitelist[0x41A00092909Aa49bB3144eA576d54C4E3e388BD3] = true;
      		whitelist[0x5E78d0c7E548bbD070C84Ef6E199e521f4a135a5] = true;
      		whitelist[0x08cF1208e638a5A3623be58d600e35c6199baa9C] = true;
      		whitelist[0x4EBee6bA2771C19aDf9AF348985bCf06d3270d42] = true;
      		whitelist[0xBc486420659a2009987207649d5d0b401349f679] = true;
      		whitelist[0xC9582D09acDec05aa8Fee7fdebb5F10B7E9d039f] = true;
      		whitelist[0x24f2112A3fe2bc186ffc7ABbAba34bb49d7b199e] = true;
      		whitelist[0x528d4e4E0dbF071eC23013f06D8487BaD5A8a68B] = true;
      		whitelist[0x0338CE5020c447f7e668DC2ef778025CE398266B] = true;
      		whitelist[0xF7FDB7652171d5C2722B4cDd62c92E90f73c437E] = true;
      		whitelist[0x269e5f8AddFAF05dDfaef856f6A36fa27fbaCc38] = true;
      		whitelist[0x327F66c77330AD01CBe89DE9523811CBA0c33fE6] = true;
      		whitelist[0xb9ab9578a34a05c86124c399735fdE44dEc80E7F] = true;
      		whitelist[0xe557fBF5009ed3D3b2a7B2f75c5bc673C0e4D0d0] = true;
      		whitelist[0xfFC88fC868A01003Fe5D3FCC389051a365d4f932] = true;
      		whitelist[0xF9F40ceaca61Ec55CFb09AF821553c3b068341aa] = true;
      		whitelist[0x69469f819AbdF47f0164b7fe905993EBDF09bbE8] = true;
      		whitelist[0xa8A2Aa7200B360e9B76fAFe60950a587449a0ed4] = true;
      		whitelist[0x38865683F5DD59048CCA3A2e91064a731bdB45A2] = true;
      		whitelist[0x4E87AAb2ffC3ddDA8142981273c82Df2b5Cc76D7] = true;
      		whitelist[0x6c71b204b394c9B8ADd99Ea37B6d1c2fc2b130FF] = true;
      		whitelist[0x58f5CE1BDCB2D87EccC0cA2FD8D5073e4EC316a5] = true;
      		whitelist[0x62BA33Ccc4a404456e388456C332D871DaE7ae9e] = true;
      		whitelist[0x16D9fd80d8e3f055ba7793794E811712dcbdD9c2] = true;
      		whitelist[0x0B455480f26444a76638EAC5b6a5B13B60469758] = true;
      		whitelist[0xEf2e060E1569816B37bB923A911eC952b8694f42] = true;
      		whitelist[0x0700D8a9c0B225946b60F8d24661878CAA6683A2] = true;
      		whitelist[0xCa570FB7Ba1Da03a74C929580Dc17d543bF78b90] = true;
      		whitelist[0xD724aDa4d48a795e99e547eb2DC2597B06Ac8392] = true;
      		whitelist[0x08295076180ee8A6De5a4221Ab5bcD3f7A61200B] = true;
      		whitelist[0x8aDc376F33Fd467FdF3293Df4eAe7De6Fd5CcAf1] = true;
      		whitelist[0x7bF925893F7713e00493A67Ef0f0127855AD36be] = true;
      		whitelist[0xCcb147f3ef9Cb2e8E616D5bF55C1147d0Be6b371] = true;
      		whitelist[0xeAc5f9b3cd48123a69FE69CE93A7F58100A56552] = true;
      		whitelist[0x763A7bfDe263168dA6DF5f450b4860ccf76749Fa] = true;
      		whitelist[0xB3787093e364AE7419Bf9d0c4709900C0cF3469c] = true;
      		whitelist[0x84572C31ACdd30c03982e27b809D30b1eFbCD8f2] = true;
      		whitelist[0xeB42B12a965CFc16878A966c635e04f15146c665] = true;
      		whitelist[0x69f32dbe156D3c5c116CA8feC75ECeB5148841e5] = true;
      		whitelist[0xEF1509c5dCb93AFbE3195D4BB28CCc8660eB4945] = true;
      		whitelist[0xac1Eb7459AF366444CC502d9b002E2eEf577C02E] = true;
      		whitelist[0xda1D4Bd894709DbD9a140c05bdaedd19afE7fb00] = true;
      		whitelist[0x11b03346Faabd4A0c9778D2ABa744aE7C7D62B45] = true;
      		whitelist[0xA7D7Ac8Fe7e8693B5599C69cC7d4F6226677845B] = true;
      		whitelist[0x06074Ff83C4240c554dE83160E611007D66125d5] = true;
      		whitelist[0x0Dcf3968f5dD3A68b9a09E67c1E3eC08a82e6C22] = true;
      		whitelist[0xD6b954F59F0Ebb252Edc7796c64BA167A1E2efAB] = true;
      		whitelist[0x144b9A09B3d4e88212F69cf21bFdE6e3Eb64420e] = true;
      		whitelist[0x82674C58211C0134348B016810Db718b832d4233] = true;
      		whitelist[0x4650D0c9E3148A8f66AF374820AA2eCa0A47DAD4] = true;
      		whitelist[0xe45aB678768CC7E5BAb6DE02Fad7235d6c615037] = true;
      		whitelist[0x21af0A9117ee420CB26c32a49c59220F38F5991b] = true;
      		whitelist[0xdDe74f034163192dd2170BB56B9CAc2d45Ce0a36] = true;
      		whitelist[0xfc27C589B33b7a52EB0a304d76c0544CA4B496E6] = true;
      		whitelist[0x92eC90D6e692d39B189308621c9B12f33372dDB9] = true;
      		whitelist[0x003dfd836b5AecC95F0E42F1E1F21879C31E8F46] = true;
      		whitelist[0xC17f20335080cD0b7283e042C89F16605f3A085f] = true;
      		whitelist[0x5204677EeFA881A16D5F8EC4C5978EC3c1dd3059] = true;
      		whitelist[0xc6435031926A631D0f241c9285c98Ea840Ee64DD] = true;
      		whitelist[0xFfDe865353Cb473544b8f98965A9D1f284ddA3b5] = true;
      		whitelist[0x49E3cF47606a5Da7B11b270A790E2112a467485f] = true;
      		whitelist[0xDf4abd11D93cba45F8bE55E3A41c1c18c6f8e9C1] = true;
      		whitelist[0xce0E1766269e63a87FB1C1e5C745B1db32b5713d] = true;
      		whitelist[0x593bee91EBe3A42e809d07189FCEbf9ca0414447] = true;
      		whitelist[0x00bF11233fB3A0C0593129e815D0511870299Bc0] = true;
      		whitelist[0xD39F25Fe6Fc80421585A07FCb854D2b11ceBE335] = true;
      		whitelist[0x182e0C610c4A855b81169385821C4c8690Af5f3b] = true;
      		whitelist[0x7f102a3fa4b786fBDEa615daA797E0f0e41b16e1] = true;
      		whitelist[0xf6910D47FbB1F5518d60C721D4189936eCd5a1b6] = true;
      		whitelist[0xD9917D5c30160240bDE95f8BA2A26034ABbc0541] = true;
      		whitelist[0x8e3eDE4CC366dF012231671863720DCc9C929b16] = true;
      		whitelist[0xA8652526111e3f5a78b112c3A59f0e7593033d70] = true;
      		whitelist[0x333BE3261D637c822DB11085AF4aD9E59aAA2FfA] = true;
      		whitelist[0xfba978799D7a6D67Eac09E2E8c052060804A175f] = true;
      		whitelist[0x5C45b39E13c4129dF392072045747DDbcedA1eB9] = true;
      		whitelist[0xDC4471ee9DFcA619Ac5465FdE7CF2634253a9dc6] = true;
      		whitelist[0x70879832e89e0F307801613aa1DAF2FAe5775A31] = true;
      		whitelist[0xE638cb3fA853622B2824CbDab3C27b06E8049651] = true;
      		whitelist[0xf1ca4Bf4C325C3078Ec25299601A519eBc6BEA6D] = true;
      		whitelist[0xAfAB37e854e2EDb2aa9E2830c6BFcd3eEf5C4C32] = true;
      		whitelist[0x33d704D1347bBf81C05104bC41beE19e83C02205] = true;
      		whitelist[0x3c6d7CE577E3703b8a93d2b77C20B23BfE23eD98] = true;
      		whitelist[0xd26E23aAA39F29e07b299DA734C77765F6866A0E] = true;
      		whitelist[0x435592c9DC7Fe4536c958D8f9975630dF18DF0cb] = true;
      		whitelist[0xe9e9B22B65F17808880f726334BAAfAA8A124Fa8] = true;
      		whitelist[0xBA2f3CfC765cCE262579aB6Db69Ac7022bfDf0f2] = true;
      		whitelist[0xd319f112bf73eAe5e3cf06bF8D4076cC5f8B1cD5] = true;
      		whitelist[0x55b451320A34CE88Fc8F1A1D9156e2AeB8aaD6Cb] = true;
      		whitelist[0xA3C277b8f35881CBdb017E52bcC376B3ce8F21dA] = true;
      		whitelist[0x5036e7857fdB7D8CcEAB64fDcC445C3B370f819b] = true;
      		whitelist[0xa51449B96801233C23639cc7B3D9d95860E1E7a2] = true;
      		whitelist[0x50025A3A50dA7Ae49630c5806b4411B0B7B55821] = true;
      		whitelist[0x035E8A0A57f24FD10D447c6cE44524513dd6e09C] = true;
      		whitelist[0x5EfDd9027575E7c3d1Fa5d7713462CF79Af5892d] = true;
      		whitelist[0xc6334A606bDd3699a553fC47a81796234E217B3e] = true;
      		whitelist[0xBe67DE0C3f7650B958aAbDFfF3BBD8D55d5c2Ccd] = true;
      		whitelist[0x7e8dA72bA1656F62a5a07B18b23E5d23BcD5ed3d] = true;
      		whitelist[0x6F3bA8A845D18D32bE6985650E449d7c29926F7F] = true;
      		whitelist[0x78D6F9b69c99d2D972bfdAC24fbD70B973e3b763] = true;
      		whitelist[0x45698cdCC733cBA4f8B1150C2f580587adF1Df92] = true;
      		whitelist[0x492346B79818f9F4A31C2779b52D1DE2C64DBff7] = true;
      		whitelist[0xd7E5A6F7b8B838F1be0856e5D3DD907608E40E50] = true;
      		whitelist[0x03753428Ea0A136cE3ABA808419B7230e413CE85] = true;
      		whitelist[0x2e274C7Ea1667D37373D6a7eC34201b4F4bB95dC] = true;
      		whitelist[0x6a7ea8945D0Cdb9b53030F63b4b26263e4478C8f] = true;
      		whitelist[0xc8a38F838b7951AB533be6d378ebE298fb41B25f] = true;
      		whitelist[0xBB343898E3cAfd815Ce8184973753fcE6E4341be] = true;
      		whitelist[0xD30F2888E7928b52EA5bF4cb1D323e0531aFe272] = true;
      		whitelist[0x76fC54b4eC08917fc4a7FC6a72d0BaAff9861ad7] = true;
      		whitelist[0x4defA30195094963cFAc7285d8d6E6E523c7f90D] = true;
      		whitelist[0x0EDb2533655876b1656243fd6ee9B16401281df8] = true;
      		whitelist[0x03F52a039d9665C19a771204493B53B81C9405aF] = true;
      		whitelist[0xb78196b3e667841047d1Bb1365AB8fB3d46aB1A8] = true;
      		whitelist[0x9006eeF759C79745509E8D99Ebd84eFD75975f3F] = true;
      		whitelist[0xE2F130B5c02fFBE322DB7904a8a42198ffDC8EC0] = true;
      		whitelist[0x66D30263D3E33dF6fECAFB89Cc6ef6582B248Bcc] = true;
      		whitelist[0x06056Dcdc6471439e31e878492f594B6F0D8F9D0] = true;
      		whitelist[0x79a074122bE96E1Fc9bDd32Dba04759421D12f90] = true;
      		whitelist[0xB8eD097E86b7688F29b5b6Ff649AF573682F6F53] = true;
      		whitelist[0x06CF8399E3f1ef9Cd94031a6FaE9F47877F512e7] = true;
      		whitelist[0x9B32bf5D8D88Dd5CEF0D32cDFFf2eAB50d2e04b3] = true;
      		whitelist[0xcBA7f4f44473e32Dd01cD863622b2B8797681955] = true;
      		whitelist[0x43961f20194C1a27888386F8547B91aC23f9d8Ae] = true;
      		whitelist[0x8Be7b518155184aa03fbDa531a165c567DA9AFfa] = true;
      		whitelist[0x9128a39Fdb22De4cE3594e2e2e8EdD7BD9aBa987] = true;
      		whitelist[0xDD8dB9f64512cB13fDfe24565670C603381FcA27] = true;
      		whitelist[0xe5A7a206E9a8769f90ca792EbB68E9268231F717] = true;
      		whitelist[0x9D16ceDC91b859F2e03d94F479994f795F422e27] = true;
      		whitelist[0xb9d1Fb123C779B47269280D0e152Ac32E40b1177] = true;
      		whitelist[0xf6Ae21A0586691f7F4Ea86fc4c08731Fa455aCB0] = true;
      		whitelist[0x06904f07a74e1d47313cB530AF0487BF705aB099] = true;
      		whitelist[0x64B7fcC8C17540139BDd84d00c7261035602Cb66] = true;
      		whitelist[0x050920eDA4014e25DED17c346b425239a468d63d] = true;
      		whitelist[0xf823825DC97a8c81Ec09D53b6E3F734E76E60cB6] = true;
      		whitelist[0x7cB0393740204B1034E58Fddd1580563B6f3c0a3] = true;
      		whitelist[0x2fF1bdC41B5c602e90951908ffeD997f3b5D97a6] = true;
      		whitelist[0x0d9506F3498c73fA1b26Ec9f8B913834645a8b37] = true;
      		whitelist[0x600a782c4D56961f8f72220d4c28b413b9Cf3c87] = true;
      		whitelist[0xeB5264d5E08452c4966788c1C63D073B56cbff93] = true;
      		whitelist[0xe684AEDcb17D70923dD50aC757ECeDc43d86cc49] = true;
      		whitelist[0x38b3bb561700fc263240c4bCfA6F9a5A10167556] = true;
      		whitelist[0xD5174e20aa8DCaB93bd7551CcB990b4B9E9f7789] = true;
      		whitelist[0x5520082cAfe40F2De90DBDAf29a2ECC606B8f9AF] = true;
      		whitelist[0x13454530E32A74faf73FB8210361aa66C3bba5A6] = true;
      		whitelist[0xab40ef5d3D86f90a5069df913edcDc4E4B99f9a6] = true;
      		whitelist[0x6bd8441EE1e4a1B326a29439A1d225627DfAd071] = true;
      		whitelist[0x67ce74c19cdc9FC596B96778b9C17B10d34AF36d] = true;
      		whitelist[0xc82a75D564521306e7Ee9eBD530a459292c45Ae7] = true;
      		whitelist[0x0E1ca0c78C85457e04DD6F256b290f6c31B7629A] = true;
      		whitelist[0x94B60bCCc939Aeb28FeC230659E4603eF17324f7] = true;
      		whitelist[0xc252e410E213A9bc3DB942B4C7c6C69AA3cE8718] = true;
      		whitelist[0x79FBa65F42731E4a4dB8472f0B2A5b48d0b4E7F9] = true;
      		whitelist[0x1F4FD7F98275D44A48E1DDFB184aa125dC8Aa9AE] = true;
      		whitelist[0x419Cd8897906fA7A60105b2f0c3369e0e36D8D26] = true;
      		whitelist[0xAa73bdecb77AE96c2C73530cA1A276E256cb65e8] = true;
      		whitelist[0x075483AD26925E558955Ca1D2679c12D8453a8CA] = true;
      		whitelist[0x33cB0C602d9D2965c5538731bAB28F122988f74E] = true;
      		whitelist[0xDc610C4766450E3184AfC312ef2224702299219b] = true;
      		whitelist[0xfD3414fd643023D73457a7BFD628959E0f55CC97] = true;
      		whitelist[0x0778e79130594FA32B0b3eC87E1d9f92AF43BcE7] = true;
      		whitelist[0x9D2daC55816Aa70cF0357492E5A111461F912B19] = true;
      		whitelist[0x284A9e0f4F7869b3294d1931B9845740A8607586] = true;
      		whitelist[0xA5471Bd195552d35f299AFb4196750005e7298F5] = true;
      		whitelist[0x04B9Cad474D427576344152FbEa36b996C586076] = true;
      		whitelist[0xD1370243a9e83b9641f90C1Afd012BDa729331c4] = true;
      		whitelist[0xBEEf32ccA6966bD3Bd0aA02659f829FcC8631a84] = true;
      		whitelist[0x6519E6117480D140CD7d33163aC30fD01812f34a] = true;
      		whitelist[0x18aEc641D8e2b1108FF5fE048539824b5B62c8E1] = true;
      		whitelist[0xd48D8cef2F1A7b29BAFb5E17e8B88bfEBaeC602a] = true;
      		whitelist[0x10665581d1ce1ef67593b7770F9fA555C9009C06] = true;
      		whitelist[0x7545E91679A6cc1d744690F136fF5c705c2dDB67] = true;
      		whitelist[0xF3D9281fa183B74F32B96E1c5244596045f4edE8] = true;
      		whitelist[0x9431D1615FA755Faa25A74da7f34C8Bd6963bd0A] = true;
      		whitelist[0x51050ec063d393217B436747617aD1C2285Aeeee] = true;
      		whitelist[0xf2D499fD020d1b711238461F96DA9A07A137660d] = true;
      		whitelist[0x186d562907bB057377d5c87e4f543C434fDB58F4] = true;
      		whitelist[0x91cE2EaAa0ae31B8b109E4a2038Fa7aC3e83034f] = true;
      		whitelist[0x5e40E0ad7b8b37C63aC1B9039b91E223DD27D688] = true;
      		whitelist[0x6A09156e3741955f5fA556f61F5c9546e52c45f7] = true;
      		whitelist[0x414be4F8572176Ac908926Cf2A9c328b873F75Bf] = true;
      		whitelist[0xBE994cF43F52Fd73FE45ceD29F06D1B08bd1709A] = true;
      		whitelist[0x2206e33975EF5CBf8d0DE16e4c6574a3a3aC65B6] = true;
      		whitelist[0xB618aaCb9DcDc21Ca69D310A6fC04674D293A193] = true;
      		whitelist[0xC77848cDD3D3C91A7c3b25d6443d2871bcbaFFc1] = true;
      		whitelist[0x270e3A305495e675d582847D8F3Ac4d10825A690] = true;
      		whitelist[0x7807829E002aD30F68c3072B3260bF912B3394Da] = true;
      		whitelist[0x4a60A51B200cfC0224645C515530dcB3efFCb370] = true;
      		whitelist[0x1f6D31774AD51A60C7b53EeC2C37052F6635235A] = true;
      		whitelist[0xaF7031b4f2a1A52338fE6Bd75409e38564838154] = true;
      		whitelist[0xb418Bd3d37e947C4B954C3750bF74C99804Fd776] = true;
      		whitelist[0x64ab118484c38baEb5B924143ca459706c03953F] = true;
      		whitelist[0xCf1DF6C3A26064A05b6437BBdF377fE46ac2d753] = true;
      		whitelist[0x822F86864da9fE5ca3cAb3B7438CF6227f459346] = true;
      		whitelist[0x8D19a5C86cf176d49419DD7E4EEC7b81B96431c4] = true;
      		whitelist[0x8683A90E9fe51AF9e452437f14Fed9241Be9413e] = true;
      		whitelist[0x0A4095a90bBe52625599EFd4B698d8d01B32676C] = true;
      		whitelist[0x1E6BB25d0068C11331c100e3c7eDb3bb8b98d042] = true;
      		whitelist[0x8B6D3eEe9048304aac53Ba571B1889A4f0609474] = true;
      		whitelist[0xba6332d3f01D220f1Cc2Fda423Ed89249D495C43] = true;
      		whitelist[0x9eaC7914e6dC6889E368dD48E3089706D7536a1b] = true;
      		whitelist[0xf6607ad5992f32448D307ddC20f71D88B4fe35A5] = true;
      		whitelist[0x93f0C941Da115cff5680F83172248e7644f5369e] = true;
      		whitelist[0x768058a4b0054dc1cb025889B2eFD9C2051d2Bf6] = true;
      		whitelist[0x2D8f11b3e4010C067Ad964D5d8558e2b61E21f07] = true;
      		whitelist[0x277d1523f3993bb40eC647a2236316eAf5A39cF9] = true;
      		whitelist[0x14B072f1954DD88131271D597A30e9899B57eb0F] = true;
      		whitelist[0x5d96D8F927a7bf5F342017CAF70039B9e9CFC216] = true;
      		whitelist[0x51Bd2CCceB74999380c26E401aC87D4afEf092Fe] = true;
      		whitelist[0xe31AAf1A3C67D6909Eb7D104A620d3CD85c8411A] = true;
      		whitelist[0x95B97AaA76fC57DCd65df419C6ccd73efaE611ad] = true;
      		whitelist[0x8C1D0aC50ad00C220936E2f1647405B12B0B91C2] = true;
      		whitelist[0x85CdF932E2cf53f8011D09A0088bF06D9dD96179] = true;
      		whitelist[0xA289b1a2594bEa59e34DF6A17544Cc308C8e18F8] = true;
      		whitelist[0xd23199F1222C418ffC74c385171330B21B16e452] = true;
      		whitelist[0x8d17Ff92B8C92Ed3C3f0A99e9A1aB817Fb895BF7] = true;
      		whitelist[0x6b7C318467F409A5Af2F0A9d0976Ef7b72d22a62] = true;
      		whitelist[0xEf6c1456A2467c9016a443812D0c182706FDF722] = true;
      		whitelist[0x265D5CEDbCecf2a70E78D31D0AcC7BE8617de7B9] = true;
      		whitelist[0xd0D004B4ce867785D9aB4C684f0497680AA7B6Ae] = true;
      		whitelist[0x325296d941a6e2d77f084488676704F8CFEc7b51] = true;
      		whitelist[0x55EEeE5F33036885C336a78564522e89B69c26dC] = true;
      		whitelist[0xc07A18c4ccE7F95A413515d3D137De47BcFfb495] = true;
      		whitelist[0xc3Ab4F4451d65299540242bb8Ab3C2c65154B3F6] = true;
      		whitelist[0x418A9a9f182B04EE9BDC5AE0dd0B4f0976dF5Eda] = true;
      		whitelist[0xDb2eDCC7880F0071959e2f6713CC335a6690FC84] = true;
      		whitelist[0xf19F3d5F1CB45a6953d6B8946917b06431314C00] = true;
      		whitelist[0x89831EF83444823b033CBfEbf877a197D39aA231] = true;
      		whitelist[0xB82eB1dA53C5e394f8525c7D627dd03640D6bc97] = true;
      		whitelist[0xB09D70324fb2c73bC8Ba5c7fc1270Ec0c0546407] = true;
      		whitelist[0xB15f55B848B56F80a08759C4064cb2e1957be6c0] = true;
      		whitelist[0x46EcB3F576c31290E1A4b359fd993e36E86Ef9e1] = true;
      		whitelist[0x3BA3D09f70CED571FE3F629Adc234e200ef5EA46] = true;
      		whitelist[0x812DbB12a51a5173cBAE829dD451CD4A79f6a756] = true;
      		whitelist[0x07819CD403605c35C94BcFdF386fdD5312D7D706] = true;
      		whitelist[0x657A38e6994CB578351376dCDb077330D00665d6] = true;
      		whitelist[0x120fb4D4b80DC98BF27341f0D98F0CCedFEeFDd4] = true;
      		whitelist[0x767CD29fA0BeFC46690F2547a826152d67dFB189] = true;
      		whitelist[0xcE64da4caf4c7D5A65c74Fbacb16E170d300285d] = true;
      		whitelist[0x4441fBd5E5E1A5AE0BAD986C015c0DE9a320cE2C] = true;
      		whitelist[0x329E630CA8507829B90660c26C555A906f6782e1] = true;
      		whitelist[0x008BA4907924f86C62fBb31Fe4A0dFE91c0e6acc] = true;
      		whitelist[0x21258055dfd7a287DCC224E3586210F1864c1996] = true;
      		whitelist[0xdAE4012B41657B7118324Fe13aF91eEc0EC95acD] = true;
      		whitelist[0x9294bb652f4B1392Ff8c266Cc75BA45ba312c124] = true;
      		whitelist[0xdcbe2EDb494a5816Fb234b2407877149291d8bA4] = true;
      		whitelist[0x10172b1A8fD270C2F4F45561617747ad2a35B31E] = true;
      		whitelist[0x25a61B9CB2D749b062fA87b792ca60faEdDdF851] = true;
      		whitelist[0xAf981AFA2f5fd50ffEDBB5728FA0fFd2a99b93CE] = true;
      		whitelist[0xE3f3EbacD9Af846fd2385F390E400fe520923173] = true;
      		whitelist[0xCAaD0665CD8007D692e57188A1C8e38Ea0A38F50] = true;
      		whitelist[0x0F4Dc70b4229e859fC25DC8cA4Ea58956359eD83] = true;
      		whitelist[0x3d7cdE7EA3da7fDd724482f11174CbC0b389BD8b] = true;
      		whitelist[0x97A554cb95EDEc7037292dEAa883864Cb35BC668] = true;
      		whitelist[0xD31D14f6B5AeFDaB5fE16DeA29fA46F6B8c15bF2] = true;
      		whitelist[0x419fD53f8c5c957Ae2c52A7df6904e986E59db62] = true;
      		whitelist[0x9402B3759C8f8f338639566826Fe7A684BA143B0] = true;
      		whitelist[0x23FA84013Ba906121D80d839321823F75cE018b6] = true;
      		whitelist[0x98011a7b0795F456FfcE7c988369f1149e8AEba2] = true;
      		whitelist[0xEa302cF778a1186843Ae10689695349f5388E0D9] = true;
      		whitelist[0xaECf6412Cf1A51986185F5718FadD640bae5C7cB] = true;
      		whitelist[0xb65aFAa2c59fd94f00D667F651B5D0c800ab99B6] = true;
      		whitelist[0x4d0bF3C6B181E719cdC50299303D65774dFB0aF7] = true;
      		whitelist[0x22C3378F9842792f9e240B11201E7C2F4901a408] = true;
      		whitelist[0xC208C84FC1B7A11ac3C798B396f9c0e5a23CFA38] = true;
      		whitelist[0x753e13f134810DFBE55296A910c7961Aa1B839C4] = true;
      		whitelist[0x34D7bCeaA2B3cfb1dE368BAA703683EDC666d3f1] = true;
      		whitelist[0x2D2c027E0d1A899a1965910Dd272bcaE1cD03c22] = true;
      		whitelist[0x6dE12C6478cba122eCec306e765385DF4C95E883] = true;
      		whitelist[0xdc52C2E7FC45B30bd5636f8D45BBEBAE4CE87f46] = true;
      		whitelist[0xfF5723A2967557D5a6E7277230B35b460f96E56c] = true;
      		whitelist[0x79CE43f7F12d7762c0350b28dcC0810695Fb24dD] = true;
      		whitelist[0x7E6FF370343468f5Bf8307D05427D1B02fE74E68] = true;
      		whitelist[0xB0623C91c65621df716aB8aFE5f66656B21A9108] = true;
      		whitelist[0x12F4b06a8cED0c0f35a5094c875a2b8a86562498] = true;
      		whitelist[0xe43A5Bda37e98A9fb6F40Bdee4147C7D0C5a7dDE] = true;
      		whitelist[0xab35EE8Df2f8dd950cc1cFd38fEf86857374e971] = true;
      		whitelist[0x128Db0689C294f934df3f52e73877a78f2d783B5] = true;
      		whitelist[0xc48d912C6596a0138e058323fD9929209A66Cfd8] = true;
      		whitelist[0x02e04F52Dc954F25831e4edFd1A1086B9feEf801] = true;
      		whitelist[0x75291cB8b75d6D0097a95F9F5B5389E20B1Fe40a] = true;
      		whitelist[0x7f92C0b4970b8459462DaC9e3256a016B45ee15E] = true;
      		whitelist[0xEA5338F40A649b58f15eBA78eF67262558343F03] = true;
      		whitelist[0x552922eEdfF18324098A18b7CC143E96855db7Cf] = true;
      		whitelist[0xfbA792D508d0f61e6BFD7c5A5bd00802a97AA0b2] = true;
      		whitelist[0xb9dBf2caE6Fd864B1F7C2fb3dF5c0ce68D0E6B59] = true;
      		whitelist[0x853D18353Ac666E87dB98c59550F2C7068f55cD7] = true;
      		whitelist[0xAef9a463CB85e771bD8F3536e04956d30ee31ce2] = true;
      		whitelist[0xc0b75b61c6ECFfd77743a8b77BD8a3E7fCbc5a93] = true;
      		whitelist[0xa837b0f94974f37e17347A0BB8C448d8F25D0B0B] = true;
      		whitelist[0xA95F4f51cc7FfB04e97eF0dDC9B6060c9200eE80] = true;
      		whitelist[0x5e58538cc693b1099C68d7fEF963C1f148DaE8CB] = true;
      		whitelist[0x4771B65e9A825d2917378F43810F6bAF4ce3F732] = true;
      		whitelist[0x35bD3902A2Ed264f1803f78423e71Ee0BD7b189B] = true;
      		whitelist[0x068baEE003C32D507a64eD7AF700a0aC7074Fa58] = true;
      		whitelist[0xBd87C000fd1222d5dE79D91ef9ff23Aa6d1b0F52] = true;
      		whitelist[0x8eBc92675F0182182994B44B204be932565E736D] = true;
      		whitelist[0x6Ac40b84f5732cCc2d21ebe71f2ACC4140314843] = true;
      		whitelist[0x6963D1743A452FE1A082B76b1432037a12c2C742] = true;
      		whitelist[0x41BF39033C732F884A52ddf38F647aD63457CEEC] = true;
      		whitelist[0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC] = true;
      		whitelist[0xd3A1ab87C8aB81CB093Ef5430A387D127ac523a0] = true;
      		whitelist[0x39B557A249706CAC1DFfe157cE5D25fF1791b56F] = true;
      		whitelist[0xE0Dd8C40ACC74005C71CE5d02Cd5116A2eEDB1b0] = true;
      		whitelist[0xF6f4B3d80884DCf2E602820622cafC1Bcc1F9AFE] = true;
      		whitelist[0x95eE9e136f0d5EB6fb5b7b83Bd09b35e21ba55F0] = true;
      		whitelist[0x127fa43E17eA1a819cD07692Ee17D4F65E927564] = true;
      		whitelist[0x328Ca06CA310EFd4cbf9Cc2DD4B62C7dbC1BB791] = true;
      		whitelist[0xC9b5db189631ED9bB35eb795826d90717b43B56A] = true;
      		whitelist[0x13FD513c2104941Bc399589b5391957B27392E8b] = true;
      		whitelist[0x7F7d6649af37189C3C1CBA4407265218086D5716] = true;
      		whitelist[0xA1c256282e215e3040F3Fe5f17bb105C72Ec4E25] = true;
      		whitelist[0xCeba00f5c2e0cA4E8dAE4D88EF79190a648B9966] = true;
      		whitelist[0x2A3Ce3854762e057BA8296f4Ec18697D69140e1E] = true;
      		whitelist[0x6DC16Cb8532967534Ef2BFE8C4eDEE9fD552603e] = true;
      		whitelist[0xC2488CcF46573821a02E0dE829f1970dbC14A3E9] = true;
      		whitelist[0x6564f96bE476A430Dede03EcD7352Be33B12FC0F] = true;
      		whitelist[0x6457A438e924EEeb2aA14C254db044bf774b62Eb] = true;
      		whitelist[0xeD66cE7eEe03790056cA5Ba5ee61Bc4F77bA2DED] = true;
      		whitelist[0x4c3A392af5FC22253743b0600a4365DF3A7F9893] = true;
      		whitelist[0xbA993c1FeE51a4A937bB6a8b7b74cD8DfFDCA1A4] = true;
      		whitelist[0xDf9c5Cf591e1338bBA20A26D4177B733713108FD] = true;
      		whitelist[0x4Fc83f87639C917A9703F135f4C48a50e54eF8c3] = true;
      		whitelist[0x5Ed9e63Ea642DB16B3B6A58E3F867668178ac222] = true;
      		whitelist[0x42FB05E09f8A477620dEFe49AF76e577Cbd791D8] = true;
      		whitelist[0x775C4B0f9f13fc32548B060ab4bf5eff44B08348] = true;
      		whitelist[0x7b5296dB485B599DD8604346163c0DFaC096D553] = true;
      		whitelist[0xD6Fd8413B1FaCafcB46b3F7C08d07DaA0fe5E770] = true;
      		whitelist[0x01be72263B12fE4D51919786f65bF13FF3E58ebE] = true;
      		whitelist[0xa47Fd53CcEc8fe0ec67794AeA9e3Cd392A49b88E] = true;
      		whitelist[0x013bbCfF38F4E875B0218E4eB460e0E7c8FFaFc2] = true;
      		whitelist[0x8DD6629B2272b4fb384c13E982f8e08Bc8EE001E] = true;
      		whitelist[0x1AfC8C45493DFb8176D12a5C5A0469dC4c14f02a] = true;
      		whitelist[0xBb179f078BAC0FF4f181F6e01606cCAe883Ef74D] = true;
      		whitelist[0x9Be8cbE548110b4F09D932cdfbaC082c9dD98899] = true;
      		whitelist[0x41a195cD1b26cA3774f761c5652c9E0841932126] = true;
      		whitelist[0x6885863E1aAa726346e9Ea88b7273fe779075E8a] = true;
      		whitelist[0x97bac212815DfF849820e34b6F9a58e4C40909De] = true;
      		whitelist[0x8Dc9c53B85FC13779C5874be6fD7A20Ce3Cf7e20] = true;
      		whitelist[0x83E84CC194E595B43dCEDfBFfC3e0358366307f1] = true;
      		whitelist[0x107Fb8867608508eb4B9F69333603fCD632BF330] = true;
      		whitelist[0x26983a34F4E6cA1695C7b897904AD9212d042d27] = true;
      		whitelist[0xf6FF6beCFe9D0b78424C598352cC8f64D0d1d675] = true;
      		whitelist[0x553ea73C8d7932c94830Bfe16d91Dd3931d87305] = true;
      		whitelist[0x7fC9435A996E6F07e75c244bd9F345FAAF81AF8C] = true;
      		whitelist[0x3D5c457920Ff88a7a42D2aF63d450E5F2da61d14] = true;
      		whitelist[0x99F0764BECCAEF7959795c16277a10CA7a80369C] = true;
      		whitelist[0x2378598aEf5768d12df9ab72dee9AF37a2741F5A] = true;
      		whitelist[0xA58715f1069d82233ba2bFa88058774678b33F05] = true;
      		whitelist[0x660157aeDBF8f046b50D6EBd3a4502007aB6cBE7] = true;
      		whitelist[0xb0cFeA22b93a4C85C46c55f6e665a77fefC5D197] = true;
      		whitelist[0x55e2880c6984f671A78044B4027C899b12d7BA86] = true;
      		whitelist[0x64Ad18fd2cdE41578d231955C98A714f8CBaC239] = true;
      		whitelist[0x1C12c3FB74aA4658B13bDB744Fc314648311A082] = true;
      		whitelist[0x993f5b993e733d7840F25981138DA602430e13Dc] = true;
      		whitelist[0x977D3dbf93174f517a52736E1e556B79300CE3cC] = true;
      		whitelist[0x22a001Eb8434Dfe92C22Af924A9A0a6ddA82B5e8] = true;
      		whitelist[0xAdC3BD4529cbE18291E3f2dB73Cb7630Aba73Cb7] = true;
      		whitelist[0xeCC1C3d38460FFc4fd58BECAEF72A90EdF0613a4] = true;
      		whitelist[0xb6D089F0b4865F922FE92815A1c90b53598e5AAe] = true;
      		whitelist[0x91aD771F1e4978479f7451F76d423093D26ba616] = true;
      		whitelist[0xbFd3F0350120Ed7e7c45b722E69D6f5e1a063c6C] = true;
      		whitelist[0x2E601885896103318269CA45431B943a6C8Ae39a] = true;
      		whitelist[0xE4E565C4a2A5050BA1020314c76420dd52D88Cd6] = true;
      		whitelist[0x6375594B4175100055813039CA22476CDDE06328] = true;
      		whitelist[0x8C8024bf5f90a06CCeD7D32BAbcCB934942c82f6] = true;
      		whitelist[0x0Db99Bf3b52EDa95FD6647C16442EF55815a40A9] = true;
      		whitelist[0x9b973568b0664BFcA35e8F0Aa39daEEA737b3fcC] = true;
      		whitelist[0x3822881D61803AF91a95847ad20B1bF20A5671B2] = true;
      		whitelist[0x02a5c980029cB470Ac89Df2E2de1CF453aEE6558] = true;
      		whitelist[0x7b923AaB6126b5F09b141e9cB4fd41bFaA6A4bB2] = true;
      		whitelist[0x89032c0cFF4abb9bc490dF104Ec89eff27314909] = true;
      		whitelist[0xF848E384e41d09DCe3DcAeD37e1714418e68ea7F] = true;
      		whitelist[0x4FFe858b37c9398237246A81885c5d4dCB38245e] = true;
      		whitelist[0x7373087E3901DA42A29AA5d585F9343385Fc2908] = true;
      		whitelist[0x9f477D97a21389542e0a20879a3899730843dcCD] = true;
      		whitelist[0x823dC685e777a7523954388FA7933DA770f49d42] = true;
      		whitelist[0xDA86955802A0e8f69F1C8e04090E4dC109fd9653] = true;
      		whitelist[0x8683BbBe511B269F1b9dC0108fb6B267Ea764F8e] = true;
      		whitelist[0x1AC08405E96E3561893eef86F194acDB9A24D38D] = true;
      		whitelist[0xe7779a8C5005098328A1ece6185B82c6A9DBE56D] = true;
      		whitelist[0xd8758354945360a603BCbe1bb31C56383f6FefF3] = true;
      		whitelist[0x7a2269e15d34FC2a69e4C598A7DC51733ae93638] = true;
      		whitelist[0x9643805d1756d8990B5C492a2c3374a4dd29FA80] = true;
      		whitelist[0x473888e67636661062daD4CFfC92a39437810313] = true;
      		whitelist[0x22720cCDe7Db8141576f844beAfCC9c7B7D602aA] = true;
      		whitelist[0x68c3494bAd6011033d10745144B51890861422E9] = true;
      		whitelist[0x2eFf70000afa05066aF0134A1dF455bd2Cb41763] = true;
      		whitelist[0x0D0b3B531cDBB38F854613969d83334cD73dC7CB] = true;
      		whitelist[0x44ddBB35CfeBbafE98e402970517b33d8e925eB3] = true;
      		whitelist[0xE076f2722c830d4441ec0BCe158fA1956e8B162E] = true;
      		whitelist[0x2D0d77065aB397CcC8D7cCFD847eF46074a93c38] = true;
      		whitelist[0x829004098cFd973A574a7c18dce5CD10EAa96Cb0] = true;
      		whitelist[0xd7d35C3FbfeAaAA6ad1C9C020ED39764E0A604bb] = true;
      		whitelist[0xF6746F1472EA920eee7b793a4d48BE0fEA647Bfe] = true;
      		whitelist[0x03eE1E0e4eaa0eF034aC81831FAe674135a4995a] = true;
      		whitelist[0xaF2E6340bcF42C39467dD6D86632a2db42C11dc5] = true;
      		whitelist[0xBA12D8B01A6Bfe6FFf2250912caB159455Ee87ad] = true;
      		whitelist[0x51e13ff041D86dcc4B8126eD58050b7C2BA2c5B0] = true;
      		whitelist[0x78c4B4A8BB8C7366b80F470D7dBeb3932e5261aF] = true;
      		whitelist[0xBd8e9e39ad49D2607805b77951C9b284E4E8CF31] = true;
      		whitelist[0x71211a75C7995aA0a3f3FbF666ccb9446cE051B3] = true;
      		whitelist[0x254B8073B057942235756B7E7249fB5Ca60753Ef] = true;
      		whitelist[0x86Fd708A7762B5cb8625f794263516b95B22e129] = true;
      		whitelist[0xEaf7D511a1956c9D297EFBB2D81b528B37D1d8D7] = true;
      		whitelist[0x2a7B50f2FbdEfd9CAFF33cb386d87269EF5aBfCd] = true;
      		whitelist[0xBa1fA72bE53A1693dE4867DeA60fA9f041073BEF] = true;
      		whitelist[0x7FF50D24C87F3A4E0c3C527bBB563715cE6E71c5] = true;
      		whitelist[0xF43479102a0d24d068a7912B092689000d9Cc5F0] = true;
      		whitelist[0x7a18960043093E89d804A30D5664Ce769cd153A1] = true;
      		whitelist[0x989057259D3a0D75c4C0E21584E296bBF044E722] = true;
      		whitelist[0x50491bf5d8EA8d23AADeB482be496590DAb34fb7] = true;
      		whitelist[0x915782DB070B286375C4B757f63fC9a81c3E93F7] = true;
      		whitelist[0x4dd5D12a6b16224b4d234F0A06De1587db190679] = true;
      		whitelist[0xc3B39978C872B3DD3A52Ebe34A6A3B08De7762E8] = true;
      		whitelist[0x7a9DC8eEaf5022cECd60C54A042343484ce6C065] = true;
      		whitelist[0x469B786bd2416eb6EB832741f2FD536F60a355D3] = true;
      		whitelist[0x523A16DCF25698a9992327BD0c1d9832c82b8A4D] = true;
      		whitelist[0x559d92d2bF798c4310e5b71001B6351c3c96005C] = true;
      		whitelist[0xcfadBa5101911D04189331ff9F6e42fE44567439] = true;
      		whitelist[0xD5D4aAFb3B2217607e5B5B5526Eb6932f8DF130F] = true;
      		whitelist[0x6e3f8E093Fe749398aac60515686fC4FC4baC514] = true;
      		whitelist[0xfD2307923C117e384b3aa9E34Bfec419Cb66a14d] = true;
      		whitelist[0x2847E472A7F56c1693A815F2CA50F30d3d263F4E] = true;
      		whitelist[0xaB4bE3171994fEa9F6717DbE1D2f7839295e7688] = true;
      		whitelist[0xF6b11609c3A5bCDEbA0EAB46799A3ed7C1323db8] = true;
      		whitelist[0xcC4f052FCDf3C94cc5acDec24E415248dAC9eEc2] = true;
      		whitelist[0x094F8EECDf916aA47E5382c1c1E83888bCC03dfF] = true;
      		whitelist[0x7E9631b460DE70F5b089594C4aC83Ce7026cd0B2] = true;
      		whitelist[0x00C994c17976B06b6A7b22460E9001ECdb25c511] = true;
      		whitelist[0xf2439241881964006369c0e2377D45F3740f48a0] = true;
      		whitelist[0x4EfeceA2A42E1E73737e4dda7234e999A84Ca60B] = true;
      		whitelist[0x179891636BAeAf21c5DEA72Ff9144fc4e4f48680] = true;
      		whitelist[0x87Aa1150cAF247a35f303AA051568a81FeCa11a2] = true;
      		whitelist[0xaDba5Ea1525C5aE27A0f98408C8E5D67e28c754c] = true;
      		whitelist[0x1E94b256C7B0B07c7c0AEd932d12F03034c601Ab] = true;
      		whitelist[0x1aD42FB475192C8C0a2Fc7D0DF6faC4F71142c58] = true;
      		whitelist[0xAb30f11201d6D53215729D45DC05a0966C237922] = true;
      		whitelist[0xf4f5AC536B4E39dAe47855744C311A87361337d8] = true;
      		whitelist[0x4065a1D266B93001E7DF796735C68070E2154fa4] = true;
      		whitelist[0x612aFa0059F72905f78f45fD147Cda08311b24eB] = true;
      		whitelist[0xb48d6C33A96F5519C82569b478fcD723b3A94a2A] = true;
      		whitelist[0x501D63B672E92274Ec7dCd4474751D8F62933386] = true;
      		whitelist[0x370F75f54907AA06584892A86F891536DB5C4F49] = true;
      		whitelist[0xf21E7aF6777b9a8F1eB57A94B5F1501e68eBFb91] = true;
      	}
      }