ETH Price: $3,384.75 (-1.54%)
Gas: 1 Gwei

Token

ApeVineVouchers (AVV)
 

Overview

Max Total Supply

150 AVV

Holders

40

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
culinarycrypto.eth
0xc38086bcacd96e8e6471844b186a62d2252d0105
Loading...
Loading
Loading...
Loading
Loading...
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
ApeVineVouchers

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 10 : ApeVineVouchers.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ERC1155P} from "ERC1155P/ERC1155P.sol";
import {Ownable} from "solady/auth/Ownable.sol";
import {ProofOfWine} from "./ProofOfWine.sol";
import {MembersOnly} from "./MembersOnly.sol";

struct VoucherConfig {
    uint16 totalMinted;               /// - [0..15]
    uint16 numRedeemed;               /// - [16..31]
    uint16 maxPerWallet;              /// - [32..47]
    uint16 maxSupply;                 /// - [48..63]
    uint32 redeemedStartTokenId;      /// - [64..95]
    bool mintIsActive;                /// - [96..103]
    bool redemptionIsActive;          /// - [104..111]
    uint72 pricePerBottle;            /// - [112..183]
    uint72 pricePerCase;              /// - [184..255]
}

contract ApeVineVouchers is ERC1155P, Ownable {
    error NonexistentToken();
    error VoucherNotMintable();
    error ExceedMaxPerWallet();
    error WrongValueSent();
    error FailedToWithdraw();
    error RedemptionNotActive();
    error ExceedMaxSupply();
    error InvalidConfig();
    error UnlaunchedToken();
    error NotAMember();

    uint256 internal _nextConfigId;
    string internal _uri;

    ProofOfWine public immutable proofOfWine;
    MembersOnly public immutable membersOnly;
    mapping(uint256 => VoucherConfig) public voucherConfigs;

    constructor(string memory vouchersUri, string memory membersOnlyUri, string memory proofOfWineUri) ERC1155P("ApeVineVouchers", "AVV") {
        _initializeOwner(tx.origin);

        _mint(tx.origin, _nextConfigId, 100, "");

        voucherConfigs[_nextConfigId] = VoucherConfig({
            totalMinted: 100,
            numRedeemed: 0,
            maxSupply: 1000,
            maxPerWallet: 1000,
            redeemedStartTokenId: 1,
            mintIsActive: false,
            redemptionIsActive: false,
            pricePerBottle: 0.045 ether,
            pricePerCase: 0.5 ether
        });

        unchecked { ++_nextConfigId; }

        membersOnly = new MembersOnly(membersOnlyUri);
        proofOfWine = new ProofOfWine(proofOfWineUri);

        _uri = vouchersUri;
    }

    function mint(uint256 id, uint16 amount) external payable {
        VoucherConfig memory config = voucherConfigs[id];

        if (!config.mintIsActive) revert VoucherNotMintable();
        if (id > 0 && membersOnly.balanceOf(msg.sender) == 0) revert NotAMember();
        if (amount + _numberMinted(msg.sender, id) > config.maxPerWallet) revert ExceedMaxPerWallet();
        if (msg.value != config.pricePerBottle * amount) revert WrongValueSent();
        if (amount + config.totalMinted > config.maxSupply) revert ExceedMaxSupply();

        unchecked {
            voucherConfigs[id].totalMinted += amount;
        }

        _mint(msg.sender, id, amount, "");
    }

    function mintCases(uint256 id, uint16 numberOfCases) external payable {
        VoucherConfig memory config = voucherConfigs[id];

        uint16 amount = numberOfCases * 12;

        if (!config.mintIsActive) revert VoucherNotMintable();
        if (amount + _numberMinted(msg.sender, id) > config.maxPerWallet) revert ExceedMaxPerWallet();
        if (msg.value != config.pricePerCase * numberOfCases) revert WrongValueSent();
        if (amount + config.totalMinted > config.maxSupply) revert ExceedMaxSupply();

        unchecked {
            voucherConfigs[id].totalMinted += amount;
        }

        _mint(msg.sender, id, amount, "");
    }

    function ownerMint(uint256 id, uint16 amount, address to) external onlyOwner {
        VoucherConfig memory config = voucherConfigs[id];

        if (amount + config.totalMinted > config.maxSupply) revert ExceedMaxSupply();

        unchecked {
            voucherConfigs[id].totalMinted += amount;
        }

        _mint(to, id, amount, "");
    }

    function burnAndRedeem(uint256 id, uint16 amount) external {
        if (amount == 0) revert MintZeroQuantity();
        VoucherConfig memory config = voucherConfigs[id];
        if (!config.redemptionIsActive) revert RedemptionNotActive();

        _burn(msg.sender, id, amount);

        unchecked { 
            voucherConfigs[id].numRedeemed += amount;
        }

        if (id == 0) {
            membersOnly.mint(msg.sender, amount);
        } else {
            for (uint256 i = 0; i < amount;) {
                proofOfWine.mint(msg.sender, config.redeemedStartTokenId + config.numRedeemed + i);
                unchecked { ++i; }
            }
        }
    }

    function setVoucherConfig(
        uint16 maxSupply,
        uint16 maxPerWallet,
        uint72 pricePerBottle,
        uint72 pricePerCase,
        bool immediateMintsAvailable,
        bool immediateRedemptionsAvailable
    ) external onlyOwner {
        if (pricePerBottle == 0 || pricePerCase == 0) revert InvalidConfig();

        uint32 redeemedStartTokenId;

        if (_nextConfigId == 1) {
            redeemedStartTokenId = 1;
        } else {
            VoucherConfig memory lastConfig = voucherConfigs[_nextConfigId - 1];
            redeemedStartTokenId = lastConfig.redeemedStartTokenId + lastConfig.maxSupply;
        }

        voucherConfigs[_nextConfigId] = VoucherConfig({
            totalMinted: 0,
            numRedeemed: 0,
            maxSupply: maxSupply,
            maxPerWallet: maxPerWallet,
            redeemedStartTokenId: redeemedStartTokenId,
            mintIsActive: immediateMintsAvailable,
            redemptionIsActive: immediateRedemptionsAvailable,
            pricePerBottle: pricePerBottle,
            pricePerCase: pricePerCase
        });

        unchecked { ++_nextConfigId; }
    }

    function setBaseUri(string calldata uri) external onlyOwner {
        _uri = uri;
    }

    function setMintIsActive(uint16 id, bool active) external onlyOwner {
        if (_unlaunchedToken(id)) revert UnlaunchedToken();

        voucherConfigs[id].mintIsActive = active;
    }

    function setRedemptionIsActive(uint16 id, bool active) external onlyOwner {
        if (_unlaunchedToken(id)) revert UnlaunchedToken();

        voucherConfigs[id].redemptionIsActive = active;
    }

    function withdraw() external onlyOwner {
        (bool success, ) = payable(msg.sender).call{value: address(this).balance}("");
        if (!success) revert FailedToWithdraw();
    }

    function totalSupply(uint16 tokenId) external view returns (uint256) {
        VoucherConfig memory config = voucherConfigs[tokenId];
        return uint256(config.totalMinted - config.numRedeemed);
    }

    function totalSupply() external view returns (uint256) {
        uint256 _totalSupply;

        uint256 currentTokenIndex;
        while (true) {
            VoucherConfig memory config = voucherConfigs[currentTokenIndex];
            if (config.pricePerBottle == 0) break; // this means it has not been launched yet

            _totalSupply += uint256(config.totalMinted - config.numRedeemed);

            unchecked { ++currentTokenIndex; }
        }

        return _totalSupply;
    }

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

    function _unlaunchedToken(uint16 tokenId) internal view returns (bool) {
        VoucherConfig memory config = voucherConfigs[tokenId];

        return config.pricePerBottle == 0;
    }
}

File 2 of 10 : ERC1155P.sol
// SPDX-License-Identifier: MIT
// ERC1155P Contracts v1.1
// Creator: 0xjustadev/0xth0mas

pragma solidity ^0.8.20;

import "./IERC1155P.sol";

/**
 * @dev Interface of ERC1155 token receiver.
 */
interface ERC1155P__IERC1155Receiver {
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @dev Interface for IERC1155MetadataURI.
 */

interface ERC1155P__IERC1155MetadataURI {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

 /**
 * @title ERC1155P
 *
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155 including the Metadata extension.
 * Optimized for lower gas for users collecting multiple tokens.
 *
 * Assumptions:
 * - An owner cannot have more than 2**16 - 1 of a single token
 * - The maximum token ID cannot exceed 2**100 - 1
 */
abstract contract ERC1155P is IERC1155P, ERC1155P__IERC1155MetadataURI {

    /**
     * @dev MAX_ACCOUNT_TOKEN_BALANCE is 2^16-1 because token balances are
     *      are being packed into 16 bits within each bucket.
     */
    uint256 private constant MAX_ACCOUNT_TOKEN_BALANCE = 0xFFFF;

    uint256 private constant BALANCE_STORAGE_OFFSET =
        0xE000000000000000000000000000000000000000000000000000000000000000;

    uint256 private constant APPROVAL_STORAGE_OFFSET =
        0xD000000000000000000000000000000000000000000000000000000000000000;

    /**
     * @dev MAX_TOKEN_ID is derived from custom storage pointer location for 
     *      account/token balance data. Wallet address is shifted 92 bits left
     *      and leaves 92 bits for bucket #'s. Each bucket holds 8 token balances
     *      2^92*8-1 = MAX_TOKEN_ID
     */
    uint256 private constant MAX_TOKEN_ID = 0x07FFFFFFFFFFFFFFFFFFFFFFF;

    // The `TransferSingle` event signature is given by:
    // `keccak256(bytes("TransferSingle(address,address,address,uint256,uint256)"))`.
    bytes32 private constant _TRANSFER_SINGLE_EVENT_SIGNATURE =
        0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62;
    // The `TransferBatch` event signature is given by:
    // `keccak256(bytes("TransferBatch(address,address,address,uint256[],uint256[])"))`.
    bytes32 private constant _TRANSFER_BATCH_EVENT_SIGNATURE =
        0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;
    // The `ApprovalForAll` event signature is given by:
    // `keccak256(bytes("ApprovalForAll(address,address,bool)"))`.
    bytes32 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =
        0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;

    string public name; //collection name
    string public symbol; //collection symbol

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

    /**
     * @dev constructor initialization of name and symbol parameters
     * @param _name the name to display for the collection
     * @param _symbol the symbol for the token collection
     */
    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
    }

    /**
     * @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 == 0xd9b67a26 || // ERC165 interface ID for ERC1155.
            interfaceId == 0x0e89341c; // ERC165 interface ID for ERC1155MetadataURI.
    }
    
    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function uri(uint256 id) public view virtual override returns (string memory) {
        string memory tokenURI = _tokenURIs[id];
        string memory baseURI = _baseURI();

        return bytes(tokenURI).length > 0 ? 
            tokenURI : 
            bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(id))) : '';
    }

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

    /**
     * @dev Sets `tokenURI` as the tokenURI of `tokenId`.
     */
    function _setURI(uint256 tokenId, string calldata tokenURI) internal virtual {
        _tokenURIs[tokenId] = tokenURI;
        emit URI(uri(tokenId), tokenId);
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        if(account == address(0)) { _revert(BalanceQueryForZeroAddress.selector); }
        return getBalance(account, id);
    }

    /**
     * @dev Gets the amount of tokens minted by an account for a given token id
     */
    function _numberMinted(address account, uint256 id) internal view returns (uint256) {
        if(account == address(0)) { _revert(BalanceQueryForZeroAddress.selector); }
        return getMinted(account, id);
    }

    /**
     * @dev Gets the balance of an account's token id from packed token data
     *
     */
    function getBalance(address account, uint256 id) private view returns (uint256 _balance) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, or(BALANCE_STORAGE_OFFSET, or(shr(4, shl(96, account)), shr(3, id))))
            _balance := shr(shl(5, and(id, 0x07)), and(sload(keccak256(0x00, 0x20)), shl(shl(5, and(id, 0x07)), 0x0000FFFF)))
        }
    }

    /**
     * @dev Sets the balance of an account's token id in packed token data
     *
     */
    function setBalance(address account, uint256 id, uint256 amount) private {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, or(BALANCE_STORAGE_OFFSET, or(shr(4, shl(96, account)), shr(3, id))))
            mstore(0x00, keccak256(0x00, 0x20))
            sstore(mload(0x00), or(and(not(shl(shl(5, and(id, 0x07)), 0x0000FFFF)), sload(mload(0x00))), shl(shl(5, and(id, 0x07)), amount)))
        }
    }

    /**
     * @dev Gets the number minted of an account's token id from packed token data
     *
     */
    function getMinted(address account, uint256 id) private view returns (uint256 _minted) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, or(BALANCE_STORAGE_OFFSET, or(shr(4, shl(96, account)), shr(3, id))))
            _minted := shr(16, shr(shl(5, and(id, 0x07)), and(sload(keccak256(0x00, 0x20)), shl(shl(5, and(id, 0x07)), 0xFFFF0000))))
        }
    }

    /**
     * @dev Sets the number minted of an account's token id in packed token data
     *
     */
    function setMinted(address account, uint256 id, uint256 amount) private {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, or(BALANCE_STORAGE_OFFSET, or(shr(4, shl(96, account)), shr(3, id))))
            mstore(0x00, keccak256(0x00, 0x20))
            sstore(mload(0x00), or(and(not(shl(shl(5, and(id, 0x07)), 0xFFFF0000)), sload(mload(0x00))), shl(shl(5, and(id, 0x07)), shl(16, amount))))
        }
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) public view virtual override returns (uint256[] memory) {
        if(accounts.length != ids.length) { _revert(ArrayLengthMismatch.selector); }

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for(uint256 i = 0; i < accounts.length;) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
            unchecked {
                ++i;
            }
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view virtual override returns (bool _approved) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, shr(96, shl(96, account)))
            mstore(0x20, or(APPROVAL_STORAGE_OFFSET, shr(96, shl(96, operator))))
            mstore(0x00, keccak256(0x00, 0x40))
            _approved := sload(mload(0x00))
        }
        return _approved; 
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes memory data
    ) public virtual override {
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); }
        if(to == address(0)) { _revert(TransferToZeroAddress.selector); }
        
        if(from != _msgSenderERC1155P())
            if (!isApprovedForAll(from, _msgSenderERC1155P())) _revert(TransferCallerNotOwnerNorApproved.selector);

        address operator = _msgSenderERC1155P();

        _beforeTokenTransfer(operator, from, to, id, amount, data);

        uint256 fromBalance = getBalance(from, id);
        if(amount > fromBalance) { _revert(TransferExceedsBalance.selector); }

        if(from != to) {
            uint256 toBalance = getBalance(to, id);
            unchecked {
                fromBalance -= amount;
                toBalance += amount;
            }
            if(toBalance > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); }
            setBalance(from, id, fromBalance);
            setBalance(to, id, toBalance);   
        }

        /// @solidity memory-safe-assembly
        assembly {
            // Emit the `TransferSingle` event.
            let memOffset := mload(0x40)
            mstore(memOffset, id)
            mstore(add(memOffset, 0x20), amount)
            log4(
                memOffset, // Start of data .
                0x40, // Length of data.
                _TRANSFER_SINGLE_EVENT_SIGNATURE, // Signature.
                operator, // `operator`.
                from, // `from`.
                to // `to`.
            )
        }

        _afterTokenTransfer(operator, from, to, id, amount, data);

        if(to.code.length != 0)
            if(!_checkContractOnERC1155Received(from, to, id, amount, data))  {
                _revert(TransferToNonERC1155ReceiverImplementer.selector);
            }
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes memory data
    ) internal virtual {
        if(to == address(0)) { _revert(TransferToZeroAddress.selector); }
        if(ids.length != amounts.length) { _revert(ArrayLengthMismatch.selector); }

        if(from != _msgSenderERC1155P())
            if (!isApprovedForAll(from, _msgSenderERC1155P())) _revert(TransferCallerNotOwnerNorApproved.selector);

        address operator = _msgSenderERC1155P();

        _beforeBatchTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length;) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];
            if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); }

            uint256 fromBalance = getBalance(from, id);
            if(amount > fromBalance) { _revert(TransferExceedsBalance.selector); }

            if(from != to) {
                uint256 toBalance = getBalance(to, id);
                unchecked {
                    fromBalance -= amount;
                    toBalance += amount;
                }
                if(toBalance > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); }
                setBalance(from, id, fromBalance);
                setBalance(to, id, toBalance);
            }

            unchecked {
                ++i;
            }
        }

        /// @solidity memory-safe-assembly
        assembly {
            let memOffset := mload(0x40)
            mstore(memOffset, 0x40)
            mstore(add(memOffset,0x20), add(0x60, mul(0x20,ids.length)))
            mstore(add(memOffset,0x40), ids.length)
            calldatacopy(add(memOffset,0x60), ids.offset, mul(0x20,ids.length))
            mstore(add(add(memOffset,0x60),mul(0x20,ids.length)), amounts.length)
            calldatacopy(add(add(memOffset,0x80),mul(0x20,ids.length)), amounts.offset, mul(0x20,amounts.length))
            log4(
                memOffset, 
                add(0x80,mul(0x40,amounts.length)),
                _TRANSFER_BATCH_EVENT_SIGNATURE, // Signature.
                operator, // `operator`.
                from, // `from`.
                to // `to`.
            )
        }

        _afterBatchTokenTransfer(operator, from, to, ids, amounts, data);


        if(to.code.length != 0)
            if(!_checkContractOnERC1155BatchReceived(from, to, ids, amounts, data))  {
                _revert(TransferToNonERC1155ReceiverImplementer.selector);
            }
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {
        if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); }
        if(to == address(0)) { _revert(MintToZeroAddress.selector); }
        if(amount == 0) { _revert(MintZeroQuantity.selector); }

        address operator = _msgSenderERC1155P();

        _beforeTokenTransfer(operator, address(0), to, id, amount, data);

        uint256 toBalanceBefore = getBalance(to, id);
        uint256 toBalanceAfter;
        unchecked {
            toBalanceAfter = toBalanceBefore + amount;
        }
        if(toBalanceAfter > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); }
        if(toBalanceAfter < toBalanceBefore) { _revert(ExceedsMaximumBalance.selector); } // catches overflow
        setBalance(to, id, toBalanceAfter);

        uint256 toMintedBefore = getMinted(to, id);
        uint256 toMintedAfter;
        unchecked {
            toMintedAfter = toMintedBefore + amount;
        }
        if(toMintedAfter > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); }
        if(toMintedAfter < toMintedBefore) { _revert(ExceedsMaximumBalance.selector); } // catches overflow
        setMinted(to, id, toMintedAfter);

        /// @solidity memory-safe-assembly
        assembly {
            // Emit the `TransferSingle` event.
            let memOffset := mload(0x40)
            mstore(memOffset, id)
            mstore(add(memOffset, 0x20), amount)
            log4(
                memOffset, // Start of data .
                0x40, // Length of data.
                _TRANSFER_SINGLE_EVENT_SIGNATURE, // Signature.
                operator, // `operator`.
                0, // `from`.
                to // `to`.
            )
        }

        _afterTokenTransfer(operator, address(0), to, id, amount, data);

        if(to.code.length != 0)
            if(!_checkContractOnERC1155Received(address(0), to, id, amount, data))  {
                _revert(TransferToNonERC1155ReceiverImplementer.selector);
            }
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes memory data
    ) internal virtual {
        if(to == address(0)) { _revert(MintToZeroAddress.selector); }
        if(ids.length != amounts.length) { _revert(ArrayLengthMismatch.selector); }

        address operator = _msgSenderERC1155P();

        _beforeBatchTokenTransfer(operator, address(0), to, ids, amounts, data);

        uint256 id;
        uint256 amount;
        for (uint256 i = 0; i < ids.length;) {
            id = ids[i];
            amount = amounts[i];
            if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); }
            if(amount == 0) { _revert(MintZeroQuantity.selector); }

            uint256 toBalanceBefore = getBalance(to, id);
            uint256 toBalanceAfter;
            unchecked {
                toBalanceAfter = toBalanceBefore + amount;
            }
            if(toBalanceAfter > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); }
            if(toBalanceAfter < toBalanceBefore) { _revert(ExceedsMaximumBalance.selector); } // catches overflow
            setBalance(to, id, toBalanceAfter);

            uint256 toMintedBefore = getMinted(to, id);
            uint256 toMintedAfter;
            unchecked {
                toMintedAfter = toMintedBefore + amount;
            }
            if(toMintedAfter > MAX_ACCOUNT_TOKEN_BALANCE) { _revert(ExceedsMaximumBalance.selector); }
            if(toMintedAfter < toMintedBefore) { _revert(ExceedsMaximumBalance.selector); } // catches overflow
            setMinted(to, id, toMintedAfter);

            unchecked {
                ++i;
            }
        }

        /// @solidity memory-safe-assembly
        assembly {
            let memOffset := mload(0x40)
            mstore(memOffset, 0x40)
            mstore(add(memOffset,0x20), add(0x60, mul(0x20,ids.length)))
            mstore(add(memOffset,0x40), ids.length)
            calldatacopy(add(memOffset,0x60), ids.offset, mul(0x20,ids.length))
            mstore(add(add(memOffset,0x60),mul(0x20,ids.length)), amounts.length)
            calldatacopy(add(add(memOffset,0x80),mul(0x20,ids.length)), amounts.offset, mul(0x20,amounts.length))
            log4(
                memOffset, 
                add(0x80,mul(0x40,amounts.length)),
                _TRANSFER_BATCH_EVENT_SIGNATURE, // Signature.
                operator, // `operator`.
                0, // `from`.
                to // `to`.
            )
        }

        _afterBatchTokenTransfer(operator, address(0), to, ids, amounts, data);

        if(to.code.length != 0)
            if(!_checkContractOnERC1155BatchReceived(address(0), to, ids, amounts, data))  {
                _revert(TransferToNonERC1155ReceiverImplementer.selector);
            }
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(address from, uint256 id, uint256 amount) internal virtual {
        if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); }
        if(from == address(0)) { _revert(BurnFromZeroAddress.selector); }

        address operator = _msgSenderERC1155P();

        _beforeTokenTransfer(operator, from, address(0), id, amount, "");

        uint256 fromBalance = getBalance(from, id);
        if(amount > fromBalance) { _revert(BurnExceedsBalance.selector); }
        unchecked {
            fromBalance -= amount;
        }
        setBalance(from, id, fromBalance);

        /// @solidity memory-safe-assembly
        assembly {
            // Emit the `TransferSingle` event.
            let memOffset := mload(0x40)
            mstore(memOffset, id)
            mstore(add(memOffset, 0x20), amount)
            log4(
                memOffset, // Start of data.
                0x40, // Length of data.
                _TRANSFER_SINGLE_EVENT_SIGNATURE, // Signature.
                operator, // `operator`.
                from, // `from`.
                0 // `to`.
            )
        }

        _afterTokenTransfer(operator, from, address(0), id, amount, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(address from, uint256[] calldata ids, uint256[] calldata amounts) internal virtual {
        if(from == address(0)) { _revert(BurnFromZeroAddress.selector); }
        if(ids.length != amounts.length) { _revert(ArrayLengthMismatch.selector); }

        address operator = _msgSenderERC1155P();

        _beforeBatchTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length;) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];
            if(id > MAX_TOKEN_ID) { _revert(ExceedsMaximumTokenId.selector); }

            uint256 fromBalance = getBalance(from, id);
            if(amount > fromBalance) { _revert(BurnExceedsBalance.selector); }
            unchecked {
                fromBalance -= amount;
            }
            setBalance(from, id, fromBalance);
            unchecked {
                ++i;
            }
        }

        /// @solidity memory-safe-assembly
        assembly {
            let memOffset := mload(0x40)
            mstore(memOffset, 0x40)
            mstore(add(memOffset,0x20), add(0x60, mul(0x20,ids.length)))
            mstore(add(memOffset,0x40), ids.length)
            calldatacopy(add(memOffset,0x60), ids.offset, mul(0x20,ids.length))
            mstore(add(add(memOffset,0x60),mul(0x20,ids.length)), amounts.length)
            calldatacopy(add(add(memOffset,0x80),mul(0x20,ids.length)), amounts.offset, mul(0x20,amounts.length))
            log4(
                memOffset, 
                add(0x80,mul(0x40,amounts.length)),
                _TRANSFER_BATCH_EVENT_SIGNATURE, // Signature.
                operator, // `operator`.
                from, // `from`.
                0 // `to`.
            )
        }

        _afterBatchTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom}
     * for any token owned by the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, caller())
            mstore(0x20, or(APPROVAL_STORAGE_OFFSET, shr(96, shl(96, operator))))
            mstore(0x00, keccak256(0x00, 0x40))
            mstore(0x20, approved)
            sstore(mload(0x00), mload(0x20))
            log3(
                0x20,
                0x20,
                _APPROVAL_FOR_ALL_EVENT_SIGNATURE,
                caller(),
                shr(96, shl(96, operator))
            )
        }
    }

    /**
     * @dev Hook that is called before any single token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * 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 operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {}

    

    /**
     * @dev Hook that is called before any batch token transfer. This includes minting
     * and burning.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    
    function _beforeBatchTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any single token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * 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 _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any batch token transfer. This includes minting
     * and burning.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    
    function _afterBatchTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Private function to invoke {IERC1155Receiver-onERC155Received} on a target contract.
     *
     * `from` - Previous owner of the given token ID.
     * `to` - Target address that will receive the token.
     * `id` - Token ID to be transferred.
     * `amount` - Balance of token to be transferred
     * `_data` - Optional data to send along with the call.
     *
     * Returns whether the call correctly returned the expected magic value.
     */
    function _checkContractOnERC1155Received(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory _data
    ) private returns (bool) {
        try ERC1155P__IERC1155Receiver(to).onERC1155Received(_msgSenderERC1155P(), from, id, amount, _data) returns (
            bytes4 retval
        ) {
            return retval == ERC1155P__IERC1155Receiver(to).onERC1155Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                _revert(TransferToNonERC1155ReceiverImplementer.selector);
            }
            /// @solidity memory-safe-assembly
            assembly {
                revert(add(32, reason), mload(reason))
            }
        }
    }

    /**
     * @dev Private function to invoke {IERC1155Receiver-onERC155Received} on a target contract.
     *
     * `from` - Previous owner of the given token ID.
     * `to` - Target address that will receive the token.
     * `id` - Token ID to be transferred.
     * `amount` - Balance of token to be transferred
     * `_data` - Optional data to send along with the call.
     *
     * Returns whether the call correctly returned the expected magic value.
     */
    function _checkContractOnERC1155BatchReceived(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes memory _data
    ) private returns (bool) {
        try ERC1155P__IERC1155Receiver(to).onERC1155BatchReceived(_msgSenderERC1155P(), from, ids, amounts, _data) returns (
            bytes4 retval
        ) {
            return retval == ERC1155P__IERC1155Receiver(to).onERC1155BatchReceived.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                _revert(TransferToNonERC1155ReceiverImplementer.selector);
            }
            /// @solidity memory-safe-assembly
            assembly {
                revert(add(32, reason), mload(reason))
            }
        }
    }
    
    /**
     * @dev Returns the message sender (defaults to `msg.sender`).
     *
     * If you are writing GSN compatible contracts, you need to override this function.
     */
    function _msgSenderERC1155P() 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) {
        /// @solidity memory-safe-assembly
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
            let m := add(mload(0x40), 0xa0)
            // Update the free memory pointer to allocate.
            mstore(0x40, m)
            // Assign the `str` to the end.
            str := sub(m, 0x20)
            // Zeroize the slot after the string.
            mstore(str, 0)

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

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

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

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

File 3 of 10 : Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Simple single owner authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
///
/// @dev Note:
/// This implementation does NOT auto-initialize the owner to `msg.sender`.
/// You MUST call the `_initializeOwner` in the constructor / initializer.
///
/// While the ownable portion follows
/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
/// the nomenclature for the 2-step ownership handover may be unique to this codebase.
abstract contract Ownable {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The caller is not authorized to call the function.
    error Unauthorized();

    /// @dev The `newOwner` cannot be the zero address.
    error NewOwnerIsZeroAddress();

    /// @dev The `pendingOwner` does not have a valid handover request.
    error NoHandoverRequest();

    /// @dev Cannot double-initialize.
    error AlreadyInitialized();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           EVENTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ownership is transferred from `oldOwner` to `newOwner`.
    /// This event is intentionally kept the same as OpenZeppelin's Ownable to be
    /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
    /// despite it not being as lightweight as a single argument event.
    event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);

    /// @dev An ownership handover to `pendingOwner` has been requested.
    event OwnershipHandoverRequested(address indexed pendingOwner);

    /// @dev The ownership handover to `pendingOwner` has been canceled.
    event OwnershipHandoverCanceled(address indexed pendingOwner);

    /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
    uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
        0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;

    /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
    uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
        0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;

    /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
    uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
        0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                          STORAGE                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The owner slot is given by:
    /// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
    /// It is intentionally chosen to be a high value
    /// to avoid collision with lower slots.
    /// The choice of manual storage layout is to enable compatibility
    /// with both regular and upgradeable contracts.
    bytes32 internal constant _OWNER_SLOT =
        0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;

    /// The ownership handover slot of `newOwner` is given by:
    /// ```
    ///     mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
    ///     let handoverSlot := keccak256(0x00, 0x20)
    /// ```
    /// It stores the expiry timestamp of the two-step ownership handover.
    uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     INTERNAL FUNCTIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
    function _guardInitializeOwner() internal pure virtual returns (bool guard) {}

    /// @dev Initializes the owner directly without authorization guard.
    /// This function must be called upon initialization,
    /// regardless of whether the contract is upgradeable or not.
    /// This is to enable generalization to both regular and upgradeable contracts,
    /// and to save gas in case the initial owner is not the caller.
    /// For performance reasons, this function will not check if there
    /// is an existing owner.
    function _initializeOwner(address newOwner) internal virtual {
        if (_guardInitializeOwner()) {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                if sload(ownerSlot) {
                    mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
                    revert(0x1c, 0x04)
                }
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Store the new value.
                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
            }
        } else {
            /// @solidity memory-safe-assembly
            assembly {
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Store the new value.
                sstore(_OWNER_SLOT, newOwner)
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
            }
        }
    }

    /// @dev Sets the owner directly without authorization guard.
    function _setOwner(address newOwner) internal virtual {
        if (_guardInitializeOwner()) {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                // Store the new value.
                sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
            }
        } else {
            /// @solidity memory-safe-assembly
            assembly {
                let ownerSlot := _OWNER_SLOT
                // Clean the upper 96 bits.
                newOwner := shr(96, shl(96, newOwner))
                // Emit the {OwnershipTransferred} event.
                log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
                // Store the new value.
                sstore(ownerSlot, newOwner)
            }
        }
    }

    /// @dev Throws if the sender is not the owner.
    function _checkOwner() internal view virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // If the caller is not the stored owner, revert.
            if iszero(eq(caller(), sload(_OWNER_SLOT))) {
                mstore(0x00, 0x82b42900) // `Unauthorized()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Returns how long a two-step ownership handover is valid for in seconds.
    /// Override to return a different value if needed.
    /// Made internal to conserve bytecode. Wrap it in a public function if needed.
    function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
        return 48 * 3600;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  PUBLIC UPDATE FUNCTIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Allows the owner to transfer the ownership to `newOwner`.
    function transferOwnership(address newOwner) public payable virtual onlyOwner {
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(shl(96, newOwner)) {
                mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
                revert(0x1c, 0x04)
            }
        }
        _setOwner(newOwner);
    }

    /// @dev Allows the owner to renounce their ownership.
    function renounceOwnership() public payable virtual onlyOwner {
        _setOwner(address(0));
    }

    /// @dev Request a two-step ownership handover to the caller.
    /// The request will automatically expire in 48 hours (172800 seconds) by default.
    function requestOwnershipHandover() public payable virtual {
        unchecked {
            uint256 expires = block.timestamp + _ownershipHandoverValidFor();
            /// @solidity memory-safe-assembly
            assembly {
                // Compute and set the handover slot to `expires`.
                mstore(0x0c, _HANDOVER_SLOT_SEED)
                mstore(0x00, caller())
                sstore(keccak256(0x0c, 0x20), expires)
                // Emit the {OwnershipHandoverRequested} event.
                log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
            }
        }
    }

    /// @dev Cancels the two-step ownership handover to the caller, if any.
    function cancelOwnershipHandover() public payable virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute and set the handover slot to 0.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, caller())
            sstore(keccak256(0x0c, 0x20), 0)
            // Emit the {OwnershipHandoverCanceled} event.
            log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
        }
    }

    /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
    /// Reverts if there is no existing ownership handover requested by `pendingOwner`.
    function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute and set the handover slot to 0.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, pendingOwner)
            let handoverSlot := keccak256(0x0c, 0x20)
            // If the handover does not exist, or has expired.
            if gt(timestamp(), sload(handoverSlot)) {
                mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
                revert(0x1c, 0x04)
            }
            // Set the handover slot to 0.
            sstore(handoverSlot, 0)
        }
        _setOwner(pendingOwner);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   PUBLIC READ FUNCTIONS                    */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the owner of the contract.
    function owner() public view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := sload(_OWNER_SLOT)
        }
    }

    /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
    function ownershipHandoverExpiresAt(address pendingOwner)
        public
        view
        virtual
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Compute the handover slot.
            mstore(0x0c, _HANDOVER_SLOT_SEED)
            mstore(0x00, pendingOwner)
            // Load the handover slot.
            result := sload(keccak256(0x0c, 0x20))
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         MODIFIERS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Marks a function as only callable by the owner.
    modifier onlyOwner() virtual {
        _checkOwner();
        _;
    }
}

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

import {ERC721} from "solady/tokens/ERC721.sol";
import {Ownable} from "solady/auth/Ownable.sol";
import {LibString} from "solady/utils/LibString.sol";

contract ProofOfWine is ERC721, Ownable {
    error ApprovalsNotAllowed();

    address private immutable _apeVineVouchers;
    string private _baseURI;
    bool private approvalsAllowed;

    uint256 public totalSupply;

    constructor(string memory uri) {
        _initializeOwner(tx.origin);
        _apeVineVouchers = msg.sender;
        _baseURI = uri;
    }

    function setApprovalForAll(address operator, bool isApproved) public override {
        if (!approvalsAllowed) revert ApprovalsNotAllowed();

        super.setApprovalForAll(operator, isApproved);
    }

    function approve(address account, uint256 id) public payable override {
        if (!approvalsAllowed) revert ApprovalsNotAllowed();

        super.approve(account, id);
    }

    function mint(address to, uint256 tokenId) external {
        if (msg.sender != _apeVineVouchers) revert Unauthorized();

        unchecked { ++totalSupply; }
        _mint(to, tokenId);
    }

    function setTokenURI(string calldata uri) external onlyOwner {
        _baseURI = uri;
    }

    /**
        @dev toggling approvals off after having previously been enabled will NOT clear existing approvals.
     */
    function setApprovalsAllowed(bool isAllowed) external onlyOwner {
        approvalsAllowed = isAllowed;
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        if (!_exists(tokenId)) revert TokenDoesNotExist();

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

    function name() public view override returns (string memory) {
        return "ApeVine: Proof Of Wine";
    }

    function symbol() public view override returns (string memory) {
        return "POW";
    }
}

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

import {ERC721A} from "ERC721A/ERC721A.sol";
import {Ownable} from "solady/auth/Ownable.sol";

contract MembersOnly is ERC721A, Ownable {
    address private immutable _apeVineVouchers;
    string private _uri;

    constructor(string memory uri) ERC721A("Apevine: Members Only", "AVMO") {
        _initializeOwner(tx.origin);
        _apeVineVouchers = msg.sender;
        _uri = uri;
    }

    function mint(address to, uint256 amount) external {
        if (msg.sender != _apeVineVouchers) revert Unauthorized();

        _mint(to, amount);
    }

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

    function setBaseUri(string calldata uri) external onlyOwner {
        _uri = uri;
    }

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

File 6 of 10 : IERC1155P.sol
// SPDX-License-Identifier: MIT
// ERC721P Contracts v1.1

pragma solidity ^0.8.20;

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155P {

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

    /**
     * Arrays cannot be different lengths.
     */
    error ArrayLengthMismatch();

    /**
     * Cannot burn from the zero address.
     */
    error BurnFromZeroAddress();

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

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

    /**
     * The quantity of tokens being burned is greater than account balance.
     */
    error BurnExceedsBalance();

    /**
     * The quantity of tokens being transferred is greater than account balance.
     */
    error TransferExceedsBalance();

    /**
     * The resulting token balance exceeds the maximum storable by ERC1155P
     */
    error ExceedsMaximumBalance();

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

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

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

    /**
     * Exceeds max token ID
     */
    error ExceedsMaximumTokenId();
    
    // =============================================================
    //                            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);

    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 7 of 10 : ERC721.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Simple ERC721 implementation with storage hitchhiking.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC721.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC721/ERC721.sol)
///
/// @dev Note:
/// - The ERC721 standard allows for self-approvals.
///   For performance, this implementation WILL NOT revert for such actions.
///   Please add any checks with overrides if desired.
/// - For performance, methods are made payable where permitted by the ERC721 standard.
/// - The `safeTransfer` functions use the identity precompile (0x4)
///   to copy memory internally.
///
/// If you are overriding:
/// - NEVER violate the ERC721 invariant:
///   the balance of an owner MUST always be equal to their number of ownership slots.
///   The transfer functions do not have an underflow guard for user token balances.
/// - Make sure all variables written to storage are properly cleaned
//    (e.g. the bool value for `isApprovedForAll` MUST be either 1 or 0 under the hood).
/// - Check that the overridden function is actually used in the function you want to
///   change the behavior of. Much of the code has been manually inlined for performance.
abstract contract ERC721 {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         CONSTANTS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev An account can hold up to 4294967295 tokens.
    uint256 internal constant _MAX_ACCOUNT_BALANCE = 0xffffffff;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Only the token owner or an approved account can manage the token.
    error NotOwnerNorApproved();

    /// @dev The token does not exist.
    error TokenDoesNotExist();

    /// @dev The token already exists.
    error TokenAlreadyExists();

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

    /// @dev Cannot mint or transfer to the zero address.
    error TransferToZeroAddress();

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

    /// @dev The recipient's balance has overflowed.
    error AccountBalanceOverflow();

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

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           EVENTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Emitted when token `id` is transferred from `from` to `to`.
    event Transfer(address indexed from, address indexed to, uint256 indexed id);

    /// @dev Emitted when `owner` enables `account` to manage the `id` token.
    event Approval(address indexed owner, address indexed account, uint256 indexed id);

    /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens.
    event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved);

    /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`.
    uint256 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`.
    uint256 private constant _APPROVAL_EVENT_SIGNATURE =
        0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925;

    /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`.
    uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE =
        0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                          STORAGE                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ownership data slot of `id` is given by:
    /// ```
    ///     mstore(0x00, id)
    ///     mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
    ///     let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
    /// ```
    /// Bits Layout:
    /// - [0..159]   `addr`
    /// - [160..255] `extraData`
    ///
    /// The approved address slot is given by: `add(1, ownershipSlot)`.
    ///
    /// See: https://notes.ethereum.org/%40vbuterin/verkle_tree_eip
    ///
    /// The balance slot of `owner` is given by:
    /// ```
    ///     mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
    ///     mstore(0x00, owner)
    ///     let balanceSlot := keccak256(0x0c, 0x1c)
    /// ```
    /// Bits Layout:
    /// - [0..31]   `balance`
    /// - [32..255] `aux`
    ///
    /// The `operator` approval slot of `owner` is given by:
    /// ```
    ///     mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator))
    ///     mstore(0x00, owner)
    ///     let operatorApprovalSlot := keccak256(0x0c, 0x30)
    /// ```
    uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192;

    /// @dev Pre-shifted and pre-masked constant.
    uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      ERC721 METADATA                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the token collection name.
    function name() public view virtual returns (string memory);

    /// @dev Returns the token collection symbol.
    function symbol() public view virtual returns (string memory);

    /// @dev Returns the Uniform Resource Identifier (URI) for token `id`.
    function tokenURI(uint256 id) public view virtual returns (string memory);

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           ERC721                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the owner of token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function ownerOf(uint256 id) public view virtual returns (address result) {
        result = _ownerOf(id);
        /// @solidity memory-safe-assembly
        assembly {
            if iszero(result) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Returns the number of tokens owned by `owner`.
    ///
    /// Requirements:
    /// - `owner` must not be the zero address.
    function balanceOf(address owner) public view virtual returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            // Revert if the `owner` is the zero address.
            if iszero(owner) {
                mstore(0x00, 0x8f4eb604) // `BalanceQueryForZeroAddress()`.
                revert(0x1c, 0x04)
            }
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            mstore(0x00, owner)
            result := and(sload(keccak256(0x0c, 0x1c)), _MAX_ACCOUNT_BALANCE)
        }
    }

    /// @dev Returns the account approved to manage token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function getApproved(uint256 id) public view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            if iszero(shl(96, sload(ownershipSlot))) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
            result := sload(add(1, ownershipSlot))
        }
    }

    /// @dev Sets `account` as the approved account to manage token `id`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    /// - The caller must be the owner of the token,
    ///   or an approved operator for the token owner.
    ///
    /// Emits an {Approval} event.
    function approve(address account, uint256 id) public payable virtual {
        _approve(msg.sender, account, id);
    }

    /// @dev Returns whether `operator` is approved to manage the tokens of `owner`.
    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x1c, operator)
            mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED)
            mstore(0x00, owner)
            result := sload(keccak256(0x0c, 0x30))
        }
    }

    /// @dev Sets whether `operator` is approved to manage the tokens of the caller.
    ///
    /// Emits an {ApprovalForAll} event.
    function setApprovalForAll(address operator, bool isApproved) public virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Convert to 0 or 1.
            isApproved := iszero(iszero(isApproved))
            // Update the `isApproved` for (`msg.sender`, `operator`).
            mstore(0x1c, operator)
            mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED)
            mstore(0x00, caller())
            sstore(keccak256(0x0c, 0x30), isApproved)
            // Emit the {ApprovalForAll} event.
            mstore(0x00, isApproved)
            // forgefmt: disable-next-item
            log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)))
        }
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function transferFrom(address from, address to, uint256 id) public payable virtual {
        _beforeTokenTransfer(from, to, id);
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            let bitmaskAddress := shr(96, not(0))
            from := and(bitmaskAddress, from)
            to := and(bitmaskAddress, to)
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, caller()))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let ownershipPacked := sload(ownershipSlot)
            let owner := and(bitmaskAddress, ownershipPacked)
            // Revert if `from` is not the owner, or does not exist.
            if iszero(mul(owner, eq(owner, from))) {
                if iszero(owner) {
                    mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                    revert(0x1c, 0x04)
                }
                mstore(0x00, 0xa1148100) // `TransferFromIncorrectOwner()`.
                revert(0x1c, 0x04)
            }
            // Revert if `to` is the zero address.
            if iszero(to) {
                mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.
                revert(0x1c, 0x04)
            }
            // Load, check, and update the token approval.
            {
                mstore(0x00, from)
                let approvedAddress := sload(add(1, ownershipSlot))
                // Revert if the caller is not the owner, nor approved.
                if iszero(or(eq(caller(), from), eq(caller(), approvedAddress))) {
                    if iszero(sload(keccak256(0x0c, 0x30))) {
                        mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
                        revert(0x1c, 0x04)
                    }
                }
                // Delete the approved address if any.
                if approvedAddress { sstore(add(1, ownershipSlot), 0) }
            }
            // Update with the new owner.
            sstore(ownershipSlot, xor(ownershipPacked, xor(from, to)))
            // Decrement the balance of `from`.
            {
                let fromBalanceSlot := keccak256(0x0c, 0x1c)
                sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1))
            }
            // Increment the balance of `to`.
            {
                mstore(0x00, to)
                let toBalanceSlot := keccak256(0x0c, 0x1c)
                let toBalanceSlotPacked := add(sload(toBalanceSlot), 1)
                if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) {
                    mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
                    revert(0x1c, 0x04)
                }
                sstore(toBalanceSlot, toBalanceSlotPacked)
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id)
        }
        _afterTokenTransfer(from, to, id);
    }

    /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`.
    function safeTransferFrom(address from, address to, uint256 id) public payable virtual {
        transferFrom(from, to, id);
        if (_hasCode(to)) _checkOnERC721Received(from, to, id, "");
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    /// - 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 id, bytes calldata data)
        public
        payable
        virtual
    {
        transferFrom(from, to, id);
        if (_hasCode(to)) _checkOnERC721Received(from, to, id, data);
    }

    /// @dev Returns true if this contract implements the interface defined by `interfaceId`.
    /// See: https://eips.ethereum.org/EIPS/eip-165
    /// This function call must use less than 30000 gas.
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            let s := shr(224, interfaceId)
            // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f.
            result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f))
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  INTERNAL QUERY FUNCTIONS                  */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns if token `id` exists.
    function _exists(uint256 id) internal view virtual returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            result := iszero(iszero(shl(96, sload(add(id, add(id, keccak256(0x00, 0x20)))))))
        }
    }

    /// @dev Returns the owner of token `id`.
    /// Returns the zero address instead of reverting if the token does not exist.
    function _ownerOf(uint256 id) internal view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            result := shr(96, shl(96, sload(add(id, add(id, keccak256(0x00, 0x20))))))
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*            INTERNAL DATA HITCHHIKING FUNCTIONS             */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // For performance, no events are emitted for the hitchhiking setters.
    // Please emit your own events if required.

    /// @dev Returns the auxiliary data for `owner`.
    /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data.
    /// Auxiliary data can be set for any address, even if it does not have any tokens.
    function _getAux(address owner) internal view virtual returns (uint224 result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            mstore(0x00, owner)
            result := shr(32, sload(keccak256(0x0c, 0x1c)))
        }
    }

    /// @dev Set the auxiliary data for `owner` to `value`.
    /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data.
    /// Auxiliary data can be set for any address, even if it does not have any tokens.
    function _setAux(address owner, uint224 value) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            mstore(0x00, owner)
            let balanceSlot := keccak256(0x0c, 0x1c)
            let packed := sload(balanceSlot)
            sstore(balanceSlot, xor(packed, shl(32, xor(value, shr(32, packed)))))
        }
    }

    /// @dev Returns the extra data for token `id`.
    /// Minting, transferring, burning a token will not change the extra data.
    /// The extra data can be set on a non-existent token.
    function _getExtraData(uint256 id) internal view virtual returns (uint96 result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            result := shr(160, sload(add(id, add(id, keccak256(0x00, 0x20)))))
        }
    }

    /// @dev Sets the extra data for token `id` to `value`.
    /// Minting, transferring, burning a token will not change the extra data.
    /// The extra data can be set on a non-existent token.
    function _setExtraData(uint256 id, uint96 value) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let packed := sload(ownershipSlot)
            sstore(ownershipSlot, xor(packed, shl(160, xor(value, shr(160, packed)))))
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  INTERNAL MINT FUNCTIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Mints token `id` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must not exist.
    /// - `to` cannot be the zero address.
    ///
    /// Emits a {Transfer} event.
    function _mint(address to, uint256 id) internal virtual {
        _beforeTokenTransfer(address(0), to, id);
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            to := shr(96, shl(96, to))
            // Revert if `to` is the zero address.
            if iszero(to) {
                mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.
                revert(0x1c, 0x04)
            }
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let ownershipPacked := sload(ownershipSlot)
            // Revert if the token already exists.
            if shl(96, ownershipPacked) {
                mstore(0x00, 0xc991cbb1) // `TokenAlreadyExists()`.
                revert(0x1c, 0x04)
            }
            // Update with the owner.
            sstore(ownershipSlot, or(ownershipPacked, to))
            // Increment the balance of the owner.
            {
                mstore(0x00, to)
                let balanceSlot := keccak256(0x0c, 0x1c)
                let balanceSlotPacked := add(sload(balanceSlot), 1)
                if iszero(and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE)) {
                    mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
                    revert(0x1c, 0x04)
                }
                sstore(balanceSlot, balanceSlotPacked)
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id)
        }
        _afterTokenTransfer(address(0), to, id);
    }

    /// @dev Equivalent to `_safeMint(to, id, "")`.
    function _safeMint(address to, uint256 id) internal virtual {
        _safeMint(to, id, "");
    }

    /// @dev Mints token `id` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must not exist.
    /// - `to` cannot be the zero address.
    /// - 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 id, bytes memory data) internal virtual {
        _mint(to, id);
        if (_hasCode(to)) _checkOnERC721Received(address(0), to, id, data);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                  INTERNAL BURN FUNCTIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Equivalent to `_burn(address(0), id)`.
    function _burn(uint256 id) internal virtual {
        _burn(address(0), id);
    }

    /// @dev Destroys token `id`, using `by`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - If `by` is not the zero address,
    ///   it must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function _burn(address by, uint256 id) internal virtual {
        address owner = ownerOf(id);
        _beforeTokenTransfer(owner, address(0), id);
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            by := shr(96, shl(96, by))
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let ownershipPacked := sload(ownershipSlot)
            // Reload the owner in case it is changed in `_beforeTokenTransfer`.
            owner := shr(96, shl(96, ownershipPacked))
            // Revert if the token does not exist.
            if iszero(owner) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
            // Load and check the token approval.
            {
                mstore(0x00, owner)
                let approvedAddress := sload(add(1, ownershipSlot))
                // If `by` is not the zero address, do the authorization check.
                // Revert if the `by` is not the owner, nor approved.
                if iszero(or(iszero(by), or(eq(by, owner), eq(by, approvedAddress)))) {
                    if iszero(sload(keccak256(0x0c, 0x30))) {
                        mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
                        revert(0x1c, 0x04)
                    }
                }
                // Delete the approved address if any.
                if approvedAddress { sstore(add(1, ownershipSlot), 0) }
            }
            // Clear the owner.
            sstore(ownershipSlot, xor(ownershipPacked, owner))
            // Decrement the balance of `owner`.
            {
                let balanceSlot := keccak256(0x0c, 0x1c)
                sstore(balanceSlot, sub(sload(balanceSlot), 1))
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, owner, 0, id)
        }
        _afterTokenTransfer(owner, address(0), id);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                INTERNAL APPROVAL FUNCTIONS                 */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns whether `account` is the owner of token `id`, or is approved to manage it.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    function _isApprovedOrOwner(address account, uint256 id)
        internal
        view
        virtual
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            result := 1
            // Clear the upper 96 bits.
            account := shr(96, shl(96, account))
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, account))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let owner := shr(96, shl(96, sload(ownershipSlot)))
            // Revert if the token does not exist.
            if iszero(owner) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
            // Check if `account` is the `owner`.
            if iszero(eq(account, owner)) {
                mstore(0x00, owner)
                // Check if `account` is approved to manage the token.
                if iszero(sload(keccak256(0x0c, 0x30))) {
                    result := eq(account, sload(add(1, ownershipSlot)))
                }
            }
        }
    }

    /// @dev Returns the account approved to manage token `id`.
    /// Returns the zero address instead of reverting if the token does not exist.
    function _getApproved(uint256 id) internal view virtual returns (address result) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, id)
            mstore(0x1c, _ERC721_MASTER_SLOT_SEED)
            result := sload(add(1, add(id, add(id, keccak256(0x00, 0x20)))))
        }
    }

    /// @dev Equivalent to `_approve(address(0), account, id)`.
    function _approve(address account, uint256 id) internal virtual {
        _approve(address(0), account, id);
    }

    /// @dev Sets `account` as the approved account to manage token `id`, using `by`.
    ///
    /// Requirements:
    /// - Token `id` must exist.
    /// - If `by` is not the zero address, `by` must be the owner
    ///   or an approved operator for the token owner.
    ///
    /// Emits a {Transfer} event.
    function _approve(address by, address account, uint256 id) internal virtual {
        assembly {
            // Clear the upper 96 bits.
            let bitmaskAddress := shr(96, not(0))
            account := and(bitmaskAddress, account)
            by := and(bitmaskAddress, by)
            // Load the owner of the token.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let owner := and(bitmaskAddress, sload(ownershipSlot))
            // Revert if the token does not exist.
            if iszero(owner) {
                mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                revert(0x1c, 0x04)
            }
            // If `by` is not the zero address, do the authorization check.
            // Revert if `by` is not the owner, nor approved.
            if iszero(or(iszero(by), eq(by, owner))) {
                mstore(0x00, owner)
                if iszero(sload(keccak256(0x0c, 0x30))) {
                    mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
                    revert(0x1c, 0x04)
                }
            }
            // Sets `account` as the approved account to manage `id`.
            sstore(add(1, ownershipSlot), account)
            // Emit the {Approval} event.
            log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, owner, account, id)
        }
    }

    /// @dev Approve or remove the `operator` as an operator for `by`,
    /// without authorization checks.
    ///
    /// Emits an {ApprovalForAll} event.
    function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            by := shr(96, shl(96, by))
            operator := shr(96, shl(96, operator))
            // Convert to 0 or 1.
            isApproved := iszero(iszero(isApproved))
            // Update the `isApproved` for (`by`, `operator`).
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator))
            mstore(0x00, by)
            sstore(keccak256(0x0c, 0x30), isApproved)
            // Emit the {ApprovalForAll} event.
            mstore(0x00, isApproved)
            log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, by, operator)
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                INTERNAL TRANSFER FUNCTIONS                 */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Equivalent to `_transfer(address(0), from, to, id)`.
    function _transfer(address from, address to, uint256 id) internal virtual {
        _transfer(address(0), from, to, id);
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - If `by` is not the zero address,
    ///   it must be the owner of the token, or be approved to manage the token.
    ///
    /// Emits a {Transfer} event.
    function _transfer(address by, address from, address to, uint256 id) internal virtual {
        _beforeTokenTransfer(from, to, id);
        /// @solidity memory-safe-assembly
        assembly {
            // Clear the upper 96 bits.
            let bitmaskAddress := shr(96, not(0))
            from := and(bitmaskAddress, from)
            to := and(bitmaskAddress, to)
            by := and(bitmaskAddress, by)
            // Load the ownership data.
            mstore(0x00, id)
            mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by))
            let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20)))
            let ownershipPacked := sload(ownershipSlot)
            let owner := and(bitmaskAddress, ownershipPacked)
            // Revert if `from` is not the owner, or does not exist.
            if iszero(mul(owner, eq(owner, from))) {
                if iszero(owner) {
                    mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`.
                    revert(0x1c, 0x04)
                }
                mstore(0x00, 0xa1148100) // `TransferFromIncorrectOwner()`.
                revert(0x1c, 0x04)
            }
            // Revert if `to` is the zero address.
            if iszero(to) {
                mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.
                revert(0x1c, 0x04)
            }
            // Load, check, and update the token approval.
            {
                mstore(0x00, from)
                let approvedAddress := sload(add(1, ownershipSlot))
                // If `by` is not the zero address, do the authorization check.
                // Revert if the `by` is not the owner, nor approved.
                if iszero(or(iszero(by), or(eq(by, from), eq(by, approvedAddress)))) {
                    if iszero(sload(keccak256(0x0c, 0x30))) {
                        mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
                        revert(0x1c, 0x04)
                    }
                }
                // Delete the approved address if any.
                if approvedAddress { sstore(add(1, ownershipSlot), 0) }
            }
            // Update with the new owner.
            sstore(ownershipSlot, xor(ownershipPacked, xor(from, to)))
            // Decrement the balance of `from`.
            {
                let fromBalanceSlot := keccak256(0x0c, 0x1c)
                sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1))
            }
            // Increment the balance of `to`.
            {
                mstore(0x00, to)
                let toBalanceSlot := keccak256(0x0c, 0x1c)
                let toBalanceSlotPacked := add(sload(toBalanceSlot), 1)
                if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) {
                    mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
                    revert(0x1c, 0x04)
                }
                sstore(toBalanceSlot, toBalanceSlotPacked)
            }
            // Emit the {Transfer} event.
            log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id)
        }
        _afterTokenTransfer(from, to, id);
    }

    /// @dev Equivalent to `_safeTransfer(from, to, id, "")`.
    function _safeTransfer(address from, address to, uint256 id) internal virtual {
        _safeTransfer(from, to, id, "");
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - The caller must be the owner of the token, or be approved to manage the token.
    /// - 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 id, bytes memory data)
        internal
        virtual
    {
        _transfer(address(0), from, to, id);
        if (_hasCode(to)) _checkOnERC721Received(from, to, id, data);
    }

    /// @dev Equivalent to `_safeTransfer(by, from, to, id, "")`.
    function _safeTransfer(address by, address from, address to, uint256 id) internal virtual {
        _safeTransfer(by, from, to, id, "");
    }

    /// @dev Transfers token `id` from `from` to `to`.
    ///
    /// Requirements:
    ///
    /// - Token `id` must exist.
    /// - `from` must be the owner of the token.
    /// - `to` cannot be the zero address.
    /// - If `by` is not the zero address,
    ///   it must be the owner of the token, or be approved to manage the token.
    /// - 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 by, address from, address to, uint256 id, bytes memory data)
        internal
        virtual
    {
        _transfer(by, from, to, id);
        if (_hasCode(to)) _checkOnERC721Received(from, to, id, data);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                    HOOKS FOR OVERRIDING                    */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Hook that is called before any token transfers, including minting and burning.
    function _beforeTokenTransfer(address from, address to, uint256 id) internal virtual {}

    /// @dev Hook that is called after any token transfers, including minting and burning.
    function _afterTokenTransfer(address from, address to, uint256 id) internal virtual {}

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      PRIVATE HELPERS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns if `a` has bytecode of non-zero length.
    function _hasCode(address a) private view returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := extcodesize(a) // Can handle dirty upper bits.
        }
    }

    /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`.
    /// Reverts if the target does not support the function correctly.
    function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data)
        private
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the calldata.
            let m := mload(0x40)
            let onERC721ReceivedSelector := 0x150b7a02
            mstore(m, onERC721ReceivedSelector)
            mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`.
            mstore(add(m, 0x40), shr(96, shl(96, from)))
            mstore(add(m, 0x60), id)
            mstore(add(m, 0x80), 0x80)
            let n := mload(data)
            mstore(add(m, 0xa0), n)
            if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) }
            // Revert if the call reverts.
            if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) {
                if returndatasize() {
                    // Bubble up the revert if the call reverts.
                    returndatacopy(m, 0x00, returndatasize())
                    revert(m, returndatasize())
                }
            }
            // Load the returndata and compare it.
            if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) {
                mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`.
                revert(0x1c, 0x04)
            }
        }
    }
}

File 8 of 10 : LibString.sol
// 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                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The `length` of the output is too small to contain all the hex digits.
    error HexLengthInsufficient();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         CONSTANTS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The constant returned when the `search` is not found in the string.
    uint256 internal constant NOT_FOUND = type(uint256).max;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                     DECIMAL OPERATIONS                     */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the base 10 decimal representation of `value`.
    function toString(uint256 value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        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.
            str := add(mload(0x40), 0x80)
            // Update the free memory pointer to allocate.
            mstore(0x40, add(str, 0x20))
            // Zeroize the slot after the string.
            mstore(str, 0)

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

            let w := not(0) // Tsk.
            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for { let temp := value } 1 {} {
                str := add(str, w) // `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)
                if iszero(temp) { break }
            }

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

    /// @dev Returns the base 10 decimal representation of `value`.
    function toString(int256 value) internal pure returns (string memory str) {
        if (value >= 0) {
            return toString(uint256(value));
        }
        unchecked {
            str = toString(uint256(-value));
        }
        /// @solidity memory-safe-assembly
        assembly {
            // We still have some spare memory space on the left,
            // as we have allocated 3 words (96 bytes) for up to 78 digits.
            let length := mload(str) // Load the string length.
            mstore(str, 0x2d) // Store the '-' character.
            str := sub(str, 1) // Move back the string pointer by a byte.
            mstore(str, add(length, 1)) // Update the string length.
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   HEXADECIMAL OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the hexadecimal representation of `value`,
    /// left-padded to an input length of `length` bytes.
    /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte,
    /// giving a total length of `length * 2 + 2` bytes.
    /// Reverts if `length` is too small for the output to contain all the digits.
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value, length);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`,
    /// left-padded to an input length of `length` bytes.
    /// The output is prefixed with "0x" encoded using 2 hexadecimal digits per byte,
    /// giving a total length of `length * 2` bytes.
    /// Reverts if `length` is too small for the output to contain all the digits.
    function toHexStringNoPrefix(uint256 value, uint256 length)
        internal
        pure
        returns (string memory str)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // 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.
            str := add(mload(0x40), and(add(shl(1, length), 0x42), not(0x1f)))
            // Allocate the memory.
            mstore(0x40, add(str, 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 start := sub(str, add(length, length))
            let w := not(1) // Tsk.
            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.
            for {} 1 {} {
                str := add(str, w) // `sub(str, 2)`.
                mstore8(add(str, 1), mload(and(temp, 15)))
                mstore8(str, mload(and(shr(4, temp), 15)))
                temp := shr(8, temp)
                if iszero(xor(str, start)) { 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 := sub(end, str)
            // Move the pointer and write the length.
            str := sub(str, 0x20)
            mstore(str, strLength)
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte.
    /// As address are 20 bytes long, the output will left-padded to have
    /// a length of `20 * 2 + 2` bytes.
    function toHexString(uint256 value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x".
    /// The output excludes leading "0" from the `toHexString` output.
    /// `0x00: "0x0", 0x01: "0x1", 0x12: "0x12", 0x123: "0x123"`.
    function toMinimalHexString(uint256 value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present.
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(add(str, o), 0x3078) // Write the "0x" prefix, accounting for leading zero.
            str := sub(add(str, o), 2) // Move the pointer, accounting for leading zero.
            mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output excludes leading "0" from the `toHexStringNoPrefix` output.
    /// `0x00: "0", 0x01: "1", 0x12: "12", 0x123: "123"`.
    function toMinimalHexStringNoPrefix(uint256 value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let o := eq(byte(0, mload(add(str, 0x20))), 0x30) // Whether leading zero is present.
            let strLength := mload(str) // Get the length.
            str := add(str, o) // Move the pointer, accounting for leading zero.
            mstore(str, sub(strLength, o)) // Write the length, accounting for leading zero.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is encoded using 2 hexadecimal digits per byte.
    /// As address are 20 bytes long, the output will left-padded to have
    /// a length of `20 * 2` bytes.
    function toHexStringNoPrefix(uint256 value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            // 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.
            str := add(mload(0x40), 0x80)
            // Allocate the memory.
            mstore(0x40, add(str, 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 w := not(1) // Tsk.
            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            for { let temp := value } 1 {} {
                str := add(str, w) // `sub(str, 2)`.
                mstore8(add(str, 1), mload(and(temp, 15)))
                mstore8(str, mload(and(shr(4, temp), 15)))
                temp := shr(8, temp)
                if iszero(temp) { break }
            }

            // Compute the string's length.
            let strLength := sub(end, str)
            // Move the pointer and write the length.
            str := sub(str, 0x20)
            mstore(str, strLength)
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x", encoded using 2 hexadecimal digits per byte,
    /// and the alphabets are capitalized conditionally according to
    /// https://eips.ethereum.org/EIPS/eip-55
    function toHexStringChecksummed(address value) internal pure returns (string memory str) {
        str = toHexString(value);
        /// @solidity memory-safe-assembly
        assembly {
            let mask := shl(6, div(not(0), 255)) // `0b010000000100000000 ...`
            let o := add(str, 0x22)
            let hashed := and(keccak256(o, 40), mul(34, mask)) // `0b10001000 ... `
            let t := shl(240, 136) // `0b10001000 << 240`
            for { let i := 0 } 1 {} {
                mstore(add(i, i), mul(t, byte(i, hashed)))
                i := add(i, 1)
                if eq(i, 20) { break }
            }
            mstore(o, xor(mload(o), shr(1, and(mload(0x00), and(mload(o), mask)))))
            o := add(o, 0x20)
            mstore(o, xor(mload(o), shr(1, and(mload(0x20), and(mload(o), mask)))))
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is prefixed with "0x" and encoded using 2 hexadecimal digits per byte.
    function toHexString(address value) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(value);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hexadecimal representation of `value`.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexStringNoPrefix(address value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            str := mload(0x40)

            // Allocate the memory.
            // We need 0x20 bytes for the trailing zeros padding, 0x20 bytes for the length,
            // 0x02 bytes for the prefix, and 0x28 bytes for the digits.
            // The next multiple of 0x20 above (0x20 + 0x20 + 0x02 + 0x28) is 0x80.
            mstore(0x40, add(str, 0x80))

            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            str := add(str, 2)
            mstore(str, 40)

            let o := add(str, 0x20)
            mstore(add(o, 40), 0)

            value := shl(96, 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.
            for { let i := 0 } 1 {} {
                let p := add(o, add(i, i))
                let temp := byte(i, value)
                mstore8(add(p, 1), mload(and(temp, 15)))
                mstore8(p, mload(shr(4, temp)))
                i := add(i, 1)
                if eq(i, 20) { break }
            }
        }
    }

    /// @dev Returns the hex encoded string from the raw bytes.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexString(bytes memory raw) internal pure returns (string memory str) {
        str = toHexStringNoPrefix(raw);
        /// @solidity memory-safe-assembly
        assembly {
            let strLength := add(mload(str), 2) // Compute the length.
            mstore(str, 0x3078) // Write the "0x" prefix.
            str := sub(str, 2) // Move the pointer.
            mstore(str, strLength) // Write the length.
        }
    }

    /// @dev Returns the hex encoded string from the raw bytes.
    /// The output is encoded using 2 hexadecimal digits per byte.
    function toHexStringNoPrefix(bytes memory raw) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            let length := mload(raw)
            str := add(mload(0x40), 2) // Skip 2 bytes for the optional prefix.
            mstore(str, add(length, length)) // Store the length of the output.

            // Store "0123456789abcdef" in scratch space.
            mstore(0x0f, 0x30313233343536373839616263646566)

            let o := add(str, 0x20)
            let end := add(raw, length)

            for {} iszero(eq(raw, end)) {} {
                raw := add(raw, 1)
                mstore8(add(o, 1), mload(and(mload(raw), 15)))
                mstore8(o, mload(and(shr(4, mload(raw)), 15)))
                o := add(o, 2)
            }
            mstore(o, 0) // Zeroize the slot after the string.
            mstore(0x40, add(o, 0x20)) // Allocate the memory.
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   RUNE STRING OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns the number of UTF characters in the string.
    function runeCount(string memory s) internal pure returns (uint256 result) {
        /// @solidity memory-safe-assembly
        assembly {
            if mload(s) {
                mstore(0x00, div(not(0), 255))
                mstore(0x20, 0x0202020202020202020202020202020202020202020202020303030304040506)
                let o := add(s, 0x20)
                let end := add(o, mload(s))
                for { result := 1 } 1 { result := add(result, 1) } {
                    o := add(o, byte(0, mload(shr(250, mload(o)))))
                    if iszero(lt(o, end)) { break }
                }
            }
        }
    }

    /// @dev Returns if this string is a 7-bit ASCII string.
    /// (i.e. all characters codes are in [0..127])
    function is7BitASCII(string memory s) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            let mask := shl(7, div(not(0), 255))
            result := 1
            let n := mload(s)
            if n {
                let o := add(s, 0x20)
                let end := add(o, n)
                let last := mload(end)
                mstore(end, 0)
                for {} 1 {} {
                    if and(mask, mload(o)) {
                        result := 0
                        break
                    }
                    o := add(o, 0x20)
                    if iszero(lt(o, end)) { break }
                }
                mstore(end, last)
            }
        }
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                   BYTE STRING OPERATIONS                   */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    // For performance and bytecode compactness, all indices of the following operations
    // are byte (ASCII) offsets, not UTF character offsets.

    /// @dev Returns `subject` all occurrences of `search` replaced with `replacement`.
    function replace(string memory subject, string memory search, string memory replacement)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        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, 0x20)) { h := keccak256(search, searchLength) }
                let m := shl(3, sub(0x20, and(searchLength, 0x1f)))
                let s := mload(search)
                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)
                                if iszero(lt(subject, subjectSearchEnd)) { break }
                                continue
                            }
                        }
                        // Copy the `replacement` one word at a time.
                        for { let o := 0 } 1 {} {
                            mstore(add(result, o), mload(add(replacement, o)))
                            o := add(o, 0x20)
                            if iszero(lt(o, replacementLength)) { break }
                        }
                        result := add(result, replacementLength)
                        subject := add(subject, searchLength)
                        if searchLength {
                            if iszero(lt(subject, subjectSearchEnd)) { break }
                            continue
                        }
                    }
                    mstore(result, t)
                    result := add(result, 1)
                    subject := add(subject, 1)
                    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.
            for {} lt(subject, subjectEnd) {} {
                mstore(resultRemainder, mload(subject))
                resultRemainder := add(resultRemainder, 0x20)
                subject := add(subject, 0x20)
            }
            result := sub(result, 0x20)
            let last := add(add(result, 0x20), k) // Zeroize the slot after the string.
            mstore(last, 0)
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
            mstore(result, k) // Store the length.
        }
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from left to right, starting from `from`.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function indexOf(string memory subject, string memory search, uint256 from)
        internal
        pure
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            for { let subjectLength := mload(subject) } 1 {} {
                if iszero(mload(search)) {
                    if iszero(gt(from, subjectLength)) {
                        result := from
                        break
                    }
                    result := subjectLength
                    break
                }
                let searchLength := mload(search)
                let subjectStart := add(subject, 0x20)

                result := not(0) // Initialize to `NOT_FOUND`.

                subject := add(subjectStart, from)
                let end := add(sub(add(subjectStart, subjectLength), searchLength), 1)

                let m := shl(3, sub(0x20, and(searchLength, 0x1f)))
                let s := mload(add(search, 0x20))

                if iszero(and(lt(subject, end), lt(from, subjectLength))) { break }

                if iszero(lt(searchLength, 0x20)) {
                    for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {
                        if iszero(shr(m, xor(mload(subject), s))) {
                            if eq(keccak256(subject, searchLength), h) {
                                result := sub(subject, subjectStart)
                                break
                            }
                        }
                        subject := add(subject, 1)
                        if iszero(lt(subject, end)) { break }
                    }
                    break
                }
                for {} 1 {} {
                    if iszero(shr(m, xor(mload(subject), s))) {
                        result := sub(subject, subjectStart)
                        break
                    }
                    subject := add(subject, 1)
                    if iszero(lt(subject, end)) { break }
                }
                break
            }
        }
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from left to right.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function indexOf(string memory subject, string memory search)
        internal
        pure
        returns (uint256 result)
    {
        result = indexOf(subject, search, 0);
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from right to left, starting from `from`.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function lastIndexOf(string memory subject, string memory search, uint256 from)
        internal
        pure
        returns (uint256 result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            for {} 1 {} {
                result := not(0) // Initialize to `NOT_FOUND`.
                let searchLength := mload(search)
                if gt(searchLength, mload(subject)) { break }
                let w := result

                let fromMax := sub(mload(subject), searchLength)
                if iszero(gt(fromMax, from)) { from := fromMax }

                let end := add(add(subject, 0x20), w)
                subject := add(add(subject, 0x20), from)
                if iszero(gt(subject, end)) { break }
                // As this function is not too often used,
                // we shall simply use keccak256 for smaller bytecode size.
                for { let h := keccak256(add(search, 0x20), searchLength) } 1 {} {
                    if eq(keccak256(subject, searchLength), h) {
                        result := sub(subject, add(end, 1))
                        break
                    }
                    subject := add(subject, w) // `sub(subject, 1)`.
                    if iszero(gt(subject, end)) { break }
                }
                break
            }
        }
    }

    /// @dev Returns the byte index of the first location of `search` in `subject`,
    /// searching from right to left.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `search` is not found.
    function lastIndexOf(string memory subject, string memory search)
        internal
        pure
        returns (uint256 result)
    {
        result = lastIndexOf(subject, search, uint256(int256(-1)));
    }

    /// @dev Returns whether `subject` starts with `search`.
    function startsWith(string memory subject, string memory search)
        internal
        pure
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let searchLength := mload(search)
            // Just using keccak256 directly is actually cheaper.
            // forgefmt: disable-next-item
            result := and(
                iszero(gt(searchLength, mload(subject))),
                eq(
                    keccak256(add(subject, 0x20), searchLength),
                    keccak256(add(search, 0x20), searchLength)
                )
            )
        }
    }

    /// @dev Returns whether `subject` ends with `search`.
    function endsWith(string memory subject, string memory search)
        internal
        pure
        returns (bool result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let searchLength := mload(search)
            let subjectLength := mload(subject)
            // Whether `search` is not longer than `subject`.
            let withinRange := iszero(gt(searchLength, subjectLength))
            // Just using keccak256 directly is actually cheaper.
            // forgefmt: disable-next-item
            result := and(
                withinRange,
                eq(
                    keccak256(
                        // `subject + 0x20 + max(subjectLength - searchLength, 0)`.
                        add(add(subject, 0x20), mul(withinRange, sub(subjectLength, searchLength))),
                        searchLength
                    ),
                    keccak256(add(search, 0x20), searchLength)
                )
            )
        }
    }

    /// @dev Returns `subject` repeated `times`.
    function repeat(string memory subject, uint256 times)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            if iszero(or(iszero(times), iszero(subjectLength))) {
                subject := add(subject, 0x20)
                result := mload(0x40)
                let output := add(result, 0x20)
                for {} 1 {} {
                    // Copy the `subject` one word at a time.
                    for { let o := 0 } 1 {} {
                        mstore(add(output, o), mload(add(subject, o)))
                        o := add(o, 0x20)
                        if iszero(lt(o, subjectLength)) { break }
                    }
                    output := add(output, subjectLength)
                    times := sub(times, 1)
                    if iszero(times) { break }
                }
                mstore(output, 0) // Zeroize the slot after the string.
                let resultLength := sub(output, add(result, 0x20))
                mstore(result, resultLength) // Store the length.
                // Allocate the memory.
                mstore(0x40, add(result, add(resultLength, 0x20)))
            }
        }
    }

    /// @dev Returns a copy of `subject` sliced from `start` to `end` (exclusive).
    /// `start` and `end` are byte offsets.
    function slice(string memory subject, uint256 start, uint256 end)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            if iszero(gt(subjectLength, end)) { end := subjectLength }
            if iszero(gt(subjectLength, start)) { start := subjectLength }
            if lt(start, end) {
                result := mload(0x40)
                let resultLength := sub(end, start)
                mstore(result, resultLength)
                subject := add(subject, start)
                let w := not(0x1f)
                // Copy the `subject` one word at a time, backwards.
                for { let o := and(add(resultLength, 0x1f), w) } 1 {} {
                    mstore(add(result, o), mload(add(subject, o)))
                    o := add(o, w) // `sub(o, 0x20)`.
                    if iszero(o) { break }
                }
                // Zeroize the slot after the string.
                mstore(add(add(result, 0x20), resultLength), 0)
                // Allocate memory for the length and the bytes,
                // rounded up to a multiple of 32.
                mstore(0x40, add(result, and(add(resultLength, 0x3f), w)))
            }
        }
    }

    /// @dev Returns a copy of `subject` sliced from `start` to the end of the string.
    /// `start` is a byte offset.
    function slice(string memory subject, uint256 start)
        internal
        pure
        returns (string memory result)
    {
        result = slice(subject, start, uint256(int256(-1)));
    }

    /// @dev Returns all the indices of `search` in `subject`.
    /// The indices are byte offsets.
    function indicesOf(string memory subject, string memory search)
        internal
        pure
        returns (uint256[] memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let subjectLength := mload(subject)
            let searchLength := mload(search)

            if iszero(gt(searchLength, subjectLength)) {
                subject := add(subject, 0x20)
                search := add(search, 0x20)
                result := add(mload(0x40), 0x20)

                let subjectStart := subject
                let subjectSearchEnd := add(sub(add(subject, subjectLength), searchLength), 1)
                let h := 0
                if iszero(lt(searchLength, 0x20)) { h := keccak256(search, searchLength) }
                let m := shl(3, sub(0x20, and(searchLength, 0x1f)))
                let s := mload(search)
                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)) {
                                subject := add(subject, 1)
                                if iszero(lt(subject, subjectSearchEnd)) { break }
                                continue
                            }
                        }
                        // Append to `result`.
                        mstore(result, sub(subject, subjectStart))
                        result := add(result, 0x20)
                        // Advance `subject` by `searchLength`.
                        subject := add(subject, searchLength)
                        if searchLength {
                            if iszero(lt(subject, subjectSearchEnd)) { break }
                            continue
                        }
                    }
                    subject := add(subject, 1)
                    if iszero(lt(subject, subjectSearchEnd)) { break }
                }
                let resultEnd := result
                // Assign `result` to the free memory pointer.
                result := mload(0x40)
                // Store the length of `result`.
                mstore(result, shr(5, sub(resultEnd, add(result, 0x20))))
                // Allocate memory for result.
                // We allocate one more word, so this array can be recycled for {split}.
                mstore(0x40, add(resultEnd, 0x20))
            }
        }
    }

    /// @dev Returns a arrays of strings based on the `delimiter` inside of the `subject` string.
    function split(string memory subject, string memory delimiter)
        internal
        pure
        returns (string[] memory result)
    {
        uint256[] memory indices = indicesOf(subject, delimiter);
        /// @solidity memory-safe-assembly
        assembly {
            let w := not(0x1f)
            let indexPtr := add(indices, 0x20)
            let indicesEnd := add(indexPtr, shl(5, add(mload(indices), 1)))
            mstore(add(indicesEnd, w), mload(subject))
            mstore(indices, add(mload(indices), 1))
            let prevIndex := 0
            for {} 1 {} {
                let index := mload(indexPtr)
                mstore(indexPtr, 0x60)
                if iszero(eq(index, prevIndex)) {
                    let element := mload(0x40)
                    let elementLength := sub(index, prevIndex)
                    mstore(element, elementLength)
                    // Copy the `subject` one word at a time, backwards.
                    for { let o := and(add(elementLength, 0x1f), w) } 1 {} {
                        mstore(add(element, o), mload(add(add(subject, prevIndex), o)))
                        o := add(o, w) // `sub(o, 0x20)`.
                        if iszero(o) { break }
                    }
                    // Zeroize the slot after the string.
                    mstore(add(add(element, 0x20), elementLength), 0)
                    // Allocate memory for the length and the bytes,
                    // rounded up to a multiple of 32.
                    mstore(0x40, add(element, and(add(elementLength, 0x3f), w)))
                    // Store the `element` into the array.
                    mstore(indexPtr, element)
                }
                prevIndex := add(index, mload(delimiter))
                indexPtr := add(indexPtr, 0x20)
                if iszero(lt(indexPtr, indicesEnd)) { break }
            }
            result := indices
            if iszero(mload(delimiter)) {
                result := add(indices, 0x20)
                mstore(result, sub(mload(indices), 2))
            }
        }
    }

    /// @dev Returns a concatenated string of `a` and `b`.
    /// Cheaper than `string.concat()` and does not de-align the free memory pointer.
    function concat(string memory a, string memory b)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let w := not(0x1f)
            result := mload(0x40)
            let aLength := mload(a)
            // Copy `a` one word at a time, backwards.
            for { let o := and(add(aLength, 0x20), w) } 1 {} {
                mstore(add(result, o), mload(add(a, o)))
                o := add(o, w) // `sub(o, 0x20)`.
                if iszero(o) { break }
            }
            let bLength := mload(b)
            let output := add(result, aLength)
            // Copy `b` one word at a time, backwards.
            for { let o := and(add(bLength, 0x20), w) } 1 {} {
                mstore(add(output, o), mload(add(b, o)))
                o := add(o, w) // `sub(o, 0x20)`.
                if iszero(o) { break }
            }
            let totalLength := add(aLength, bLength)
            let last := add(add(result, 0x20), totalLength)
            // Zeroize the slot after the string.
            mstore(last, 0)
            // Stores the length.
            mstore(result, totalLength)
            // Allocate memory for the length and the bytes,
            // rounded up to a multiple of 32.
            mstore(0x40, and(add(last, 0x1f), w))
        }
    }

    /// @dev Returns a copy of the string in either lowercase or UPPERCASE.
    /// WARNING! This function is only compatible with 7-bit ASCII strings.
    function toCase(string memory subject, bool toUpper)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let length := mload(subject)
            if length {
                result := add(mload(0x40), 0x20)
                subject := add(subject, 1)
                let flags := shl(add(70, shl(5, toUpper)), 0x3ffffff)
                let w := not(0)
                for { let o := length } 1 {} {
                    o := add(o, w)
                    let b := and(0xff, mload(add(subject, o)))
                    mstore8(add(result, o), xor(b, and(shr(b, flags), 0x20)))
                    if iszero(o) { break }
                }
                result := mload(0x40)
                mstore(result, length) // Store the length.
                let last := add(add(result, 0x20), length)
                mstore(last, 0) // Zeroize the slot after the string.
                mstore(0x40, add(last, 0x20)) // Allocate the memory.
            }
        }
    }

    /// @dev Returns a string from a small bytes32 string.
    /// `smallString` must be null terminated, or behavior will be undefined.
    function fromSmallString(bytes32 smallString) internal pure returns (string memory result) {
        if (smallString == bytes32(0)) return result;
        /// @solidity memory-safe-assembly
        assembly {
            result := mload(0x40)
            let n := 0
            for {} 1 {} {
                n := add(n, 1)
                if iszero(byte(n, smallString)) { break } // Scan for '\0'.
            }
            mstore(result, n)
            let o := add(result, 0x20)
            mstore(o, smallString)
            mstore(add(o, n), 0)
            mstore(0x40, add(result, 0x40))
        }
    }

    /// @dev Returns a lowercased copy of the string.
    /// WARNING! This function is only compatible with 7-bit ASCII strings.
    function lower(string memory subject) internal pure returns (string memory result) {
        result = toCase(subject, false);
    }

    /// @dev Returns an UPPERCASED copy of the string.
    /// WARNING! This function is only compatible with 7-bit ASCII strings.
    function upper(string memory subject) internal pure returns (string memory result) {
        result = toCase(subject, true);
    }

    /// @dev Escapes the string to be used within HTML tags.
    function escapeHTML(string memory s) internal pure returns (string memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            let end := add(s, mload(s))
            result := add(mload(0x40), 0x20)
            // Store the bytes of the packed offsets and strides into the scratch space.
            // `packed = (stride << 5) | offset`. Max offset is 20. Max stride is 6.
            mstore(0x1f, 0x900094)
            mstore(0x08, 0xc0000000a6ab)
            // Store "&quot;&amp;&#39;&lt;&gt;" into the scratch space.
            mstore(0x00, shl(64, 0x2671756f743b26616d703b262333393b266c743b2667743b))
            for {} iszero(eq(s, end)) {} {
                s := add(s, 1)
                let c := and(mload(s), 0xff)
                // Not in `["\"","'","&","<",">"]`.
                if iszero(and(shl(c, 1), 0x500000c400000000)) {
                    mstore8(result, c)
                    result := add(result, 1)
                    continue
                }
                let t := shr(248, mload(c))
                mstore(result, mload(and(t, 0x1f)))
                result := add(result, shr(5, t))
            }
            let last := result
            mstore(last, 0) // Zeroize the slot after the string.
            result := mload(0x40)
            mstore(result, sub(last, add(result, 0x20))) // Store the length.
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
        }
    }

    /// @dev Escapes the string to be used within double-quotes in a JSON.
    /// If `addDoubleQuotes` is true, the result will be enclosed in double-quotes.
    function escapeJSON(string memory s, bool addDoubleQuotes)
        internal
        pure
        returns (string memory result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            let end := add(s, mload(s))
            result := add(mload(0x40), 0x20)
            if addDoubleQuotes {
                mstore8(result, 34)
                result := add(1, result)
            }
            // Store "\\u0000" in scratch space.
            // Store "0123456789abcdef" in scratch space.
            // Also, store `{0x08:"b", 0x09:"t", 0x0a:"n", 0x0c:"f", 0x0d:"r"}`.
            // into the scratch space.
            mstore(0x15, 0x5c75303030303031323334353637383961626364656662746e006672)
            // Bitmask for detecting `["\"","\\"]`.
            let e := or(shl(0x22, 1), shl(0x5c, 1))
            for {} iszero(eq(s, end)) {} {
                s := add(s, 1)
                let c := and(mload(s), 0xff)
                if iszero(lt(c, 0x20)) {
                    if iszero(and(shl(c, 1), e)) {
                        // Not in `["\"","\\"]`.
                        mstore8(result, c)
                        result := add(result, 1)
                        continue
                    }
                    mstore8(result, 0x5c) // "\\".
                    mstore8(add(result, 1), c)
                    result := add(result, 2)
                    continue
                }
                if iszero(and(shl(c, 1), 0x3700)) {
                    // Not in `["\b","\t","\n","\f","\d"]`.
                    mstore8(0x1d, mload(shr(4, c))) // Hex value.
                    mstore8(0x1e, mload(and(c, 15))) // Hex value.
                    mstore(result, mload(0x19)) // "\\u00XX".
                    result := add(result, 6)
                    continue
                }
                mstore8(result, 0x5c) // "\\".
                mstore8(add(result, 1), mload(add(c, 8)))
                result := add(result, 2)
            }
            if addDoubleQuotes {
                mstore8(result, 34)
                result := add(1, result)
            }
            let last := result
            mstore(last, 0) // Zeroize the slot after the string.
            result := mload(0x40)
            mstore(result, sub(last, add(result, 0x20))) // Store the length.
            mstore(0x40, add(last, 0x20)) // Allocate the memory.
        }
    }

    /// @dev Escapes the string to be used within double-quotes in a JSON.
    function escapeJSON(string memory s) internal pure returns (string memory result) {
        result = escapeJSON(s, false);
    }

    /// @dev Returns whether `a` equals `b`.
    function eq(string memory a, string memory b) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            result := eq(keccak256(add(a, 0x20), mload(a)), keccak256(add(b, 0x20), mload(b)))
        }
    }

    /// @dev Returns whether `a` equals `b`. For small strings up to 32 bytes.
    /// `b` must be null terminated, or behavior will be undefined.
    function eqs(string memory a, bytes32 b) internal pure returns (bool result) {
        /// @solidity memory-safe-assembly
        assembly {
            // These should be evaluated on compile time, as far as possible.
            let x := and(b, add(not(b), 1))
            let r := or(shl(8, iszero(b)), shl(7, iszero(iszero(shr(128, x)))))
            r := or(r, shl(6, iszero(iszero(shr(64, shr(r, x))))))
            r := or(r, shl(5, lt(0xffffffff, shr(r, x))))
            r := or(r, shl(4, lt(0xffff, shr(r, x))))
            r := or(r, shl(3, lt(0xff, shr(r, x))))
            result := gt(eq(mload(a), sub(32, shr(3, r))), shr(r, xor(b, mload(add(a, 0x20)))))
        }
    }

    /// @dev Packs a single string with its length into a single word.
    /// Returns `bytes32(0)` if the length is zero or greater than 31.
    function packOne(string memory a) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            // We don't need to zero right pad the string,
            // since this is our own custom non-standard packing scheme.
            result :=
                mul(
                    // Load the length and the bytes.
                    mload(add(a, 0x1f)),
                    // `length != 0 && length < 32`. Abuses underflow.
                    // Assumes that the length is valid and within the block gas limit.
                    lt(sub(mload(a), 1), 0x1f)
                )
        }
    }

    /// @dev Unpacks a string packed using {packOne}.
    /// Returns the empty string if `packed` is `bytes32(0)`.
    /// If `packed` is not an output of {packOne}, the output behavior is undefined.
    function unpackOne(bytes32 packed) internal pure returns (string memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            // Grab the free memory pointer.
            result := mload(0x40)
            // Allocate 2 words (1 for the length, 1 for the bytes).
            mstore(0x40, add(result, 0x40))
            // Zeroize the length slot.
            mstore(result, 0)
            // Store the length and bytes.
            mstore(add(result, 0x1f), packed)
            // Right pad with zeroes.
            mstore(add(add(result, 0x20), mload(result)), 0)
        }
    }

    /// @dev Packs two strings with their lengths into a single word.
    /// Returns `bytes32(0)` if combined length is zero or greater than 30.
    function packTwo(string memory a, string memory b) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            let aLength := mload(a)
            // We don't need to zero right pad the strings,
            // since this is our own custom non-standard packing scheme.
            result :=
                mul(
                    // Load the length and the bytes of `a` and `b`.
                    or(
                        shl(shl(3, sub(0x1f, aLength)), mload(add(a, aLength))),
                        mload(sub(add(b, 0x1e), aLength))
                    ),
                    // `totalLength != 0 && totalLength < 31`. Abuses underflow.
                    // Assumes that the lengths are valid and within the block gas limit.
                    lt(sub(add(aLength, mload(b)), 1), 0x1e)
                )
        }
    }

    /// @dev Unpacks strings packed using {packTwo}.
    /// Returns the empty strings if `packed` is `bytes32(0)`.
    /// If `packed` is not an output of {packTwo}, the output behavior is undefined.
    function unpackTwo(bytes32 packed)
        internal
        pure
        returns (string memory resultA, string memory resultB)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Grab the free memory pointer.
            resultA := mload(0x40)
            resultB := add(resultA, 0x40)
            // Allocate 2 words for each string (1 for the length, 1 for the byte). Total 4 words.
            mstore(0x40, add(resultB, 0x40))
            // Zeroize the length slots.
            mstore(resultA, 0)
            mstore(resultB, 0)
            // Store the lengths and bytes.
            mstore(add(resultA, 0x1f), packed)
            mstore(add(resultB, 0x1f), mload(add(add(resultA, 0x20), mload(resultA))))
            // Right pad with zeroes.
            mstore(add(add(resultA, 0x20), mload(resultA)), 0)
            mstore(add(add(resultB, 0x20), mload(resultB)), 0)
        }
    }

    /// @dev Directly returns `a` without copying.
    function directReturn(string memory a) internal pure {
        assembly {
            // Assumes that the string does not start from the scratch space.
            let retStart := sub(a, 0x20)
            let retSize := add(mload(a), 0x40)
            // Right pad with zeroes. Just in case the string is produced
            // by a method that doesn't zero right pad.
            mstore(add(retStart, retSize), 0)
            // Store the return offset.
            mstore(retStart, 0x20)
            // End the transaction, returning the string.
            return(retStart, retSize)
        }
    }
}

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

pragma solidity ^0.8.4;

import './IERC721A.sol';

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, it can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return '';
    }

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the
     * zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) public payable virtual override {
        address owner = ownerOf(tokenId);

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

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

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

        return _tokenApprovals[tokenId].value;
    }

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom}
     * for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

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

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted. See {_mint}.
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < _currentIndex && // If within bounds,
            _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
    }

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

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

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

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

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

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

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

        _beforeTokenTransfers(from, to, tokenId, 1);

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public payable virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @dev Hook that is called before a set of serially-ordered token IDs
     * are about to be transferred. This includes minting.
     * And also called before burning one token.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Hook that is called after a set of serially-ordered token IDs
     * have been transferred. This includes minting.
     * And also called after one token has been burned.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
     * transferred to `to`.
     * - When `from` is zero, `tokenId` has been minted for `to`.
     * - When `to` is zero, `tokenId` has been burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

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

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

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

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

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

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

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

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

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

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

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

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

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

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

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

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

    /**
     * @dev Safely mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
     * - `quantity` must be greater than 0.
     *
     * See {_mint}.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal virtual {
        _mint(to, quantity);

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

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

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

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

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

        address from = address(uint160(prevOwnershipPacked));

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Called during each token transfer to set the 24bit `extraData` field.
     * Intended to be overridden by the cosumer contract.
     *
     * `previousExtraData` - the value of `extraData` before transfer.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _extraData(
        address from,
        address to,
        uint24 previousExtraData
    ) internal view virtual returns (uint24) {}

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

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

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

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

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

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

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

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

pragma solidity ^0.8.4;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables
     * (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in `owner`'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`,
     * checking first that contract recipients are aware of the ERC721 protocol
     * to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move
     * this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external payable;

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom}
     * whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the
     * zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external payable;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom}
     * for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

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

    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);

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

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

Settings
{
  "remappings": [
    "@forge-std/=lib/forge-std/src/",
    "solady/=lib/solady/src/",
    "ERC1155P/=lib/ERC1155P/contracts/",
    "ERC721A/=lib/ERC721A/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"vouchersUri","type":"string"},{"internalType":"string","name":"membersOnlyUri","type":"string"},{"internalType":"string","name":"proofOfWineUri","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ArrayLengthMismatch","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BurnExceedsBalance","type":"error"},{"inputs":[],"name":"BurnFromZeroAddress","type":"error"},{"inputs":[],"name":"ExceedMaxPerWallet","type":"error"},{"inputs":[],"name":"ExceedMaxSupply","type":"error"},{"inputs":[],"name":"ExceedsMaximumBalance","type":"error"},{"inputs":[],"name":"ExceedsMaximumTokenId","type":"error"},{"inputs":[],"name":"FailedToWithdraw","type":"error"},{"inputs":[],"name":"InvalidConfig","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NonexistentToken","type":"error"},{"inputs":[],"name":"NotAMember","type":"error"},{"inputs":[],"name":"RedemptionNotActive","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferExceedsBalance","type":"error"},{"inputs":[],"name":"TransferToNonERC1155ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnlaunchedToken","type":"error"},{"inputs":[],"name":"VoucherNotMintable","type":"error"},{"inputs":[],"name":"WrongValueSent","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint16","name":"amount","type":"uint16"}],"name":"burnAndRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"_approved","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"membersOnly","outputs":[{"internalType":"contract MembersOnly","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint16","name":"amount","type":"uint16"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint16","name":"numberOfCases","type":"uint16"}],"name":"mintCases","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint16","name":"amount","type":"uint16"},{"internalType":"address","name":"to","type":"address"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proofOfWine","outputs":[{"internalType":"contract ProofOfWine","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"id","type":"uint16"},{"internalType":"bool","name":"active","type":"bool"}],"name":"setMintIsActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"id","type":"uint16"},{"internalType":"bool","name":"active","type":"bool"}],"name":"setRedemptionIsActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"maxSupply","type":"uint16"},{"internalType":"uint16","name":"maxPerWallet","type":"uint16"},{"internalType":"uint72","name":"pricePerBottle","type":"uint72"},{"internalType":"uint72","name":"pricePerCase","type":"uint72"},{"internalType":"bool","name":"immediateMintsAvailable","type":"bool"},{"internalType":"bool","name":"immediateRedemptionsAvailable","type":"bool"}],"name":"setVoucherConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"voucherConfigs","outputs":[{"internalType":"uint16","name":"totalMinted","type":"uint16"},{"internalType":"uint16","name":"numRedeemed","type":"uint16"},{"internalType":"uint16","name":"maxPerWallet","type":"uint16"},{"internalType":"uint16","name":"maxSupply","type":"uint16"},{"internalType":"uint32","name":"redeemedStartTokenId","type":"uint32"},{"internalType":"bool","name":"mintIsActive","type":"bool"},{"internalType":"bool","name":"redemptionIsActive","type":"bool"},{"internalType":"uint72","name":"pricePerBottle","type":"uint72"},{"internalType":"uint72","name":"pricePerCase","type":"uint72"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b50604051620061613803806200616183398101604081905262000034916200077a565b6040518060400160405280600f81526020016e41706556696e65566f75636865727360881b8152506040518060400160405280600381526020016220ab2b60e91b815250816000908162000089919062000896565b50600162000098828262000896565b505050620000ac32620002f760201b60201c565b620000d2326003546064604051806020016040528060008152506200033360201b60201c565b604080516101208101825260648152600060208083018281526103e88486018181526060860191825260016080870181815260a0880187815260c08901888152669fdf42f6e4800060e08b019081526706f05b59d3b200006101008c01908152600380548c526005909a52998c90209a518b5498519651975194519351925191519a5161ffff91821663ffffffff19909a169990991762010000978216979097029690961763ffffffff60201b19166401000000009787169790970261ffff60301b191696909617660100000000000095909316949094029190911764ffffffffff60401b19166801000000000000000063ffffffff9092169190910260ff60601b1916176c010000000000000000000000009215159290920291909117600160681b600160b81b0319166d010000000000000000000000000092151592909202600160701b600160b81b03191691909117600160701b6001600160481b0395861602176001600160b81b0316600160b81b9490921693909302179092558154019055518290620002639062000691565b6200026f919062000990565b604051809103906000f0801580156200028c573d6000803e3d6000fd5b506001600160a01b031660a0526040518190620002a9906200069f565b620002b5919062000990565b604051809103906000f080158015620002d2573d6000803e3d6000fd5b506001600160a01b03166080526004620002ed848262000896565b5050505062000a1f565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b60016001605f1b0383111562000355576200035563467777f160e11b6200058f565b6001600160a01b038416620003755762000375622e076360e81b6200058f565b8160000362000390576200039063b562e8dd60e01b6200058f565b600383901c605c85901b6001605c1b600160fc1b031617600760fd1b1760009081526020902054339061ffff600586901b60e01681811b90921690911c9084820190811115620003ec57620003ec630b6cdf5d60e41b6200058f565b81811015620004075762000407630b6cdf5d60e41b6200058f565b6200044f8787838160031c8360601b60041c17600760fd1b176000526020600020600052806007831660051b1b6000515461ffff6007851660051b1b19161760005155505050565b600760fd1b6001605c1b600160fc1b03605c89901b16600388901c17176000908152602090205463ffff000060e0600589901b1690811b909116901c60101c85810161ffff811115620004ae57620004ae630b6cdf5d60e41b6200058f565b81811015620004c957620004c9630b6cdf5d60e41b6200058f565b620005168989838160031c8360601b60041c17600760fd1b1760005260206000206000528060101b6007831660051b1b6000515463ffff00006007851660051b1b19161760005155505050565b604051888152876020820152896000877fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506001600160a01b0389163b1562000584576200056d60008a8a8a8a620005a1565b620005845762000584639c05499b60e01b6200058f565b505050505050505050565b8060005260046000fd5b505050505050565b60405163f23a6e6160e01b81526000906001600160a01b0386169063f23a6e6190620005da9033908a90899089908990600401620009ac565b6020604051808303816000875af192505050801562000618575060408051601f3d908101601f191682019092526200061591810190620009f3565b60015b62000673573d80801562000649576040519150601f19603f3d011682016040523d82523d6000602084013e6200064e565b606091505b5080516000036200066b576200066b639c05499b60e01b6200058f565b805181602001fd5b6001600160e01b03191663f23a6e6160e01b14905095945050505050565b611651806200370583390190565b61140b8062004d5683390190565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620006e0578181015183820152602001620006c6565b50506000910152565b600082601f830112620006fb57600080fd5b81516001600160401b0380821115620007185762000718620006ad565b604051601f8301601f19908116603f01168101908282118183101715620007435762000743620006ad565b816040528381528660208588010111156200075d57600080fd5b62000770846020830160208901620006c3565b9695505050505050565b6000806000606084860312156200079057600080fd5b83516001600160401b0380821115620007a857600080fd5b620007b687838801620006e9565b94506020860151915080821115620007cd57600080fd5b620007db87838801620006e9565b93506040860151915080821115620007f257600080fd5b506200080186828701620006e9565b9150509250925092565b600181811c908216806200082057607f821691505b6020821081036200084157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200089157600081815260208120601f850160051c81016020861015620008705750805b601f850160051c820191505b8181101562000599578281556001016200087c565b505050565b81516001600160401b03811115620008b257620008b2620006ad565b620008ca81620008c384546200080b565b8462000847565b602080601f831160018114620009025760008415620008e95750858301515b600019600386901b1c1916600185901b17855562000599565b600085815260208120601f198616915b82811015620009335788860151825594840194600190910190840162000912565b5085821015620009525787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600081518084526200097c816020860160208601620006c3565b601f01601f19169290920160200192915050565b602081526000620009a5602083018462000962565b9392505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090620009e89083018462000962565b979650505050505050565b60006020828403121562000a0657600080fd5b81516001600160e01b031981168114620009a557600080fd5b60805160a051612cab62000a5a6000396000818161060f01528181610895015261108201526000818161047801526110f30152612cab6000f3fe6080604052600436106101d75760003560e01c8063658e2daf11610102578063d639aebb11610095578063f16fcb4911610064578063f16fcb49146105fd578063f242432a14610631578063f2fde38b14610651578063fee81cf41461066457600080fd5b8063d639aebb14610568578063e985e9c514610588578063ea226a02146105ca578063f04e283e146105ea57600080fd5b80638da5cb5b116100d15780638da5cb5b146104fa57806395d89b4114610513578063a0bcfc7f14610528578063a22cb4651461054857600080fd5b8063658e2daf146104665780636b98ee54146104b25780636c96650f146104d2578063715018a6146104f257600080fd5b806324ed4be21161017a578063370ff6f011610149578063370ff6f0146104095780633ccfd60b1461041c5780634e1273f41461043157806354d1f13d1461045e57600080fd5b806324ed4be2146103a157806325692962146103c15780632eb2c2d6146103c957806330a55522146103e957600080fd5b806306fdde03116101b657806306fdde0314610335578063076adbae146103575780630e89341c1461036c57806318160ddd1461038c57600080fd5b8062fdd58e146101dc57806301ffc9a71461020f578063054cfe131461023f575b600080fd5b3480156101e857600080fd5b506101fc6101f7366004612340565b610697565b6040519081526020015b60405180910390f35b34801561021b57600080fd5b5061022f61022a366004612380565b6106ca565b6040519015158152602001610206565b34801561024b57600080fd5b506102d061025a3660046123a4565b60056020526000908152604090205461ffff80821691620100008104821691600160201b8204811691600160301b81049091169063ffffffff600160401b8204169060ff600160601b8204811691600160681b8104909116906001600160481b03600160701b8204811691600160b81b90041689565b6040805161ffff9a8b168152988a1660208a01529689169688019690965296909316606086015263ffffffff9091166080850152151560a0840152151560c08301526001600160481b0392831660e08301529190911661010082015261012001610206565b34801561034157600080fd5b5061034a610718565b604051610206919061240d565b61036a610365366004612432565b6107a6565b005b34801561037857600080fd5b5061034a6103873660046123a4565b610a27565b34801561039857600080fd5b506101fc610b31565b3480156103ad57600080fd5b5061036a6103bc366004612485565b610c20565b61036a610ec5565b3480156103d557600080fd5b5061036a6103e43660046125e8565b610f15565b3480156103f557600080fd5b5061036a610404366004612432565b610f2d565b61036a610417366004612432565b6111b9565b34801561042857600080fd5b5061036a61138e565b34801561043d57600080fd5b5061045161044c36600461269d565b611402565b6040516102069190612709565b61036a6114e4565b34801561047257600080fd5b5061049a7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610206565b3480156104be57600080fd5b5061036a6104cd36600461274d565b611520565b3480156104de57600080fd5b5061036a6104ed366004612789565b611649565b61036a6116a8565b34801561050657600080fd5b50638b78c6d8195461049a565b34801561051f57600080fd5b5061034a6116bc565b34801561053457600080fd5b5061036a6105433660046127b3565b6116c9565b34801561055457600080fd5b5061036a610563366004612825565b6116de565b34801561057457600080fd5b506101fc610583366004612841565b611736565b34801561059457600080fd5b5061022f6105a336600461285c565b6001600160a01b0391821660009081529116600d60fc1b1760205260408120908190525490565b3480156105d657600080fd5b5061036a6105e5366004612789565b6117fd565b61036a6105f8366004612886565b61185c565b34801561060957600080fd5b5061049a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561063d57600080fd5b5061036a61064c3660046128a1565b611899565b61036a61065f366004612886565b6118ad565b34801561067057600080fd5b506101fc61067f366004612886565b63389a75e1600c908152600091909152602090205490565b60006001600160a01b0383166106b7576106b76323d3ad8160e21b6118d4565b6106c183836118de565b90505b92915050565b60006301ffc9a760e01b6001600160e01b0319831614806106fb5750636cdb3d1360e11b6001600160e01b03198316145b806106c45750506001600160e01b0319166303a24d0760e21b1490565b6000805461072590612913565b80601f016020809104026020016040519081016040528092919081815260200182805461075190612913565b801561079e5780601f106107735761010080835404028352916020019161079e565b820191906000526020600020905b81548152906001019060200180831161078157829003601f168201915b505050505081565b600082815260056020908152604091829020825161012081018452905461ffff8082168352620100008204811693830193909352600160201b8104831693820193909352600160301b8304909116606082015263ffffffff600160401b830416608082015260ff600160601b83048116151560a08301819052600160681b8404909116151560c08301526001600160481b03600160701b8404811660e0840152600160b81b9093049092166101008201529061087557604051631906009760e21b815260040160405180910390fd5b60008311801561090a57506040516370a0823160e01b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156108e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109089190612947565b155b15610928576040516305031d1160e31b815260040160405180910390fd5b806040015161ffff1661093b3385611917565b6109499061ffff8516612976565b111561096857604051636c80554560e11b815260040160405180910390fd5b8161ffff168160e0015161097c9190612989565b6001600160481b031634146109a457604051632f4613eb60e01b815260040160405180910390fd5b806060015161ffff168160000151836109bd91906129b4565b61ffff1611156109e057604051630f0c37b960e11b815260040160405180910390fd5b6000838152600560209081526040808320805461ffff19811661ffff91821688018216179091558151928301909152918152610a229133918691861690611941565b505050565b600081815260026020526040812080546060929190610a4590612913565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7190612913565b8015610abe5780601f10610a9357610100808354040283529160200191610abe565b820191906000526020600020905b815481529060010190602001808311610aa157829003601f168201915b505050505090506000610acf611ae6565b90506000825111610b27578051600003610af85760405180602001604052806000815250610b29565b80610b0285611b78565b604051602001610b139291906129d6565b604051602081830303815290604052610b29565b815b949350505050565b60008060005b6000818152600560209081526040808320815161012081018352905461ffff8082168352620100008204811694830194909452600160201b8104841692820192909252600160301b8204909216606083015263ffffffff600160401b820416608083015260ff600160601b82048116151560a0840152600160681b820416151560c08301526001600160481b03600160701b8204811660e08401819052600160b81b90920416610100830152909103610bf05750610c1a565b60208101518151610c019190612a05565b610c0f9061ffff1684612976565b925050600101610b37565b50919050565b610c28611bbc565b6001600160481b0384161580610c4557506001600160481b038316155b15610c63576040516306b7c75960e31b815260040160405180910390fd5b6000600354600103610c7757506001610d4f565b6000600560006001600354610c8c9190612a20565b81526020808201929092526040908101600020815161012081018352905461ffff8082168352620100008204811694830194909452600160201b8104841692820192909252600160301b82049092166060830181905263ffffffff600160401b8304166080840181905260ff600160601b84048116151560a0860152600160681b840416151560c08501526001600160481b03600160701b8404811660e0860152600160b81b909304909216610100840152919250610d4b9190612a33565b9150505b60408051610120810182526000808252602080830182815261ffff9a8b168486019081529b8b166060850190815263ffffffff9687166080860190815298151560a0860190815297151560c086019081526001600160481b039b8c1660e087019081529a8c1661010087019081526003805487526005909552969094209451855492519d5191519951985194519a5196518c16600160b81b026001600160b81b0397909c16600160701b0268ffffffffffffffffff60701b199b1515600160681b029b909b1669ffffffffffffffffffff60681b19951515600160601b0260ff60601b199a909916600160401b02999099166cffffffffff0000000000000000199a8e16600160301b0267ffff00000000000019938f16600160201b029390931667ffffffff00000000199f8f16620100000263ffffffff1990951692909e1691909117929092179c909c169a909a179a909a179590951697909717919091179290921617919091171617905580546001019055565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b610f2487878787878787611bd7565b50505050505050565b8061ffff16600003610f525760405163b562e8dd60e01b815260040160405180910390fd5b600082815260056020908152604091829020825161012081018452905461ffff8082168352620100008204811693830193909352600160201b8104831693820193909352600160301b8304909116606082015263ffffffff600160401b830416608082015260ff600160601b83048116151560a0830152600160681b830416151560c082018190526001600160481b03600160701b8404811660e0840152600160b81b9093049092166101008201529061101f57604051632644396160e21b815260040160405180910390fd5b61102e33848461ffff16611ddc565b6000838152600560205260408120805461ffff62010000808304821687019091160263ffff0000199091161790558390036110e2576040516340c10f1960e01b815233600482015261ffff831660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906340c10f1990604401600060405180830381600087803b1580156110ce57600080fd5b505af1158015610f24573d6000803e3d6000fd5b60005b8261ffff168110156111b3577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166340c10f193383856020015161ffff16866080015161113a9190612a33565b63ffffffff1661114a9190612976565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561119057600080fd5b505af11580156111a4573d6000803e3d6000fd5b505050508060010190506110e5565b50505050565b6000828152600560209081526040808320815161012081018352905461ffff8082168352620100008204811694830194909452600160201b8104841692820192909252600160301b8204909216606083015263ffffffff600160401b820416608083015260ff600160601b82048116151560a0840152600160681b820416151560c08301526001600160481b03600160701b8204811660e0840152600160b81b909104166101008201529061126f83600c612a50565b90508160a0015161129357604051631906009760e21b815260040160405180910390fd5b816040015161ffff166112a63386611917565b6112b49061ffff8416612976565b11156112d357604051636c80554560e11b815260040160405180910390fd5b8261ffff168261010001516112e89190612989565b6001600160481b0316341461131057604051632f4613eb60e01b815260040160405180910390fd5b816060015161ffff1682600001518261132991906129b4565b61ffff16111561134c57604051630f0c37b960e11b815260040160405180910390fd5b6000848152600560209081526040808320805461ffff19811661ffff918216870182161790915581519283019091529181526111b39133918791851690611941565b611396611bbc565b604051600090339047908381818185875af1925050503d80600081146113d8576040519150601f19603f3d011682016040523d82523d6000602084013e6113dd565b606091505b50509050806113ff57604051632684a07960e01b815260040160405180910390fd5b50565b606083821461141b5761141b63512509d360e11b6118d4565b60008467ffffffffffffffff81111561143657611436612545565b60405190808252806020026020018201604052801561145f578160200160208202803683370190505b50905060005b858110156114da576114b587878381811061148257611482612a6e565b90506020020160208101906114979190612886565b8686848181106114a9576114a9612a6e565b90506020020135610697565b8282815181106114c7576114c7612a6e565b6020908102919091010152600101611465565b5095945050505050565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b611528611bbc565b600083815260056020908152604091829020825161012081018452905461ffff808216808452620100008304821694840194909452600160201b8204811694830194909452600160301b81049093166060820181905263ffffffff600160401b850416608083015260ff600160601b85048116151560a0840152600160681b850416151560c08301526001600160481b03600160701b8504811660e0840152600160b81b90940490931661010082015291906115e490856129b4565b61ffff16111561160757604051630f0c37b960e11b815260040160405180910390fd5b6000848152600560209081526040808320805461ffff19811661ffff918216890182161790915581519283019091529181526111b39184918791871690611941565b611651611bbc565b61165a82611ea8565b15611678576040516347c0b78d60e01b815260040160405180910390fd5b61ffff90911660009081526005602052604090208054911515600160601b0260ff60601b19909216919091179055565b6116b0611bbc565b6116ba6000611f5d565b565b6001805461072590612913565b6116d1611bbc565b6004610a22828483612aca565b336000528160601b60601c600d60fc1b17602052604060002060005280602052602051600051558160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31602080a35050565b61ffff808216600090815260056020908152604080832081516101208101835290548086168083526201000082048716948301859052600160201b8204871693830193909352600160301b8104909516606082015263ffffffff600160401b860416608082015260ff600160601b86048116151560a0830152600160681b860416151560c08201526001600160481b03600160701b8604811660e0830152600160b81b9095049094166101008501529192916117f29190612a05565b61ffff169392505050565b611805611bbc565b61180e82611ea8565b1561182c576040516347c0b78d60e01b815260040160405180910390fd5b61ffff90911660009081526005602052604090208054911515600160681b0260ff60681b19909216919091179055565b611864611bbc565b63389a75e1600c52806000526020600c20805442111561188c57636f5e88186000526004601cfd5b600090556113ff81611f5d565b6118a68585858585611f9b565b5050505050565b6118b5611bbc565b8060601b6118cb57637448fbae6000526004601cfd5b6113ff81611f5d565b8060005260046000fd5b60008160031c8360601b60041c17600760fd1b1760005261ffff6007831660051b1b602060002054166007831660051b1c905092915050565b60006001600160a01b038316611937576119376323d3ad8160e21b6118d4565b6106c183836120f3565b60016001605f1b038311156119605761196063467777f160e11b6118d4565b6001600160a01b03841661197d5761197d622e076360e81b6118d4565b816000036119955761199563b562e8dd60e01b6118d4565b3360006119a286866118de565b905083810161ffff8111156119c1576119c1630b6cdf5d60e41b6118d4565b818110156119d9576119d9630b6cdf5d60e41b6118d4565b6119e4878783612139565b60006119f088886120f3565b905085810161ffff811115611a0f57611a0f630b6cdf5d60e41b6118d4565b81811015611a2757611a27630b6cdf5d60e41b6118d4565b611a738989838160031c8360601b60041c17600760fd1b1760005260206000206000528060101b6007831660051b1b6000515463ffff00006007851660051b1b19161760005155505050565b604051888152876020820152896000877fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506001600160a01b0389163b15611adb57611ac760008a8a8a8a61217a565b611adb57611adb639c05499b60e01b6118d4565b505050505050505050565b606060048054611af590612913565b80601f0160208091040260200160405190810160405280929190818152602001828054611b2190612913565b8015611b6e5780601f10611b4357610100808354040283529160200191611b6e565b820191906000526020600020905b815481529060010190602001808311611b5157829003601f168201915b5050505050905090565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611b925750819003601f19909101908152919050565b638b78c6d8195433146116ba576382b429006000526004601cfd5b6001600160a01b038616611bf557611bf5633a954ecd60e21b6118d4565b838214611c0c57611c0c63512509d360e11b6118d4565b6001600160a01b0387163314611c3a57611c2687336105a3565b611c3a57611c3a632ce44b5f60e11b6118d4565b3360005b85811015611d33576000878783818110611c5a57611c5a612a6e565b9050602002013590506000868684818110611c7757611c77612a6e565b90506020020135905060016001605f1b03821115611c9f57611c9f63467777f160e11b6118d4565b6000611cab8c846118de565b905080821115611cc557611cc563169b037b60e01b6118d4565b8a6001600160a01b03168c6001600160a01b031614611d25576000611cea8c856118de565b91839003918301905061ffff811115611d0d57611d0d630b6cdf5d60e41b6118d4565b611d188d8584612139565b611d238c8583612139565b505b836001019350505050611c3e565b50604051604081528560200260600160208201528560408201528560200287606083013783866020026060830101528360200285876020026080840101378789837f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8760400260800185a4506001600160a01b0387163b15611dd257611dbe8888888888888861225f565b611dd257611dd2639c05499b60e01b6118d4565b5050505050505050565b60016001605f1b03821115611dfb57611dfb63467777f160e11b6118d4565b6001600160a01b038316611e1957611e1963b817eee760e01b6118d4565b60408051602081019091526000908190523390611e3685856118de565b905080831115611e5057611e5063588569f760e01b6118d4565b829003611e5e858583612139565b604051848152836020820152600086847fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506040805160208101909152600090526118a6565b61ffff90811660009081526005602090815260409182902082516101208101845290548085168252620100008104851692820192909252600160201b8204841692810192909252600160301b8104909216606082015263ffffffff600160401b830416608082015260ff600160601b83048116151560a0830152600160681b830416151560c08201526001600160481b03600160701b8304811660e08301819052600160b81b90930416610100909101521590565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b60016001605f1b03831115611fba57611fba63467777f160e11b6118d4565b6001600160a01b038416611fd857611fd8633a954ecd60e21b6118d4565b6001600160a01b038516331461200657611ff285336105a3565b61200657612006632ce44b5f60e11b6118d4565b33600061201387866118de565b90508084111561202d5761202d63169b037b60e01b6118d4565b856001600160a01b0316876001600160a01b03161461208d57600061205287876118de565b91859003918501905061ffff81111561207557612075630b6cdf5d60e41b6118d4565b612080888784612139565b61208b878783612139565b505b6040518581528460208201528688847fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506001600160a01b0386163b15610f24576120df878787878761217a565b610f2457610f24639c05499b60e01b6118d4565b60008160031c8360601b60041c17600760fd1b1760005263ffff00006007831660051b1b602060002054166007831660051b1c60101c905092915050565b505050505050565b8160031c8360601b60041c17600760fd1b176000526020600020600052806007831660051b1b6000515461ffff6007851660051b1b19161760005155505050565b60405163f23a6e6160e01b81526000906001600160a01b0386169063f23a6e61906121b19033908a90899089908990600401612b8a565b6020604051808303816000875af19250505080156121ec575060408051601f3d908101601f191682019092526121e991810190612bc4565b60015b612241573d80801561221a576040519150601f19603f3d011682016040523d82523d6000602084013e61221f565b606091505b50805160000361223957612239639c05499b60e01b6118d4565b805181602001fd5b6001600160e01b03191663f23a6e6160e01b14905095945050505050565b60405163bc197c8160e01b81526000906001600160a01b0388169063bc197c819061229a9033908c908b908b908b908b908b90600401612c13565b6020604051808303816000875af19250505080156122d5575060408051601f3d908101601f191682019092526122d291810190612bc4565b60015b612303573d80801561221a576040519150601f19603f3d011682016040523d82523d6000602084013e61221f565b6001600160e01b03191663bc197c8160e01b1490505b979650505050505050565b80356001600160a01b038116811461233b57600080fd5b919050565b6000806040838503121561235357600080fd5b61235c83612324565b946020939093013593505050565b6001600160e01b0319811681146113ff57600080fd5b60006020828403121561239257600080fd5b813561239d8161236a565b9392505050565b6000602082840312156123b657600080fd5b5035919050565b60005b838110156123d85781810151838201526020016123c0565b50506000910152565b600081518084526123f98160208601602086016123bd565b601f01601f19169290920160200192915050565b6020815260006106c160208301846123e1565b803561ffff8116811461233b57600080fd5b6000806040838503121561244557600080fd5b8235915061245560208401612420565b90509250929050565b80356001600160481b038116811461233b57600080fd5b8035801515811461233b57600080fd5b60008060008060008060c0878903121561249e57600080fd5b6124a787612420565b95506124b560208801612420565b94506124c36040880161245e565b93506124d16060880161245e565b92506124df60808801612475565b91506124ed60a08801612475565b90509295509295509295565b60008083601f84011261250b57600080fd5b50813567ffffffffffffffff81111561252357600080fd5b6020830191508360208260051b850101111561253e57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261256c57600080fd5b813567ffffffffffffffff8082111561258757612587612545565b604051601f8301601f19908116603f011681019082821181831017156125af576125af612545565b816040528381528660208588010111156125c857600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600080600060a0888a03121561260357600080fd5b61260c88612324565b965061261a60208901612324565b9550604088013567ffffffffffffffff8082111561263757600080fd5b6126438b838c016124f9565b909750955060608a013591508082111561265c57600080fd5b6126688b838c016124f9565b909550935060808a013591508082111561268157600080fd5b5061268e8a828b0161255b565b91505092959891949750929550565b600080600080604085870312156126b357600080fd5b843567ffffffffffffffff808211156126cb57600080fd5b6126d7888389016124f9565b909650945060208701359150808211156126f057600080fd5b506126fd878288016124f9565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b8181101561274157835183529284019291840191600101612725565b50909695505050505050565b60008060006060848603121561276257600080fd5b8335925061277260208501612420565b915061278060408501612324565b90509250925092565b6000806040838503121561279c57600080fd5b6127a583612420565b915061245560208401612475565b600080602083850312156127c657600080fd5b823567ffffffffffffffff808211156127de57600080fd5b818501915085601f8301126127f257600080fd5b81358181111561280157600080fd5b86602082850101111561281357600080fd5b60209290920196919550909350505050565b6000806040838503121561283857600080fd5b6127a583612324565b60006020828403121561285357600080fd5b6106c182612420565b6000806040838503121561286f57600080fd5b61287883612324565b915061245560208401612324565b60006020828403121561289857600080fd5b6106c182612324565b600080600080600060a086880312156128b957600080fd5b6128c286612324565b94506128d060208701612324565b93506040860135925060608601359150608086013567ffffffffffffffff8111156128fa57600080fd5b6129068882890161255b565b9150509295509295909350565b600181811c9082168061292757607f821691505b602082108103610c1a57634e487b7160e01b600052602260045260246000fd5b60006020828403121561295957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156106c4576106c4612960565b6001600160481b038181168382160280821691908281146129ac576129ac612960565b505092915050565b61ffff8181168382160190808211156129cf576129cf612960565b5092915050565b600083516129e88184602088016123bd565b8351908301906129fc8183602088016123bd565b01949350505050565b61ffff8281168282160390808211156129cf576129cf612960565b818103818111156106c4576106c4612960565b63ffffffff8181168382160190808211156129cf576129cf612960565b61ffff8181168382160280821691908281146129ac576129ac612960565b634e487b7160e01b600052603260045260246000fd5b601f821115610a2257600081815260208120601f850160051c81016020861015612aab5750805b601f850160051c820191505b8181101561213157828155600101612ab7565b67ffffffffffffffff831115612ae257612ae2612545565b612af683612af08354612913565b83612a84565b6000601f841160018114612b2a5760008515612b125750838201355b600019600387901b1c1916600186901b1783556118a6565b600083815260209020601f19861690835b82811015612b5b5786850135825560209485019460019092019101612b3b565b5086821015612b785760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090612319908301846123e1565b600060208284031215612bd657600080fd5b815161239d8161236a565b81835260006001600160fb1b03831115612bfa57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0388811682528716602082015260a060408201819052600090612c409083018789612be1565b8281036060840152612c53818688612be1565b90508281036080840152612c6781856123e1565b9a995050505050505050505056fea26469706673582212203cf162223e75b4125ff891847e2ca0d7ec097c4b54a2fd3a89f4eab6056cd87164736f6c6343000815003360a06040523480156200001157600080fd5b506040516200165138038062001651833981016040819052620000349162000126565b6040518060400160405280601581526020017f41706576696e653a204d656d62657273204f6e6c7900000000000000000000008152506040518060400160405280600481526020016341564d4f60e01b81525081600290816200009891906200028a565b506003620000a782826200028a565b5050600160005550620000ba32620000d4565b336080526008620000cc82826200028a565b505062000356565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156200013a57600080fd5b82516001600160401b03808211156200015257600080fd5b818501915085601f8301126200016757600080fd5b8151818111156200017c576200017c62000110565b604051601f8201601f19908116603f01168101908382118183101715620001a757620001a762000110565b816040528281528886848701011115620001c057600080fd5b600093505b82841015620001e45784840186015181850187015292850192620001c5565b600086848301015280965050505050505092915050565b600181811c908216806200021057607f821691505b6020821081036200023157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200028557600081815260208120601f850160051c81016020861015620002605750805b601f850160051c820191505b8181101562000281578281556001016200026c565b5050505b505050565b81516001600160401b03811115620002a657620002a662000110565b620002be81620002b78454620001fb565b8462000237565b602080601f831160018114620002f65760008415620002dd5750858301515b600019600386901b1c1916600185901b17855562000281565b600085815260208120601f198616915b82811015620003275788860151825594840194600190910190840162000306565b5085821015620003465787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6080516112df6200037260003960006107ad01526112df6000f3fe6080604052600436106101405760003560e01c806370a08231116100b6578063b88d4fde1161006f578063b88d4fde1461031c578063c87b56dd1461032f578063e985e9c51461034f578063f04e283e14610398578063f2fde38b146103ab578063fee81cf4146103be57600080fd5b806370a0823114610286578063715018a6146102a65780638da5cb5b146102ae57806395d89b41146102c7578063a0bcfc7f146102dc578063a22cb465146102fc57600080fd5b806323b872dd1161010857806323b872dd14610210578063256929621461022357806340c10f191461022b57806342842e0e1461024b57806354d1f13d1461025e5780636352211e1461026657600080fd5b806301ffc9a71461014557806306fdde031461017a578063081812fc1461019c578063095ea7b3146101d457806318160ddd146101e9575b600080fd5b34801561015157600080fd5b50610165610160366004610dd6565b6103f1565b60405190151581526020015b60405180910390f35b34801561018657600080fd5b5061018f610443565b6040516101719190610e43565b3480156101a857600080fd5b506101bc6101b7366004610e56565b6104d5565b6040516001600160a01b039091168152602001610171565b6101e76101e2366004610e8b565b610519565b005b3480156101f557600080fd5b5060015460005403600019015b604051908152602001610171565b6101e761021e366004610eb5565b6105b9565b6101e7610752565b34801561023757600080fd5b506101e7610246366004610e8b565b6107a2565b6101e7610259366004610eb5565b6107f8565b6101e7610818565b34801561027257600080fd5b506101bc610281366004610e56565b610854565b34801561029257600080fd5b506102026102a1366004610ef1565b61085f565b6101e76108ae565b3480156102ba57600080fd5b50638b78c6d819546101bc565b3480156102d357600080fd5b5061018f6108c2565b3480156102e857600080fd5b506101e76102f7366004610f0c565b6108d1565b34801561030857600080fd5b506101e7610317366004610f7e565b6108e6565b6101e761032a366004610fd0565b610952565b34801561033b57600080fd5b5061018f61034a366004610e56565b61099c565b34801561035b57600080fd5b5061016561036a3660046110ac565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6101e76103a6366004610ef1565b610a20565b6101e76103b9366004610ef1565b610a60565b3480156103ca57600080fd5b506102026103d9366004610ef1565b63389a75e1600c908152600091909152602090205490565b60006301ffc9a760e01b6001600160e01b03198316148061042257506380ac58cd60e01b6001600160e01b03198316145b8061043d5750635b5e139f60e01b6001600160e01b03198316145b92915050565b606060028054610452906110df565b80601f016020809104026020016040519081016040528092919081815260200182805461047e906110df565b80156104cb5780601f106104a0576101008083540402835291602001916104cb565b820191906000526020600020905b8154815290600101906020018083116104ae57829003601f168201915b5050505050905090565b60006104e082610a87565b6104fd576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061052482610854565b9050336001600160a01b0382161461055d57610540813361036a565b61055d576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60006105c482610abc565b9050836001600160a01b0316816001600160a01b0316146105f75760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b0388169091141761064457610627863361036a565b61064457604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661066b57604051633a954ecd60e21b815260040160405180910390fd5b801561067657600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610708576001840160008181526004602052604081205490036107065760005481146107065760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107ea576040516282b42960e81b815260040160405180910390fd5b6107f48282610b2b565b5050565b61081383838360405180602001604052806000815250610952565b505050565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b600061043d82610abc565b60006001600160a01b038216610888576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6108b6610c29565b6108c06000610c44565b565b606060038054610452906110df565b6108d9610c29565b600861081382848361115f565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61095d8484846105b9565b6001600160a01b0383163b156109965761097984848484610c82565b610996576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b60606109a782610a87565b6109c457604051630a14c4b560e41b815260040160405180910390fd5b60006109ce610d6d565b905080516000036109ee5760405180602001604052806000815250610a19565b806109f884610d7c565b604051602001610a09929190611220565b6040516020818303038152906040525b9392505050565b610a28610c29565b63389a75e1600c52806000526020600c208054421115610a5057636f5e88186000526004601cfd5b60009055610a5d81610c44565b50565b610a68610c29565b8060601b610a7e57637448fbae6000526004601cfd5b610a5d81610c44565b600081600111158015610a9b575060005482105b801561043d575050600090815260046020526040902054600160e01b161590565b60008180600111610b1257600054811015610b125760008181526004602052604081205490600160e01b82169003610b10575b80600003610a19575060001901600081815260046020526040902054610aef565b505b604051636f96cda160e11b815260040160405180910390fd5b6000805490829003610b505760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b818114610bff57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101610bc7565b5081600003610c2057604051622e076360e81b815260040160405180910390fd5b60005550505050565b638b78c6d8195433146108c0576382b429006000526004601cfd5b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290610cb790339089908890889060040161124f565b6020604051808303816000875af1925050508015610cf2575060408051601f3d908101601f19168201909252610cef9181019061128c565b60015b610d50573d808015610d20576040519150601f19603f3d011682016040523d82523d6000602084013e610d25565b606091505b508051600003610d48576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b606060088054610452906110df565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480610d965750819003601f19909101908152919050565b6001600160e01b031981168114610a5d57600080fd5b600060208284031215610de857600080fd5b8135610a1981610dc0565b60005b83811015610e0e578181015183820152602001610df6565b50506000910152565b60008151808452610e2f816020860160208601610df3565b601f01601f19169290920160200192915050565b602081526000610a196020830184610e17565b600060208284031215610e6857600080fd5b5035919050565b80356001600160a01b0381168114610e8657600080fd5b919050565b60008060408385031215610e9e57600080fd5b610ea783610e6f565b946020939093013593505050565b600080600060608486031215610eca57600080fd5b610ed384610e6f565b9250610ee160208501610e6f565b9150604084013590509250925092565b600060208284031215610f0357600080fd5b610a1982610e6f565b60008060208385031215610f1f57600080fd5b823567ffffffffffffffff80821115610f3757600080fd5b818501915085601f830112610f4b57600080fd5b813581811115610f5a57600080fd5b866020828501011115610f6c57600080fd5b60209290920196919550909350505050565b60008060408385031215610f9157600080fd5b610f9a83610e6f565b915060208301358015158114610faf57600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215610fe657600080fd5b610fef85610e6f565b9350610ffd60208601610e6f565b925060408501359150606085013567ffffffffffffffff8082111561102157600080fd5b818701915087601f83011261103557600080fd5b81358181111561104757611047610fba565b604051601f8201601f19908116603f0116810190838211818310171561106f5761106f610fba565b816040528281528a602084870101111561108857600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600080604083850312156110bf57600080fd5b6110c883610e6f565b91506110d660208401610e6f565b90509250929050565b600181811c908216806110f357607f821691505b60208210810361111357634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561081357600081815260208120601f850160051c810160208610156111405750805b601f850160051c820191505b8181101561074a5782815560010161114c565b67ffffffffffffffff83111561117757611177610fba565b61118b8361118583546110df565b83611119565b6000601f8411600181146111bf57600085156111a75750838201355b600019600387901b1c1916600186901b178355611219565b600083815260209020601f19861690835b828110156111f057868501358255602094850194600190920191016111d0565b508682101561120d5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008351611232818460208801610df3565b835190830190611246818360208801610df3565b01949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061128290830184610e17565b9695505050505050565b60006020828403121561129e57600080fd5b8151610a1981610dc056fea26469706673582212202197d0e903a89d3e75bcb046cf1fc78b2f98bbc6b11344252ce57fa3aeb3ada164736f6c6343000815003360a06040523480156200001157600080fd5b506040516200140b3803806200140b8339810160408190526200003491620000ab565b6200003f3262000059565b3360805260006200005182826200020f565b5050620002db565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215620000bf57600080fd5b82516001600160401b0380821115620000d757600080fd5b818501915085601f830112620000ec57600080fd5b81518181111562000101576200010162000095565b604051601f8201601f19908116603f011681019083821181831017156200012c576200012c62000095565b8160405282815288868487010111156200014557600080fd5b600093505b828410156200016957848401860151818501870152928501926200014a565b600086848301015280965050505050505092915050565b600181811c908216806200019557607f821691505b602082108103620001b657634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200020a57600081815260208120601f850160051c81016020861015620001e55750805b601f850160051c820191505b818110156200020657828155600101620001f1565b5050505b505050565b81516001600160401b038111156200022b576200022b62000095565b62000243816200023c845462000180565b84620001bc565b602080601f8311600181146200027b5760008415620002625750858301515b600019600386901b1c1916600185901b17855562000206565b600085815260208120601f198616915b82811015620002ac578886015182559484019460019091019084016200028b565b5085821015620002cb5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051611114620002f7600039600061065d01526111146000f3fe60806040526004361061014b5760003560e01c806370a08231116100b6578063c87b56dd1161006f578063c87b56dd14610391578063e0df5b6f146103b1578063e985e9c5146103d1578063f04e283e14610407578063f2fde38b1461041a578063fee81cf41461042d57600080fd5b806370a08231146102f1578063715018a6146103115780638da5cb5b1461031957806395d89b4114610332578063a22cb4651461035e578063b88d4fde1461037e57600080fd5b806323b872dd1161010857806323b872dd1461027b578063256929621461028e57806340c10f191461029657806342842e0e146102b657806354d1f13d146102c95780636352211e146102d157600080fd5b806301ffc9a71461015057806306fdde03146101a2578063081812fc146101ea578063095ea7b3146102225780631535580e1461023757806318160ddd14610257575b600080fd5b34801561015c57600080fd5b5061018d61016b366004610ca5565b6301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b60405190151581526020015b60405180910390f35b3480156101ae57600080fd5b5060408051808201909152601681527541706556696e653a2050726f6f66204f662057696e6560501b60208201525b6040516101999190610cf3565b3480156101f657600080fd5b5061020a610205366004610d26565b610460565b6040516001600160a01b039091168152602001610199565b610235610230366004610d56565b61049f565b005b34801561024357600080fd5b50610235610252366004610d90565b6104d0565b34801561026357600080fd5b5061026d60025481565b604051908152602001610199565b610235610289366004610dab565b6104eb565b610235610602565b3480156102a257600080fd5b506102356102b1366004610d56565b610652565b6102356102c4366004610dab565b6106ad565b6102356106da565b3480156102dd57600080fd5b5061020a6102ec366004610d26565b610716565b3480156102fd57600080fd5b5061026d61030c366004610de7565b610754565b61023561078f565b34801561032557600080fd5b50638b78c6d8195461020a565b34801561033e57600080fd5b50604080518082019091526003815262504f5760e81b60208201526101dd565b34801561036a57600080fd5b50610235610379366004610e02565b6107a3565b61023561038c366004610e7e565b6107d0565b34801561039d57600080fd5b506101dd6103ac366004610d26565b61082b565b3480156103bd57600080fd5b506102356103cc366004610eed565b610950565b3480156103dd57600080fd5b5061018d6103ec366004610f2f565b601c52670a5a2e7a000000006008526000526030600c205490565b610235610415366004610de7565b610965565b610235610428366004610de7565b6109a5565b34801561043957600080fd5b5061026d610448366004610de7565b63389a75e1600c908152600091909152602090205490565b600081600052673ec412a9852d173d60c11b601c52602060002082018201805460601b6104955763ceea21b66000526004601cfd5b6001015492915050565b60015460ff166104c2576040516386d03c1160e01b815260040160405180910390fd5b6104cc82826109cc565b5050565b6104d86109d7565b6001805460ff1916911515919091179055565b6000818152673ec412a9852d173d60c11b3317601c52602090208101810180546001600160a01b039485169493841693811691908286148302610549578261053b5763ceea21b66000526004601cfd5b63a11481006000526004601cfd5b8461055c5763ea553b346000526004601cfd5b85600052816001015492508233148633141761058a576030600c205461058a57634b6e7f186000526004601cfd5b821561059857600082600101555b85851818905550601c600c8181208054600019019055600084905220805460010163ffffffff81166105d2576301336cea6000526004601cfd5b90558082847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600038a45b505050565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461069a576040516282b42960e81b815260040160405180910390fd5b6002805460010190556104cc82826109f2565b6106b88383836104eb565b813b156105fd576105fd83838360405180602001604052806000815250610aa0565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b6000818152673ec412a9852d173d60c11b601c526020902081018101546001600160a01b03168061074f5763ceea21b66000526004601cfd5b919050565b60008161076957638f4eb6046000526004601cfd5b673ec412a9852d173d60c11b601c528160005263ffffffff601c600c2054169050919050565b6107976109d7565b6107a16000610b2c565b565b60015460ff166107c6576040516386d03c1160e01b815260040160405180910390fd5b6104cc8282610b6a565b6107db8585856104eb565b833b156108245761082485858585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610aa092505050565b5050505050565b6060610855826000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b6108725760405163677510db60e11b815260040160405180910390fd5b600080805461088090610f59565b80601f01602080910402602001604051908101604052809291908181526020018280546108ac90610f59565b80156108f95780601f106108ce576101008083540402835291602001916108f9565b820191906000526020600020905b8154815290600101906020018083116108dc57829003601f168201915b50505050509050805160000361091e5760405180602001604052806000815250610949565b8061092884610bc0565b604051602001610939929190610f93565b6040516020818303038152906040525b9392505050565b6109586109d7565b60006105fd82848361101e565b61096d6109d7565b63389a75e1600c52806000526020600c20805442111561099557636f5e88186000526004601cfd5b600090556109a281610b2c565b50565b6109ad6109d7565b8060601b6109c357637448fbae6000526004601cfd5b6109a281610b2c565b6104cc338383610c04565b638b78c6d8195433146107a1576382b429006000526004601cfd5b6001600160a01b039091169081610a115763ea553b346000526004601cfd5b80600052673ec412a9852d173d60c11b601c5260206000208101810180548060601b15610a465763c991cbb16000526004601cfd5b831790556000829052601c600c20805460010163ffffffff8116610a72576301336cea6000526004601cfd5b9055808260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8138a45050565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a08401528015610ae7578060c08401826020870160045afa505b60208360a48301601c860160008a5af1610b0a573d15610b0a573d6000843e3d83fd5b508060e01b825114610b245763d1a57ed66000526004601cfd5b505050505050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b801515905081601c52670a5a2e7a0000000060085233600052806030600c2055806000528160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206000a35050565b60606080604051019050602081016040526000815280600019835b928101926030600a8206018453600a900480610bdb575050819003601f19909101908152919050565b60001960601c828116925083811693508160005283673ec412a9852d173d60c11b17601c5260206000208201820180548216915081610c4b5763ceea21b66000526004601cfd5b818514851517610c7157816000526030600c2054610c7157634b6e7f186000526004601cfd5b6001018390558183827f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600038a450505050565b600060208284031215610cb757600080fd5b81356001600160e01b03198116811461094957600080fd5b60005b83811015610cea578181015183820152602001610cd2565b50506000910152565b6020815260008251806020840152610d12816040850160208701610ccf565b601f01601f19169190910160400192915050565b600060208284031215610d3857600080fd5b5035919050565b80356001600160a01b038116811461074f57600080fd5b60008060408385031215610d6957600080fd5b610d7283610d3f565b946020939093013593505050565b8035801515811461074f57600080fd5b600060208284031215610da257600080fd5b61094982610d80565b600080600060608486031215610dc057600080fd5b610dc984610d3f565b9250610dd760208501610d3f565b9150604084013590509250925092565b600060208284031215610df957600080fd5b61094982610d3f565b60008060408385031215610e1557600080fd5b610e1e83610d3f565b9150610e2c60208401610d80565b90509250929050565b60008083601f840112610e4757600080fd5b50813567ffffffffffffffff811115610e5f57600080fd5b602083019150836020828501011115610e7757600080fd5b9250929050565b600080600080600060808688031215610e9657600080fd5b610e9f86610d3f565b9450610ead60208701610d3f565b935060408601359250606086013567ffffffffffffffff811115610ed057600080fd5b610edc88828901610e35565b969995985093965092949392505050565b60008060208385031215610f0057600080fd5b823567ffffffffffffffff811115610f1757600080fd5b610f2385828601610e35565b90969095509350505050565b60008060408385031215610f4257600080fd5b610f4b83610d3f565b9150610e2c60208401610d3f565b600181811c90821680610f6d57607f821691505b602082108103610f8d57634e487b7160e01b600052602260045260246000fd5b50919050565b60008351610fa5818460208801610ccf565b835190830190610fb9818360208801610ccf565b01949350505050565b634e487b7160e01b600052604160045260246000fd5b601f8211156105fd57600081815260208120601f850160051c81016020861015610fff5750805b601f850160051c820191505b81811015610b245782815560010161100b565b67ffffffffffffffff83111561103657611036610fc2565b61104a836110448354610f59565b83610fd8565b6000601f84116001811461107e57600085156110665750838201355b600019600387901b1c1916600186901b178355610824565b600083815260209020601f19861690835b828110156110af578685013582556020948501946001909201910161108f565b50868210156110cc5760001960f88860031b161c19848701351681555b505060018560011b018355505050505056fea2646970667358221220133c94831ec46bbfb91c87338c5a155db9974356b0c5becaf5323fc5e72d590564736f6c63430008150033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f62616679626569676c746837666c32726e7062773733626c75787136636f646772727962776235377861327478347a35646d757374686c783268652f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106101d75760003560e01c8063658e2daf11610102578063d639aebb11610095578063f16fcb4911610064578063f16fcb49146105fd578063f242432a14610631578063f2fde38b14610651578063fee81cf41461066457600080fd5b8063d639aebb14610568578063e985e9c514610588578063ea226a02146105ca578063f04e283e146105ea57600080fd5b80638da5cb5b116100d15780638da5cb5b146104fa57806395d89b4114610513578063a0bcfc7f14610528578063a22cb4651461054857600080fd5b8063658e2daf146104665780636b98ee54146104b25780636c96650f146104d2578063715018a6146104f257600080fd5b806324ed4be21161017a578063370ff6f011610149578063370ff6f0146104095780633ccfd60b1461041c5780634e1273f41461043157806354d1f13d1461045e57600080fd5b806324ed4be2146103a157806325692962146103c15780632eb2c2d6146103c957806330a55522146103e957600080fd5b806306fdde03116101b657806306fdde0314610335578063076adbae146103575780630e89341c1461036c57806318160ddd1461038c57600080fd5b8062fdd58e146101dc57806301ffc9a71461020f578063054cfe131461023f575b600080fd5b3480156101e857600080fd5b506101fc6101f7366004612340565b610697565b6040519081526020015b60405180910390f35b34801561021b57600080fd5b5061022f61022a366004612380565b6106ca565b6040519015158152602001610206565b34801561024b57600080fd5b506102d061025a3660046123a4565b60056020526000908152604090205461ffff80821691620100008104821691600160201b8204811691600160301b81049091169063ffffffff600160401b8204169060ff600160601b8204811691600160681b8104909116906001600160481b03600160701b8204811691600160b81b90041689565b6040805161ffff9a8b168152988a1660208a01529689169688019690965296909316606086015263ffffffff9091166080850152151560a0840152151560c08301526001600160481b0392831660e08301529190911661010082015261012001610206565b34801561034157600080fd5b5061034a610718565b604051610206919061240d565b61036a610365366004612432565b6107a6565b005b34801561037857600080fd5b5061034a6103873660046123a4565b610a27565b34801561039857600080fd5b506101fc610b31565b3480156103ad57600080fd5b5061036a6103bc366004612485565b610c20565b61036a610ec5565b3480156103d557600080fd5b5061036a6103e43660046125e8565b610f15565b3480156103f557600080fd5b5061036a610404366004612432565b610f2d565b61036a610417366004612432565b6111b9565b34801561042857600080fd5b5061036a61138e565b34801561043d57600080fd5b5061045161044c36600461269d565b611402565b6040516102069190612709565b61036a6114e4565b34801561047257600080fd5b5061049a7f000000000000000000000000ec06ef3db341e74d948929aae96c594357d1037381565b6040516001600160a01b039091168152602001610206565b3480156104be57600080fd5b5061036a6104cd36600461274d565b611520565b3480156104de57600080fd5b5061036a6104ed366004612789565b611649565b61036a6116a8565b34801561050657600080fd5b50638b78c6d8195461049a565b34801561051f57600080fd5b5061034a6116bc565b34801561053457600080fd5b5061036a6105433660046127b3565b6116c9565b34801561055457600080fd5b5061036a610563366004612825565b6116de565b34801561057457600080fd5b506101fc610583366004612841565b611736565b34801561059457600080fd5b5061022f6105a336600461285c565b6001600160a01b0391821660009081529116600d60fc1b1760205260408120908190525490565b3480156105d657600080fd5b5061036a6105e5366004612789565b6117fd565b61036a6105f8366004612886565b61185c565b34801561060957600080fd5b5061049a7f00000000000000000000000022423d63ab8d0727ae3e142f6cea01b4b7e482a681565b34801561063d57600080fd5b5061036a61064c3660046128a1565b611899565b61036a61065f366004612886565b6118ad565b34801561067057600080fd5b506101fc61067f366004612886565b63389a75e1600c908152600091909152602090205490565b60006001600160a01b0383166106b7576106b76323d3ad8160e21b6118d4565b6106c183836118de565b90505b92915050565b60006301ffc9a760e01b6001600160e01b0319831614806106fb5750636cdb3d1360e11b6001600160e01b03198316145b806106c45750506001600160e01b0319166303a24d0760e21b1490565b6000805461072590612913565b80601f016020809104026020016040519081016040528092919081815260200182805461075190612913565b801561079e5780601f106107735761010080835404028352916020019161079e565b820191906000526020600020905b81548152906001019060200180831161078157829003601f168201915b505050505081565b600082815260056020908152604091829020825161012081018452905461ffff8082168352620100008204811693830193909352600160201b8104831693820193909352600160301b8304909116606082015263ffffffff600160401b830416608082015260ff600160601b83048116151560a08301819052600160681b8404909116151560c08301526001600160481b03600160701b8404811660e0840152600160b81b9093049092166101008201529061087557604051631906009760e21b815260040160405180910390fd5b60008311801561090a57506040516370a0823160e01b81523360048201527f00000000000000000000000022423d63ab8d0727ae3e142f6cea01b4b7e482a66001600160a01b0316906370a0823190602401602060405180830381865afa1580156108e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109089190612947565b155b15610928576040516305031d1160e31b815260040160405180910390fd5b806040015161ffff1661093b3385611917565b6109499061ffff8516612976565b111561096857604051636c80554560e11b815260040160405180910390fd5b8161ffff168160e0015161097c9190612989565b6001600160481b031634146109a457604051632f4613eb60e01b815260040160405180910390fd5b806060015161ffff168160000151836109bd91906129b4565b61ffff1611156109e057604051630f0c37b960e11b815260040160405180910390fd5b6000838152600560209081526040808320805461ffff19811661ffff91821688018216179091558151928301909152918152610a229133918691861690611941565b505050565b600081815260026020526040812080546060929190610a4590612913565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7190612913565b8015610abe5780601f10610a9357610100808354040283529160200191610abe565b820191906000526020600020905b815481529060010190602001808311610aa157829003601f168201915b505050505090506000610acf611ae6565b90506000825111610b27578051600003610af85760405180602001604052806000815250610b29565b80610b0285611b78565b604051602001610b139291906129d6565b604051602081830303815290604052610b29565b815b949350505050565b60008060005b6000818152600560209081526040808320815161012081018352905461ffff8082168352620100008204811694830194909452600160201b8104841692820192909252600160301b8204909216606083015263ffffffff600160401b820416608083015260ff600160601b82048116151560a0840152600160681b820416151560c08301526001600160481b03600160701b8204811660e08401819052600160b81b90920416610100830152909103610bf05750610c1a565b60208101518151610c019190612a05565b610c0f9061ffff1684612976565b925050600101610b37565b50919050565b610c28611bbc565b6001600160481b0384161580610c4557506001600160481b038316155b15610c63576040516306b7c75960e31b815260040160405180910390fd5b6000600354600103610c7757506001610d4f565b6000600560006001600354610c8c9190612a20565b81526020808201929092526040908101600020815161012081018352905461ffff8082168352620100008204811694830194909452600160201b8104841692820192909252600160301b82049092166060830181905263ffffffff600160401b8304166080840181905260ff600160601b84048116151560a0860152600160681b840416151560c08501526001600160481b03600160701b8404811660e0860152600160b81b909304909216610100840152919250610d4b9190612a33565b9150505b60408051610120810182526000808252602080830182815261ffff9a8b168486019081529b8b166060850190815263ffffffff9687166080860190815298151560a0860190815297151560c086019081526001600160481b039b8c1660e087019081529a8c1661010087019081526003805487526005909552969094209451855492519d5191519951985194519a5196518c16600160b81b026001600160b81b0397909c16600160701b0268ffffffffffffffffff60701b199b1515600160681b029b909b1669ffffffffffffffffffff60681b19951515600160601b0260ff60601b199a909916600160401b02999099166cffffffffff0000000000000000199a8e16600160301b0267ffff00000000000019938f16600160201b029390931667ffffffff00000000199f8f16620100000263ffffffff1990951692909e1691909117929092179c909c169a909a179a909a179590951697909717919091179290921617919091171617905580546001019055565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b610f2487878787878787611bd7565b50505050505050565b8061ffff16600003610f525760405163b562e8dd60e01b815260040160405180910390fd5b600082815260056020908152604091829020825161012081018452905461ffff8082168352620100008204811693830193909352600160201b8104831693820193909352600160301b8304909116606082015263ffffffff600160401b830416608082015260ff600160601b83048116151560a0830152600160681b830416151560c082018190526001600160481b03600160701b8404811660e0840152600160b81b9093049092166101008201529061101f57604051632644396160e21b815260040160405180910390fd5b61102e33848461ffff16611ddc565b6000838152600560205260408120805461ffff62010000808304821687019091160263ffff0000199091161790558390036110e2576040516340c10f1960e01b815233600482015261ffff831660248201527f00000000000000000000000022423d63ab8d0727ae3e142f6cea01b4b7e482a66001600160a01b0316906340c10f1990604401600060405180830381600087803b1580156110ce57600080fd5b505af1158015610f24573d6000803e3d6000fd5b60005b8261ffff168110156111b3577f000000000000000000000000ec06ef3db341e74d948929aae96c594357d103736001600160a01b03166340c10f193383856020015161ffff16866080015161113a9190612a33565b63ffffffff1661114a9190612976565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561119057600080fd5b505af11580156111a4573d6000803e3d6000fd5b505050508060010190506110e5565b50505050565b6000828152600560209081526040808320815161012081018352905461ffff8082168352620100008204811694830194909452600160201b8104841692820192909252600160301b8204909216606083015263ffffffff600160401b820416608083015260ff600160601b82048116151560a0840152600160681b820416151560c08301526001600160481b03600160701b8204811660e0840152600160b81b909104166101008201529061126f83600c612a50565b90508160a0015161129357604051631906009760e21b815260040160405180910390fd5b816040015161ffff166112a63386611917565b6112b49061ffff8416612976565b11156112d357604051636c80554560e11b815260040160405180910390fd5b8261ffff168261010001516112e89190612989565b6001600160481b0316341461131057604051632f4613eb60e01b815260040160405180910390fd5b816060015161ffff1682600001518261132991906129b4565b61ffff16111561134c57604051630f0c37b960e11b815260040160405180910390fd5b6000848152600560209081526040808320805461ffff19811661ffff918216870182161790915581519283019091529181526111b39133918791851690611941565b611396611bbc565b604051600090339047908381818185875af1925050503d80600081146113d8576040519150601f19603f3d011682016040523d82523d6000602084013e6113dd565b606091505b50509050806113ff57604051632684a07960e01b815260040160405180910390fd5b50565b606083821461141b5761141b63512509d360e11b6118d4565b60008467ffffffffffffffff81111561143657611436612545565b60405190808252806020026020018201604052801561145f578160200160208202803683370190505b50905060005b858110156114da576114b587878381811061148257611482612a6e565b90506020020160208101906114979190612886565b8686848181106114a9576114a9612a6e565b90506020020135610697565b8282815181106114c7576114c7612a6e565b6020908102919091010152600101611465565b5095945050505050565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b611528611bbc565b600083815260056020908152604091829020825161012081018452905461ffff808216808452620100008304821694840194909452600160201b8204811694830194909452600160301b81049093166060820181905263ffffffff600160401b850416608083015260ff600160601b85048116151560a0840152600160681b850416151560c08301526001600160481b03600160701b8504811660e0840152600160b81b90940490931661010082015291906115e490856129b4565b61ffff16111561160757604051630f0c37b960e11b815260040160405180910390fd5b6000848152600560209081526040808320805461ffff19811661ffff918216890182161790915581519283019091529181526111b39184918791871690611941565b611651611bbc565b61165a82611ea8565b15611678576040516347c0b78d60e01b815260040160405180910390fd5b61ffff90911660009081526005602052604090208054911515600160601b0260ff60601b19909216919091179055565b6116b0611bbc565b6116ba6000611f5d565b565b6001805461072590612913565b6116d1611bbc565b6004610a22828483612aca565b336000528160601b60601c600d60fc1b17602052604060002060005280602052602051600051558160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31602080a35050565b61ffff808216600090815260056020908152604080832081516101208101835290548086168083526201000082048716948301859052600160201b8204871693830193909352600160301b8104909516606082015263ffffffff600160401b860416608082015260ff600160601b86048116151560a0830152600160681b860416151560c08201526001600160481b03600160701b8604811660e0830152600160b81b9095049094166101008501529192916117f29190612a05565b61ffff169392505050565b611805611bbc565b61180e82611ea8565b1561182c576040516347c0b78d60e01b815260040160405180910390fd5b61ffff90911660009081526005602052604090208054911515600160681b0260ff60681b19909216919091179055565b611864611bbc565b63389a75e1600c52806000526020600c20805442111561188c57636f5e88186000526004601cfd5b600090556113ff81611f5d565b6118a68585858585611f9b565b5050505050565b6118b5611bbc565b8060601b6118cb57637448fbae6000526004601cfd5b6113ff81611f5d565b8060005260046000fd5b60008160031c8360601b60041c17600760fd1b1760005261ffff6007831660051b1b602060002054166007831660051b1c905092915050565b60006001600160a01b038316611937576119376323d3ad8160e21b6118d4565b6106c183836120f3565b60016001605f1b038311156119605761196063467777f160e11b6118d4565b6001600160a01b03841661197d5761197d622e076360e81b6118d4565b816000036119955761199563b562e8dd60e01b6118d4565b3360006119a286866118de565b905083810161ffff8111156119c1576119c1630b6cdf5d60e41b6118d4565b818110156119d9576119d9630b6cdf5d60e41b6118d4565b6119e4878783612139565b60006119f088886120f3565b905085810161ffff811115611a0f57611a0f630b6cdf5d60e41b6118d4565b81811015611a2757611a27630b6cdf5d60e41b6118d4565b611a738989838160031c8360601b60041c17600760fd1b1760005260206000206000528060101b6007831660051b1b6000515463ffff00006007851660051b1b19161760005155505050565b604051888152876020820152896000877fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506001600160a01b0389163b15611adb57611ac760008a8a8a8a61217a565b611adb57611adb639c05499b60e01b6118d4565b505050505050505050565b606060048054611af590612913565b80601f0160208091040260200160405190810160405280929190818152602001828054611b2190612913565b8015611b6e5780601f10611b4357610100808354040283529160200191611b6e565b820191906000526020600020905b815481529060010190602001808311611b5157829003601f168201915b5050505050905090565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611b925750819003601f19909101908152919050565b638b78c6d8195433146116ba576382b429006000526004601cfd5b6001600160a01b038616611bf557611bf5633a954ecd60e21b6118d4565b838214611c0c57611c0c63512509d360e11b6118d4565b6001600160a01b0387163314611c3a57611c2687336105a3565b611c3a57611c3a632ce44b5f60e11b6118d4565b3360005b85811015611d33576000878783818110611c5a57611c5a612a6e565b9050602002013590506000868684818110611c7757611c77612a6e565b90506020020135905060016001605f1b03821115611c9f57611c9f63467777f160e11b6118d4565b6000611cab8c846118de565b905080821115611cc557611cc563169b037b60e01b6118d4565b8a6001600160a01b03168c6001600160a01b031614611d25576000611cea8c856118de565b91839003918301905061ffff811115611d0d57611d0d630b6cdf5d60e41b6118d4565b611d188d8584612139565b611d238c8583612139565b505b836001019350505050611c3e565b50604051604081528560200260600160208201528560408201528560200287606083013783866020026060830101528360200285876020026080840101378789837f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8760400260800185a4506001600160a01b0387163b15611dd257611dbe8888888888888861225f565b611dd257611dd2639c05499b60e01b6118d4565b5050505050505050565b60016001605f1b03821115611dfb57611dfb63467777f160e11b6118d4565b6001600160a01b038316611e1957611e1963b817eee760e01b6118d4565b60408051602081019091526000908190523390611e3685856118de565b905080831115611e5057611e5063588569f760e01b6118d4565b829003611e5e858583612139565b604051848152836020820152600086847fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506040805160208101909152600090526118a6565b61ffff90811660009081526005602090815260409182902082516101208101845290548085168252620100008104851692820192909252600160201b8204841692810192909252600160301b8104909216606082015263ffffffff600160401b830416608082015260ff600160601b83048116151560a0830152600160681b830416151560c08201526001600160481b03600160701b8304811660e08301819052600160b81b90930416610100909101521590565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b60016001605f1b03831115611fba57611fba63467777f160e11b6118d4565b6001600160a01b038416611fd857611fd8633a954ecd60e21b6118d4565b6001600160a01b038516331461200657611ff285336105a3565b61200657612006632ce44b5f60e11b6118d4565b33600061201387866118de565b90508084111561202d5761202d63169b037b60e01b6118d4565b856001600160a01b0316876001600160a01b03161461208d57600061205287876118de565b91859003918501905061ffff81111561207557612075630b6cdf5d60e41b6118d4565b612080888784612139565b61208b878783612139565b505b6040518581528460208201528688847fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62604085a4506001600160a01b0386163b15610f24576120df878787878761217a565b610f2457610f24639c05499b60e01b6118d4565b60008160031c8360601b60041c17600760fd1b1760005263ffff00006007831660051b1b602060002054166007831660051b1c60101c905092915050565b505050505050565b8160031c8360601b60041c17600760fd1b176000526020600020600052806007831660051b1b6000515461ffff6007851660051b1b19161760005155505050565b60405163f23a6e6160e01b81526000906001600160a01b0386169063f23a6e61906121b19033908a90899089908990600401612b8a565b6020604051808303816000875af19250505080156121ec575060408051601f3d908101601f191682019092526121e991810190612bc4565b60015b612241573d80801561221a576040519150601f19603f3d011682016040523d82523d6000602084013e61221f565b606091505b50805160000361223957612239639c05499b60e01b6118d4565b805181602001fd5b6001600160e01b03191663f23a6e6160e01b14905095945050505050565b60405163bc197c8160e01b81526000906001600160a01b0388169063bc197c819061229a9033908c908b908b908b908b908b90600401612c13565b6020604051808303816000875af19250505080156122d5575060408051601f3d908101601f191682019092526122d291810190612bc4565b60015b612303573d80801561221a576040519150601f19603f3d011682016040523d82523d6000602084013e61221f565b6001600160e01b03191663bc197c8160e01b1490505b979650505050505050565b80356001600160a01b038116811461233b57600080fd5b919050565b6000806040838503121561235357600080fd5b61235c83612324565b946020939093013593505050565b6001600160e01b0319811681146113ff57600080fd5b60006020828403121561239257600080fd5b813561239d8161236a565b9392505050565b6000602082840312156123b657600080fd5b5035919050565b60005b838110156123d85781810151838201526020016123c0565b50506000910152565b600081518084526123f98160208601602086016123bd565b601f01601f19169290920160200192915050565b6020815260006106c160208301846123e1565b803561ffff8116811461233b57600080fd5b6000806040838503121561244557600080fd5b8235915061245560208401612420565b90509250929050565b80356001600160481b038116811461233b57600080fd5b8035801515811461233b57600080fd5b60008060008060008060c0878903121561249e57600080fd5b6124a787612420565b95506124b560208801612420565b94506124c36040880161245e565b93506124d16060880161245e565b92506124df60808801612475565b91506124ed60a08801612475565b90509295509295509295565b60008083601f84011261250b57600080fd5b50813567ffffffffffffffff81111561252357600080fd5b6020830191508360208260051b850101111561253e57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261256c57600080fd5b813567ffffffffffffffff8082111561258757612587612545565b604051601f8301601f19908116603f011681019082821181831017156125af576125af612545565b816040528381528660208588010111156125c857600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600080600060a0888a03121561260357600080fd5b61260c88612324565b965061261a60208901612324565b9550604088013567ffffffffffffffff8082111561263757600080fd5b6126438b838c016124f9565b909750955060608a013591508082111561265c57600080fd5b6126688b838c016124f9565b909550935060808a013591508082111561268157600080fd5b5061268e8a828b0161255b565b91505092959891949750929550565b600080600080604085870312156126b357600080fd5b843567ffffffffffffffff808211156126cb57600080fd5b6126d7888389016124f9565b909650945060208701359150808211156126f057600080fd5b506126fd878288016124f9565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b8181101561274157835183529284019291840191600101612725565b50909695505050505050565b60008060006060848603121561276257600080fd5b8335925061277260208501612420565b915061278060408501612324565b90509250925092565b6000806040838503121561279c57600080fd5b6127a583612420565b915061245560208401612475565b600080602083850312156127c657600080fd5b823567ffffffffffffffff808211156127de57600080fd5b818501915085601f8301126127f257600080fd5b81358181111561280157600080fd5b86602082850101111561281357600080fd5b60209290920196919550909350505050565b6000806040838503121561283857600080fd5b6127a583612324565b60006020828403121561285357600080fd5b6106c182612420565b6000806040838503121561286f57600080fd5b61287883612324565b915061245560208401612324565b60006020828403121561289857600080fd5b6106c182612324565b600080600080600060a086880312156128b957600080fd5b6128c286612324565b94506128d060208701612324565b93506040860135925060608601359150608086013567ffffffffffffffff8111156128fa57600080fd5b6129068882890161255b565b9150509295509295909350565b600181811c9082168061292757607f821691505b602082108103610c1a57634e487b7160e01b600052602260045260246000fd5b60006020828403121561295957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156106c4576106c4612960565b6001600160481b038181168382160280821691908281146129ac576129ac612960565b505092915050565b61ffff8181168382160190808211156129cf576129cf612960565b5092915050565b600083516129e88184602088016123bd565b8351908301906129fc8183602088016123bd565b01949350505050565b61ffff8281168282160390808211156129cf576129cf612960565b818103818111156106c4576106c4612960565b63ffffffff8181168382160190808211156129cf576129cf612960565b61ffff8181168382160280821691908281146129ac576129ac612960565b634e487b7160e01b600052603260045260246000fd5b601f821115610a2257600081815260208120601f850160051c81016020861015612aab5750805b601f850160051c820191505b8181101561213157828155600101612ab7565b67ffffffffffffffff831115612ae257612ae2612545565b612af683612af08354612913565b83612a84565b6000601f841160018114612b2a5760008515612b125750838201355b600019600387901b1c1916600186901b1783556118a6565b600083815260209020601f19861690835b82811015612b5b5786850135825560209485019460019092019101612b3b565b5086821015612b785760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090612319908301846123e1565b600060208284031215612bd657600080fd5b815161239d8161236a565b81835260006001600160fb1b03831115612bfa57600080fd5b8260051b80836020870137939093016020019392505050565b6001600160a01b0388811682528716602082015260a060408201819052600090612c409083018789612be1565b8281036060840152612c53818688612be1565b90508281036080840152612c6781856123e1565b9a995050505050505050505056fea26469706673582212203cf162223e75b4125ff891847e2ca0d7ec097c4b54a2fd3a89f4eab6056cd87164736f6c63430008150033

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

000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f62616679626569676c746837666c32726e7062773733626c75787136636f646772727962776235377861327478347a35646d757374686c783268652f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : vouchersUri (string): ipfs://bafybeiglth7fl2rnpbw73bluxq6codgrrybwb57xa2tx4z5dmusthlx2he/
Arg [1] : membersOnlyUri (string):
Arg [2] : proofOfWineUri (string):

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [4] : 697066733a2f2f62616679626569676c746837666c32726e7062773733626c75
Arg [5] : 787136636f646772727962776235377861327478347a35646d757374686c7832
Arg [6] : 68652f0000000000000000000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.