ETH Price: $3,045.46 (+0.72%)
Gas: 3 Gwei

Token

ArcanaHQ (ARCHQ)
 

Overview

Max Total Supply

2,759 ARCHQ

Holders

627

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Filtered by Token Holder
19969697.eth
Balance
1 ARCHQ
0xbec371afdf1e736bd2f4ad452ff4d8fc760515ae
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:
ArcanaHQ

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 19 : 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 packed) {
        if (_startTokenId() <= tokenId) {
            packed = _packedOwnerships[tokenId];
            // If not burned.
            if (packed & _BITMASK_BURNED == 0) {
                // If the data at the starting slot does not exist, start the scan.
                if (packed == 0) {
                    if (tokenId >= _currentIndex) revert OwnerQueryForNonexistentToken();
                    // Invariant:
                    // There will always be an initialized ownership slot
                    // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                    // before an unintialized ownership slot
                    // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                    // Hence, `tokenId` will not underflow.
                    //
                    // We can directly compare the packed value.
                    // If the address is zero, packed will be zero.
                    for (;;) {
                        unchecked {
                            packed = _packedOwnerships[--tokenId];
                        }
                        if (packed == 0) continue;
                        return packed;
                    }
                }
                // Otherwise, the data exists and is not burned. We can skip the scan.
                // This is possible because we have already achieved the target condition.
                // This saves 2143 gas on transfers of initialized tokens.
                return packed;
            }
        }
        revert OwnerQueryForNonexistentToken();
    }

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

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

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

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

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     */
    function approve(address to, uint256 tokenId) public payable virtual override {
        _approve(to, tokenId, true);
    }

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

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

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

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

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

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

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

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

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

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

        address from = address(uint160(prevOwnershipPacked));

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

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

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

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

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // Updates:
            // - `balance -= 1`.
            // - `numberBurned += 1`.
            //
            // We can directly decrement the balance, and increment the number burned.
            // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
            _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 2 of 19 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.4;

import './IERC721ABurnable.sol';
import '../ERC721A.sol';

/**
 * @title ERC721ABurnable.
 *
 * @dev ERC721A token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721ABurnable is ERC721A, IERC721ABurnable {
    /**
     * @dev Burns `tokenId`. See {ERC721A-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual override {
        _burn(tokenId, true);
    }
}

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

pragma solidity ^0.8.4;

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

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

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

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

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(`totalSupply`) in complexity.
     * It is meant to be called off-chain.
     *
     * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
     * multiple smaller scans if the collection is large enough to cause
     * an out-of-gas error (10K collections should be fine).
     */
    function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) {
        unchecked {
            uint256 tokenIdsIdx;
            address currOwnershipAddr;
            uint256 tokenIdsLength = balanceOf(owner);
            uint256[] memory tokenIds = new uint256[](tokenIdsLength);
            TokenOwnership memory ownership;
            for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
                ownership = _ownershipAt(i);
                if (ownership.burned) {
                    continue;
                }
                if (ownership.addr != address(0)) {
                    currOwnershipAddr = ownership.addr;
                }
                if (currOwnershipAddr == owner) {
                    tokenIds[tokenIdsIdx++] = i;
                }
            }
            return tokenIds;
        }
    }
}

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

pragma solidity ^0.8.4;

import '../IERC721A.sol';

/**
 * @dev Interface of ERC721ABurnable.
 */
interface IERC721ABurnable is IERC721A {
    /**
     * @dev Burns `tokenId`. See {ERC721A-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) external;
}

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

pragma solidity ^0.8.4;

import '../IERC721A.sol';

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

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

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

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

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(`totalSupply`) in complexity.
     * It is meant to be called off-chain.
     *
     * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into
     * multiple smaller scans if the collection is large enough to cause
     * an out-of-gas error (10K collections should be fine).
     */
    function tokensOfOwner(address owner) external view returns (uint256[] memory);
}

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

/// @notice Optimized and flexible operator filterer to abide to OpenSea's
/// mandatory on-chain royalty enforcement in order for new collections to
/// receive royalties.
/// For more information, see:
/// See: https://github.com/ProjectOpenSea/operator-filter-registry
abstract contract OperatorFilterer {
    /// @dev The default OpenSea operator blocklist subscription.
    address internal constant _DEFAULT_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;

    /// @dev The OpenSea operator filter registry.
    address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;

    /// @dev Registers the current contract to OpenSea's operator filter,
    /// and subscribe to the default OpenSea operator blocklist.
    /// Note: Will not revert nor update existing settings for repeated registration.
    function _registerForOperatorFiltering() internal virtual {
        _registerForOperatorFiltering(_DEFAULT_SUBSCRIPTION, true);
    }

    /// @dev Registers the current contract to OpenSea's operator filter.
    /// Note: Will not revert nor update existing settings for repeated registration.
    function _registerForOperatorFiltering(address subscriptionOrRegistrantToCopy, bool subscribe) internal virtual {
        /// @solidity memory-safe-assembly
        assembly {
            let functionSelector := 0x7d3e3dbe // `registerAndSubscribe(address,address)`.

            // Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty.
            subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
            // prettier-ignore
            for {} iszero(subscribe) {} {
                if iszero(subscriptionOrRegistrantToCopy) {
                    functionSelector := 0x4420e486 // `register(address)`.
                    break
                }
                functionSelector := 0xa0af2903 // `registerAndCopyEntries(address,address)`.
                break
            }
            // Store the function selector.
            mstore(0x00, shl(224, functionSelector))
            // Store the `address(this)`.
            mstore(0x04, address())
            // Store the `subscriptionOrRegistrantToCopy`.
            mstore(0x24, subscriptionOrRegistrantToCopy)
            // Register into the registry.
            pop(call(gas(), _OPERATOR_FILTER_REGISTRY, 0, 0x00, 0x44, 0x00, 0x00))
            // Restore the part of the free memory pointer that was overwritten,
            // which is guaranteed to be zero, because of Solidity's memory size limits.
            mstore(0x24, 0)
        }
    }

    /// @dev Modifier to guard a function and revert if the caller is a blocked operator.
    modifier onlyAllowedOperator(address from) virtual {
        if (from != msg.sender)
            if (!_isPriorityOperator(msg.sender))
                if (_operatorFilteringEnabled()) _revertIfBlocked(msg.sender);
        _;
    }

    /// @dev Modifier to guard a function from approving a blocked operator..
    modifier onlyAllowedOperatorApproval(address operator) virtual {
        if (!_isPriorityOperator(operator))
            if (_operatorFilteringEnabled()) _revertIfBlocked(operator);
        _;
    }

    /// @dev Helper function that reverts if the `operator` is blocked by the registry.
    function _revertIfBlocked(address operator) private view {
        /// @solidity memory-safe-assembly
        assembly {
            // Store the function selector of `isOperatorAllowed(address,address)`,
            // shifted left by 6 bytes, which is enough for 8tb of memory.
            // We waste 6-3 = 3 bytes to save on 6 runtime gas (PUSH1 0x224 SHL).
            mstore(0x00, 0xc6171134001122334455)
            // Store the `address(this)`.
            mstore(0x1a, address())
            // Store the `operator`.
            mstore(0x3a, operator)

            // `isOperatorAllowed` always returns true if it does not revert.
            if iszero(staticcall(gas(), _OPERATOR_FILTER_REGISTRY, 0x16, 0x44, 0x00, 0x00)) {
                // Bubble up the revert if the staticcall reverts.
                returndatacopy(0x00, 0x00, returndatasize())
                revert(0x00, returndatasize())
            }

            // We'll skip checking if `from` is inside the blacklist.
            // Even though that can block transferring out of wrapper contracts,
            // we don't want tokens to be stuck.

            // Restore the part of the free memory pointer that was overwritten,
            // which is guaranteed to be zero, if less than 8tb of memory is used.
            mstore(0x3a, 0)
        }
    }

    /// @dev For deriving contracts to override, so that operator filtering
    /// can be turned on / off.
    /// Returns true by default.
    function _operatorFilteringEnabled() internal view virtual returns (bool) {
        return true;
    }

    /// @dev For deriving contracts to override, so that preferred marketplaces can
    /// skip operator filtering, helping users save gas.
    /// Returns false for all inputs by default.
    function _isPriorityOperator(address) internal view virtual returns (bool) {
        return false;
    }
}

File 8 of 19 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 9 of 19 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165.sol";

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

        return (royalty.receiver, royaltyAmount);
    }

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

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

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

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

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

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

File 11 of 19 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 12 of 19 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 13 of 19 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 14 of 19 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 15 of 19 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 16 of 19 : ECDSA.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Gas optimized ECDSA wrapper.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ECDSA.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ECDSA.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol)
library ECDSA {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         CONSTANTS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The number which `s` must not exceed in order for
    /// the signature to be non-malleable.
    bytes32 private constant _MALLEABILITY_THRESHOLD =
        0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0;

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

    /// @dev Recovers the signer's address from a message digest `hash`,
    /// and the `signature`.
    ///
    /// This function does NOT accept EIP-2098 short form signatures.
    /// Use `recover(bytes32 hash, bytes32 r, bytes32 vs)` for EIP-2098
    /// short form signatures instead.
    ///
    /// WARNING!
    /// The `result` will be the zero address upon recovery failure.
    /// As such, it is extremely important to ensure that the address which
    /// the `result` is compared against is never zero.
    function recover(bytes32 hash, bytes calldata signature)
        internal
        view
        returns (address result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            if eq(signature.length, 65) {
                // Copy the free memory pointer so that we can restore it later.
                let m := mload(0x40)
                // Directly copy `r` and `s` from the calldata.
                calldatacopy(0x40, signature.offset, 0x40)

                // If `s` in lower half order, such that the signature is not malleable.
                if iszero(gt(mload(0x60), _MALLEABILITY_THRESHOLD)) {
                    mstore(0x00, hash)
                    // Compute `v` and store it in the scratch space.
                    mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40))))
                    pop(
                        staticcall(
                            gas(), // Amount of gas left for the transaction.
                            0x01, // Address of `ecrecover`.
                            0x00, // Start of input.
                            0x80, // Size of input.
                            0x40, // Start of output.
                            0x20 // Size of output.
                        )
                    )
                    // Restore the zero slot.
                    mstore(0x60, 0)
                    // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
                    result := mload(sub(0x60, returndatasize()))
                }
                // Restore the free memory pointer.
                mstore(0x40, m)
            }
        }
    }

    /// @dev Recovers the signer's address from a message digest `hash`,
    /// and the EIP-2098 short form signature defined by `r` and `vs`.
    ///
    /// This function only accepts EIP-2098 short form signatures.
    /// See: https://eips.ethereum.org/EIPS/eip-2098
    ///
    /// To be honest, I do not recommend using EIP-2098 signatures
    /// for simplicity, performance, and security reasons. Most if not
    /// all clients support traditional non EIP-2098 signatures by default.
    /// As such, this method is intentionally not fully inlined.
    /// It is merely included for completeness.
    ///
    /// WARNING!
    /// The `result` will be the zero address upon recovery failure.
    /// As such, it is extremely important to ensure that the address which
    /// the `result` is compared against is never zero.
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal view returns (address result) {
        uint8 v;
        bytes32 s;
        /// @solidity memory-safe-assembly
        assembly {
            s := shr(1, shl(1, vs))
            v := add(shr(255, vs), 27)
        }
        result = recover(hash, v, r, s);
    }

    /// @dev Recovers the signer's address from a message digest `hash`,
    /// and the signature defined by `v`, `r`, `s`.
    ///
    /// WARNING!
    /// The `result` will be the zero address upon recovery failure.
    /// As such, it is extremely important to ensure that the address which
    /// the `result` is compared against is never zero.
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
        internal
        view
        returns (address result)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Copy the free memory pointer so that we can restore it later.
            let m := mload(0x40)

            // If `s` in lower half order, such that the signature is not malleable.
            if iszero(gt(s, _MALLEABILITY_THRESHOLD)) {
                mstore(0x00, hash)
                mstore(0x20, v)
                mstore(0x40, r)
                mstore(0x60, s)
                pop(
                    staticcall(
                        gas(), // Amount of gas left for the transaction.
                        0x01, // Address of `ecrecover`.
                        0x00, // Start of input.
                        0x80, // Size of input.
                        0x40, // Start of output.
                        0x20 // Size of output.
                    )
                )
                // Restore the zero slot.
                mstore(0x60, 0)
                // `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
                result := mload(sub(0x60, returndatasize()))
            }
            // Restore the free memory pointer.
            mstore(0x40, m)
        }
    }

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

    /// @dev Returns an Ethereum Signed Message, created from a `hash`.
    /// This produces a hash corresponding to the one signed with the
    /// [`eth_sign`](https://eth.wiki/json-rpc/API#eth_sign)
    /// JSON-RPC method as part of EIP-191.
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) {
        /// @solidity memory-safe-assembly
        assembly {
            // Store into scratch space for keccak256.
            mstore(0x20, hash)
            mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32")
            // 0x40 - 0x04 = 0x3c
            result := keccak256(0x04, 0x3c)
        }
    }

    /// @dev Returns an Ethereum Signed Message, created from `s`.
    /// This produces a hash corresponding to the one signed with the
    /// [`eth_sign`](https://eth.wiki/json-rpc/API#eth_sign)
    /// JSON-RPC method as part of EIP-191.
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) {
        assembly {
            // We need at most 128 bytes for Ethereum signed message header.
            // The max length of the ASCII reprenstation of a uint256 is 78 bytes.
            // The length of "\x19Ethereum Signed Message:\n" is 26 bytes (i.e. 0x1a).
            // The next multiple of 32 above 78 + 26 is 128 (i.e. 0x80).

            // Instead of allocating, we temporarily copy the 128 bytes before the
            // start of `s` data to some variables.
            let m3 := mload(sub(s, 0x60))
            let m2 := mload(sub(s, 0x40))
            let m1 := mload(sub(s, 0x20))
            // The length of `s` is in bytes.
            let sLength := mload(s)

            let ptr := add(s, 0x20)

            // `end` marks the end of the memory which we will compute the keccak256 of.
            let end := add(ptr, sLength)

            // Convert the length of the bytes to ASCII decimal representation
            // and store it into the memory.
            for { let temp := sLength } 1 {} {
                ptr := sub(ptr, 1)
                mstore8(ptr, add(48, mod(temp, 10)))
                temp := div(temp, 10)
                if iszero(temp) { break }
            }

            // Copy the header over to the memory.
            mstore(sub(ptr, 0x20), "\x00\x00\x00\x00\x00\x00\x19Ethereum Signed Message:\n")
            // Compute the keccak256 of the memory.
            result := keccak256(sub(ptr, 0x1a), sub(end, sub(ptr, 0x1a)))

            // Restore the previous memory.
            mstore(s, sLength)
            mstore(sub(s, 0x20), m1)
            mstore(sub(s, 0x40), m2)
            mstore(sub(s, 0x60), m3)
        }
    }
}

File 17 of 19 : MerkleProofLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)
library MerkleProofLib {
    /// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`.
    function verify(bytes32[] calldata proof, bytes32 root, bytes32 leaf)
        internal
        pure
        returns (bool isValid)
    {
        /// @solidity memory-safe-assembly
        assembly {
            if proof.length {
                // Left shift by 5 is equivalent to multiplying by 0x20.
                let end := add(proof.offset, shl(5, proof.length))
                // Initialize `offset` to the offset of `proof` in the calldata.
                let offset := proof.offset
                // Iterate over proof elements to compute root hash.
                for {} 1 {} {
                    // Slot of `leaf` in scratch space.
                    // If the condition is true: 0x20, otherwise: 0x00.
                    let scratch := shl(5, gt(leaf, calldataload(offset)))
                    // Store elements to hash contiguously in scratch space.
                    // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
                    mstore(scratch, leaf)
                    mstore(xor(scratch, 0x20), calldataload(offset))
                    // Reuse `leaf` to store the hash to reduce stack operations.
                    leaf := keccak256(0x00, 0x40)
                    offset := add(offset, 0x20)
                    if iszero(lt(offset, end)) { break }
                }
            }
            isValid := eq(leaf, root)
        }
    }

    /// @dev Returns whether all `leafs` exist in the Merkle tree with `root`,
    /// given `proof` and `flags`.
    function verifyMultiProof(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32[] calldata leafs,
        bool[] calldata flags
    ) internal pure returns (bool isValid) {
        // Rebuilds the root by consuming and producing values on a queue.
        // The queue starts with the `leafs` array, and goes into a `hashes` array.
        // After the process, the last element on the queue is verified
        // to be equal to the `root`.
        //
        // The `flags` array denotes whether the sibling
        // should be popped from the queue (`flag == true`), or
        // should be popped from the `proof` (`flag == false`).
        /// @solidity memory-safe-assembly
        assembly {
            // If the number of flags is correct.
            for {} eq(add(leafs.length, proof.length), add(flags.length, 1)) {} {
                // For the case where `proof.length + leafs.length == 1`.
                if iszero(flags.length) {
                    // `isValid = (proof.length == 1 ? proof[0] : leafs[0]) == root`.
                    // forgefmt: disable-next-item
                    isValid := eq(
                        calldataload(
                            xor(leafs.offset, mul(xor(proof.offset, leafs.offset), proof.length))
                        ),
                        root
                    )
                    break
                }

                // We can use the free memory space for the queue.
                // We don't need to allocate, since the queue is temporary.
                let hashesFront := mload(0x40)
                // Copy the leafs into the hashes.
                // Sometimes, a little memory expansion costs less than branching.
                // Should cost less, even with a high free memory offset of 0x7d00.
                // Left shift by 5 is equivalent to multiplying by 0x20.
                calldatacopy(hashesFront, leafs.offset, shl(5, leafs.length))
                // Compute the back of the hashes.
                let hashesBack := add(hashesFront, shl(5, leafs.length))
                // This is the end of the memory for the queue.
                // We recycle `flags.length` to save on stack variables
                // (this trick may not always save gas).
                flags.length := add(hashesBack, shl(5, flags.length))

                // We don't need to make a copy of `proof.offset` or `flags.offset`,
                // as they are pass-by-value (this trick may not always save gas).

                for {} 1 {} {
                    // Pop from `hashes`.
                    let a := mload(hashesFront)
                    // Pop from `hashes`.
                    let b := mload(add(hashesFront, 0x20))
                    hashesFront := add(hashesFront, 0x40)

                    // If the flag is false, load the next proof,
                    // else, pops from the queue.
                    if iszero(calldataload(flags.offset)) {
                        // Loads the next proof.
                        b := calldataload(proof.offset)
                        proof.offset := add(proof.offset, 0x20)
                        // Unpop from `hashes`.
                        hashesFront := sub(hashesFront, 0x20)
                    }

                    // Advance to the next flag offset.
                    flags.offset := add(flags.offset, 0x20)

                    // Slot of `a` in scratch space.
                    // If the condition is true: 0x20, otherwise: 0x00.
                    let scratch := shl(5, gt(a, b))
                    // Hash the scratch space and push the result onto the queue.
                    mstore(scratch, a)
                    mstore(xor(scratch, 0x20), b)
                    mstore(hashesBack, keccak256(0x00, 0x40))
                    hashesBack := add(hashesBack, 0x20)
                    if iszero(lt(hashesBack, flags.length)) { break }
                }
                // Checks if the last value in the queue is same as the root.
                isValid := eq(mload(sub(hashesBack, 0x20)), root)
                break
            }
        }
    }
}

File 18 of 19 : SafeTransferLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Caution! This library won't check that a token has code, responsibility is delegated to the caller.
library SafeTransferLib {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev The ETH transfer has failed.
    error ETHTransferFailed();

    /// @dev The ERC20 `transferFrom` has failed.
    error TransferFromFailed();

    /// @dev The ERC20 `transfer` has failed.
    error TransferFailed();

    /// @dev The ERC20 `approve` has failed.
    error ApproveFailed();

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

    /// @dev Suggested gas stipend for contract receiving ETH
    /// that disallows any storage writes.
    uint256 internal constant _GAS_STIPEND_NO_STORAGE_WRITES = 2300;

    /// @dev Suggested gas stipend for contract receiving ETH to perform a few
    /// storage reads and writes, but low enough to prevent griefing.
    /// Multiply by a small constant (e.g. 2), if needed.
    uint256 internal constant _GAS_STIPEND_NO_GRIEF = 100000;

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

    /// @dev Sends `amount` (in wei) ETH to `to`.
    /// Reverts upon failure.
    function safeTransferETH(address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and check if it succeeded or not.
            if iszero(call(gas(), to, amount, 0, 0, 0, 0)) {
                // Store the function selector of `ETHTransferFailed()`.
                mstore(0x00, 0xb12d13eb)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    /// The `gasStipend` can be set to a low enough value to prevent
    /// storage writes or gas griefing.
    ///
    /// If sending via the normal procedure fails, force sends the ETH by
    /// creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.
    ///
    /// Reverts if the current contract has insufficient balance.
    function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // If insufficient balance, revert.
            if lt(selfbalance(), amount) {
                // Store the function selector of `ETHTransferFailed()`.
                mstore(0x00, 0xb12d13eb)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            // Transfer the ETH and check if it succeeded or not.
            if iszero(call(gasStipend, to, amount, 0, 0, 0, 0)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                // We can directly use `SELFDESTRUCT` in the contract creation.
                // We don't check and revert upon failure here, just in case
                // `SELFDESTRUCT`'s behavior is changed some day in the future.
                // (If that ever happens, we will riot, and port the code to use WETH).
                pop(create(amount, 0x0b, 0x16))
            }
        }
    }

    /// @dev Force sends `amount` (in wei) ETH to `to`, with a gas stipend
    /// equal to `_GAS_STIPEND_NO_GRIEF`. This gas stipend is a reasonable default
    /// for 99% of cases and can be overriden with the three-argument version of this
    /// function if necessary.
    ///
    /// If sending via the normal procedure fails, force sends the ETH by
    /// creating a temporary contract which uses `SELFDESTRUCT` to force send the ETH.
    ///
    /// Reverts if the current contract has insufficient balance.
    function forceSafeTransferETH(address to, uint256 amount) internal {
        // Manually inlined because the compiler doesn't inline functions with branches.
        /// @solidity memory-safe-assembly
        assembly {
            // If insufficient balance, revert.
            if lt(selfbalance(), amount) {
                // Store the function selector of `ETHTransferFailed()`.
                mstore(0x00, 0xb12d13eb)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }
            // Transfer the ETH and check if it succeeded or not.
            if iszero(call(_GAS_STIPEND_NO_GRIEF, to, amount, 0, 0, 0, 0)) {
                mstore(0x00, to) // Store the address in scratch space.
                mstore8(0x0b, 0x73) // Opcode `PUSH20`.
                mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
                // We can directly use `SELFDESTRUCT` in the contract creation.
                // We don't check and revert upon failure here, just in case
                // `SELFDESTRUCT`'s behavior is changed some day in the future.
                // (If that ever happens, we will riot, and port the code to use WETH).
                pop(create(amount, 0x0b, 0x16))
            }
        }
    }

    /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
    /// The `gasStipend` can be set to a low enough value to prevent
    /// storage writes or gas griefing.
    ///
    /// Simply use `gasleft()` for `gasStipend` if you don't need a gas stipend.
    ///
    /// Note: Does NOT revert upon failure.
    /// Returns whether the transfer of ETH is successful instead.
    function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
        internal
        returns (bool success)
    {
        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and check if it succeeded or not.
            success := call(gasStipend, to, amount, 0, 0, 0, 0)
        }
    }

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

    /// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
    /// Reverts upon failure.
    ///
    /// The `from` account must have at least `amount` approved for
    /// the current contract to manage.
    function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // We'll write our calldata to this slot below, but restore it later.
            let memPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(0x00, 0x23b872dd)
            mstore(0x20, from) // Append the "from" argument.
            mstore(0x40, to) // Append the "to" argument.
            mstore(0x60, amount) // Append the "amount" argument.

            if iszero(
                and(
                    // Set success to whether the call reverted, if not we check it either
                    // returned exactly 1 (can't just be non-zero data), or had no return data.
                    or(eq(mload(0x00), 1), iszero(returndatasize())),
                    // We use 0x64 because that's the total length of our calldata (0x04 + 0x20 * 3)
                    // Counterintuitively, this call() must be positioned after the or() in the
                    // surrounding and() because and() evaluates its arguments from right to left.
                    call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
                )
            ) {
                // Store the function selector of `TransferFromFailed()`.
                mstore(0x00, 0x7939f424)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }

            mstore(0x60, 0) // Restore the zero slot to zero.
            mstore(0x40, memPointer) // Restore the memPointer.
        }
    }

    /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
    /// Reverts upon failure.
    function safeTransfer(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // We'll write our calldata to this slot below, but restore it later.
            let memPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(0x00, 0xa9059cbb)
            mstore(0x20, to) // Append the "to" argument.
            mstore(0x40, amount) // Append the "amount" argument.

            if iszero(
                and(
                    // Set success to whether the call reverted, if not we check it either
                    // returned exactly 1 (can't just be non-zero data), or had no return data.
                    or(eq(mload(0x00), 1), iszero(returndatasize())),
                    // We use 0x44 because that's the total length of our calldata (0x04 + 0x20 * 2)
                    // Counterintuitively, this call() must be positioned after the or() in the
                    // surrounding and() because and() evaluates its arguments from right to left.
                    call(gas(), token, 0, 0x1c, 0x44, 0x00, 0x20)
                )
            ) {
                // Store the function selector of `TransferFailed()`.
                mstore(0x00, 0x90b8ec18)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }

            mstore(0x40, memPointer) // Restore the memPointer.
        }
    }

    /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
    /// Reverts upon failure.
    function safeApprove(address token, address to, uint256 amount) internal {
        /// @solidity memory-safe-assembly
        assembly {
            // We'll write our calldata to this slot below, but restore it later.
            let memPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(0x00, 0x095ea7b3)
            mstore(0x20, to) // Append the "to" argument.
            mstore(0x40, amount) // Append the "amount" argument.

            if iszero(
                and(
                    // Set success to whether the call reverted, if not we check it either
                    // returned exactly 1 (can't just be non-zero data), or had no return data.
                    or(eq(mload(0x00), 1), iszero(returndatasize())),
                    // We use 0x44 because that's the total length of our calldata (0x04 + 0x20 * 2)
                    // Counterintuitively, this call() must be positioned after the or() in the
                    // surrounding and() because and() evaluates its arguments from right to left.
                    call(gas(), token, 0, 0x1c, 0x44, 0x00, 0x20)
                )
            ) {
                // Store the function selector of `ApproveFailed()`.
                mstore(0x00, 0x3e3f8f73)
                // Revert with (offset, size).
                revert(0x1c, 0x04)
            }

            mstore(0x40, memPointer) // Restore the memPointer.
        }
    }
}

File 19 of 19 : ArcanaHQ.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "erc721a/contracts/extensions/ERC721AQueryable.sol";
import "erc721a/contracts/extensions/ERC721ABurnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "solady/src/utils/ECDSA.sol";
import "solady/src/utils/MerkleProofLib.sol";
import "solady/src/utils/SafeTransferLib.sol";
import {OperatorFilterer} from "closedsea/src/OperatorFilterer.sol";

//               ..   ..
//             .111   111.
//            .1111   1111.
//           .11111   11111.
//          .111111   111111.
//         .111111.   .111111.
//        .1111111     1111111.
//       .1111111.     .1111111.
//      .11111111       11111111.
//     .11111111.       .11111111.
//    .111111111         111111111.
//   .11111111111111111111111111111.
//  .1111111111111111111111111111111.

//Errors

//Mint
error MaxQuantityAllowedExceeded();
error MaxEntitlementsExceeded();
error MaxSupplyExceeded();
error MintSupplyExceeded();
error ContractIsPaused();
error PriceIncorrect();
error ContractsNotAllowed();
error NonceConsumed();
error HashMismatched();
error MerkleProofInvalid();
error SignedHashMismatched();
error MintIsNotOpen();
error TreasuryNotUnlocked();

//Post-Mint
error DNASequenceHaveBeenInitialised();
error DNASequenceNotSubmitted();
error NotReadyForTransfusion();
error TransfusionSequenceCompleted();

/// @title Arcana Contract
/// @author @whyS0curious
/// @notice Beware! Arcana is only for the dauntless ones.
/// @dev Based off ERC-721A for gas optimised batch mints

contract ArcanaHQ is ERC721AQueryable, ERC721ABurnable, Ownable, OperatorFilterer, ERC2981 {
    using Strings for uint256;
    using ECDSA for *;

    enum Phases {
        CLOSED,
        ARCANA,
        ASPIRANT,
        ALLIANCE,
        PUBLIC
    }

    bool public operatorFilteringEnabled;

    uint256 public constant MAX_ENTITLEMENTS_ALLOWED = 2;
    uint256 public constant MAX_QUANTITY_ALLOWED = 3;
    uint256 public constant MINT_PRICE = 0.1 ether;
    uint256 public constant MAX_SUPPLY = 6000;


    uint256 public mintSupply = 5888;
    uint256 public nextUnlockTs = block.timestamp;
    string public notRevealedUri;
    string public baseTokenURI;
    uint256 public nextStartTime;

    uint8 public currentPhase;
    bool public paused = true;

    bytes32 public arcanaListMerkleRoot;
    bytes32 public aspirantListMerkleRoot;
    bytes32 public allianceListMerkleRoot;

    bool public isTransfused = false;
    uint256 public scheduledTransfusionTime;
    uint256 public sequenceOffset;
    string public dna;

    mapping(bytes32 => bool) public nonceRegistry;

    constructor(string memory _baseURI) ERC721A("ArcanaHQ", "ARCHQ") {
        _registerForOperatorFiltering();
        notRevealedUri = _baseURI;
        operatorFilteringEnabled = true;
        _setDefaultRoyalty(msg.sender, 500);
    }

    /*Royalty Enforcement*/
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC721A, ERC2981, ERC721A)
    returns (bool) {
        return (
            ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId)
        );
    }

    function registerCustomBlacklist(address subscriptionOrRegistrantToCopy, bool subscribe) external onlyOwner {
        _registerForOperatorFiltering(subscriptionOrRegistrantToCopy, subscribe);
    }

    function repeatRegistration() external onlyOwner {
        _registerForOperatorFiltering();
    }

    function setApprovalForAll(address operator, bool approved) public override(IERC721A, ERC721A) onlyAllowedOperatorApproval(operator) {
        super.setApprovalForAll(operator, approved);
    }

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

    function transferFrom(address from, address to, uint256 tokenId)
        public
        payable
        override(IERC721A, ERC721A)
        onlyAllowedOperator(from)
    {
        super.transferFrom(from, to, tokenId);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId)
        public
        payable
        override(IERC721A, ERC721A)
        onlyAllowedOperator(from)
    {
        super.safeTransferFrom(from, to, tokenId);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
        public
        payable
        override(IERC721A, ERC721A)
        onlyAllowedOperator(from)
    {
        super.safeTransferFrom(from, to, tokenId, data);
    }

    function setOperatorFilteringEnabled(bool value) external onlyOwner {
        operatorFilteringEnabled = value;
    }

    function _operatorFilteringEnabled() internal view virtual override returns (bool) {
        return operatorFilteringEnabled;
    }

    /*Pre-mint Configurations*/
    function setArcanaListMerkleRoot(bytes32 _merkleRootHash) external onlyOwner {
        arcanaListMerkleRoot = _merkleRootHash;
    }

    function setAspirantListMerkleRoot(bytes32 _merkleRootHash) external onlyOwner {
        aspirantListMerkleRoot = _merkleRootHash;
    }

    function setAllianceListMerkleRoot(bytes32 _merkleRootHash) external onlyOwner {
        allianceListMerkleRoot = _merkleRootHash;
    }

    function setNotRevealedBaseURI(string memory _baseURI) external onlyOwner {
        notRevealedUri = _baseURI;
    }

    function togglePause(bool _state) external payable onlyOwner {
        paused = _state;
    }

    function setNextStartTime(uint256 _timestamp) external payable onlyOwner {
        nextStartTime = _timestamp;
    }

    function setCurrentPhase(uint256 index) external payable onlyOwner {
        if (index == 0) {
            currentPhase = uint8(Phases.CLOSED);
        }
        if (index == 1) {
            currentPhase = uint8(Phases.ARCANA);
        }
        if (index == 2) {
            currentPhase = uint8(Phases.ASPIRANT);
        }
        if (index == 3) {
            currentPhase = uint8(Phases.ALLIANCE);
        }
        if (index == 4) {
            currentPhase = uint8(Phases.PUBLIC);
        }
    }

    /*Pre-reveal Configurations*/
    function setBaseTokenURI(string memory _baseURI) external onlyOwner {
        baseTokenURI = _baseURI;
    }

    function commitDNASequence(string calldata _dna) external payable onlyOwner {
        if (scheduledTransfusionTime != 0) revert DNASequenceHaveBeenInitialised();

        dna = _dna;
        scheduledTransfusionTime = block.number + 5;
    }

    function transfuse() external payable onlyOwner {
        if (scheduledTransfusionTime == 0) revert DNASequenceNotSubmitted();

        if (block.number < scheduledTransfusionTime) revert NotReadyForTransfusion();

        if (isTransfused) revert TransfusionSequenceCompleted();

        sequenceOffset = (uint256(blockhash(scheduledTransfusionTime)) % MAX_SUPPLY) + 1;

        isTransfused = true;
    }

    function withdrawETH() external payable onlyOwner {
        uint256 balance = address(this).balance;
        SafeTransferLib.forceSafeTransferETH(msg.sender, balance);
    }

    /*Mint*/

    // Community War Chest
    /// @notice Mints part of the supply in the community wallet that Arcana owns. Note: Likely hidden from OpenSea due to Aux.
    /// @dev Only the Owner of the smart contract can call this function
    /// @param _communityWalletPublicKey The address of the community wallet
    function mintWarChestReserve(address _communityWalletPublicKey, uint256 _supply, uint256 _nextUnlockTs)
        external
        payable
        isBelowOrEqualsMaxSupply(_supply)
        isUnlocked()
        onlyOwner
    {
        nextUnlockTs = _nextUnlockTs;
        _mint(_communityWalletPublicKey, _supply);
    }

    // Arcana List Mint
    /// @notice Mint function to invoke for ARCANA LIST PHASE addresses
    /// @dev Checks that enough ETH is paid, quantity to mint results in below max supply, is whitelisted, is not paused and below max quantity allowed per wallet address
    function mintArcanaList(bytes32[] calldata _merkleProof, uint256 _quantity)
        external
        payable
        isBelowOrEqualsMintSupply(_quantity)
        isWhitelisted(_merkleProof, arcanaListMerkleRoot)
        isNotPaused
        isMintOpen(Phases.ARCANA)
    {
        uint256 totalPrice = MINT_PRICE * _quantity;
        if (msg.value != totalPrice) revert PriceIncorrect();

        uint256 entitlements = getTotalEntitlements(msg.sender);
        if (entitlements + _quantity > MAX_ENTITLEMENTS_ALLOWED) revert MaxEntitlementsExceeded();

        _setAux(msg.sender, _getAux(msg.sender) + uint64(_quantity));

        _mint(msg.sender, _quantity);
    }

    // Aspirant List Mint
    /// @notice Mint function to invoke for ASPIRANT LIST PHASE addresses
    /// @dev Checks that enough ETH is paid, quantity to mint results in below max supply, is whitelisted, is not paused and below max quantity allowed per wallet address
    function mintAspirantList(bytes32[] calldata _merkleProof, uint256 _quantity)
        external
        payable
        isBelowOrEqualsMintSupply(_quantity)
        isWhitelisted(_merkleProof, aspirantListMerkleRoot)
        isNotPaused
        isMintOpen(Phases.ASPIRANT)
    {
        uint256 totalPrice = MINT_PRICE * _quantity;
        if (msg.value != totalPrice) revert PriceIncorrect();


        uint256 totalMints = getTotalMints(msg.sender);
        if (totalMints + _quantity > MAX_QUANTITY_ALLOWED) revert MaxQuantityAllowedExceeded();

        _setAux(msg.sender, _getAux(msg.sender) + uint64(_quantity << 2));

        _mint(msg.sender, _quantity);
    }

    // Alliance List Mint
    /// @notice Mint function to invoke for ALLIANCE LIST PHASE addresses
    /// @dev Checks that enough ETH is paid, quantity to mint results in below max supply, is whitelisted, is not paused and below max quantity allowed per wallet address

    function mintAllianceList(bytes32[] calldata _merkleProof, uint256 _quantity)
        external
        payable
        isBelowOrEqualsMintSupply(_quantity)
        isWhitelisted(_merkleProof, allianceListMerkleRoot)
        isNotPaused
        isMintOpen(Phases.ALLIANCE)
    {
        uint256 totalPrice = MINT_PRICE * _quantity;
        if (msg.value != totalPrice) revert PriceIncorrect();

        uint256 totalMints = getTotalMints(msg.sender);
        if (totalMints + _quantity > MAX_QUANTITY_ALLOWED) revert MaxQuantityAllowedExceeded();

        _setAux(msg.sender, _getAux(msg.sender) + uint64(_quantity << 2));

        _mint(msg.sender, _quantity);
    }

    // Public Mint
    /// @notice Mint function to invoke during public phase
    /// @dev Same conditions as whitelist and raffle mints, max 3 per wallet instead of 2, 
    // replay attack is mitigated by checking whether contract is minting and using signed unique nonce generated in the client.
    function mintPublic(uint256 _quantity, bytes32 _nonce, bytes32 _hash, uint8 v, bytes32 r, bytes32 s)
        external
        payable
        isBelowOrEqualsMintSupply(_quantity)
        isNotPaused
        isMintOpen(Phases.PUBLIC)
    {
        if (tx.origin != msg.sender) revert ContractsNotAllowed();

        if (nonceRegistry[_nonce]) revert NonceConsumed();

        if (_hash != keccak256(abi.encodePacked(msg.sender, _quantity, _nonce))) revert HashMismatched();

        if (msg.sender != _hash.toEthSignedMessageHash().recover(v, r, s)) revert SignedHashMismatched();

        nonceRegistry[_nonce] = true;

        uint256 totalPrice = MINT_PRICE * _quantity;
        if (msg.value != totalPrice) revert PriceIncorrect();

        uint256 totalMints = getTotalMints(msg.sender);
        if (totalMints + _quantity > MAX_QUANTITY_ALLOWED) revert MaxQuantityAllowedExceeded();

        _setAux(msg.sender, _getAux(msg.sender) + uint64(_quantity << 2));

        _mint(msg.sender, _quantity);
    }

    function numberMinted(address owner) public view returns (uint256) {
        return _numberMinted(owner);
    }

    function numberBurned(address owner) public view returns (uint256) {
        return _numberBurned(owner);
    }

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

    function totalBurned() public view returns (uint256) { 
        return _totalBurned(); 
    }

    function tokenURI(uint256 _tokenId) public view override(IERC721A, ERC721A) returns (string memory) {
        if (isTransfused) {
            uint256 assignedPFPId = (_tokenId + sequenceOffset) % MAX_SUPPLY;

            return bytes(baseTokenURI).length > 0
                ? string(abi.encodePacked(baseTokenURI, _toString(assignedPFPId), ".json"))
                : "";
        } else {
            return notRevealedUri;
        }
    }

    // Future-proof
    function setMintSupply(uint256 _mintSupply) external onlyOwner isBelowOrEqualsMaxSupply(_mintSupply) {
        mintSupply = _mintSupply;
    }

    /*Utility Methods*/

    function getBits(uint256 _input, uint256 _startBit, uint256 _length) private pure returns (uint256) {
        uint256 bitMask = ((1 << _length) - 1) << _startBit;

        uint256 outBits = _input & bitMask;

        return outBits >> _startBit;
    }

    function getTotalEntitlements(address _minter) public view returns (uint256) {
        return getBits(_getAux(_minter), 0, 2);
    }

    function getTotalMints(address _minter) public view returns (uint256) {
        return getBits(_getAux(_minter), 2, 5);
    }

    /*Modifiers*/

    modifier isUnlocked() {
        if (block.timestamp < nextUnlockTs) revert TreasuryNotUnlocked();
        _;
    }

    modifier isMintOpen(Phases phase) {
        if (uint8(phase) != currentPhase) revert MintIsNotOpen();
        _;
    }

    modifier isNotPaused() {
        if (paused) revert ContractIsPaused();
        _;
    }

    modifier isBelowOrEqualsMaxSupply(uint256 _amount) {
        if ((_totalMinted() + _amount) > MAX_SUPPLY) revert MaxSupplyExceeded();
        _;
    }

    modifier isBelowOrEqualsMintSupply(uint256 _amount) {
        if ((_totalMinted() + _amount) > mintSupply) revert MintSupplyExceeded();
        _;
    }

    /// @notice Verifies whitelist or raffle list
    /// @dev generate proof offchain and invoke mint function with proof as parameter
    modifier isWhitelisted(bytes32[] calldata _merkleProof, bytes32 _merkleRoot) {
        bytes32 node = keccak256(abi.encodePacked(msg.sender));
        if (!MerkleProofLib.verify(_merkleProof, _merkleRoot, node)) {
            revert MerkleProofInvalid();
        }
        _;
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "ERC721A/=lib/ERC721A/contracts/",
    "closedsea/=lib/closedsea/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "erc721a-upgradeable/=lib/closedsea/lib/erc721a-upgradeable/contracts/",
    "erc721a/=lib/ERC721A/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/closedsea/lib/openzeppelin-contracts-upgradeable/contracts/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "operator-filter-registry/=lib/closedsea/lib/operator-filter-registry/src/",
    "solady/=lib/solady/",
    "solmate/=lib/solady/lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"ContractIsPaused","type":"error"},{"inputs":[],"name":"ContractsNotAllowed","type":"error"},{"inputs":[],"name":"DNASequenceHaveBeenInitialised","type":"error"},{"inputs":[],"name":"DNASequenceNotSubmitted","type":"error"},{"inputs":[],"name":"HashMismatched","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MaxEntitlementsExceeded","type":"error"},{"inputs":[],"name":"MaxQuantityAllowedExceeded","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MerkleProofInvalid","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintIsNotOpen","type":"error"},{"inputs":[],"name":"MintSupplyExceeded","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NonceConsumed","type":"error"},{"inputs":[],"name":"NotReadyForTransfusion","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PriceIncorrect","type":"error"},{"inputs":[],"name":"SignedHashMismatched","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"TransfusionSequenceCompleted","type":"error"},{"inputs":[],"name":"TreasuryNotUnlocked","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_ENTITLEMENTS_ALLOWED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_QUANTITY_ALLOWED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allianceListMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"arcanaListMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aspirantListMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_dna","type":"string"}],"name":"commitDNASequence","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"currentPhase","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dna","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"getTotalEntitlements","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_minter","type":"address"}],"name":"getTotalMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isTransfused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"mintAllianceList","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"mintArcanaList","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"mintAspirantList","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"bytes32","name":"_nonce","type":"bytes32"},{"internalType":"bytes32","name":"_hash","type":"bytes32"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_communityWalletPublicKey","type":"address"},{"internalType":"uint256","name":"_supply","type":"uint256"},{"internalType":"uint256","name":"_nextUnlockTs","type":"uint256"}],"name":"mintWarChestReserve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextUnlockTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"nonceRegistry","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"notRevealedUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"numberBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"numberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilteringEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"subscriptionOrRegistrantToCopy","type":"address"},{"internalType":"bool","name":"subscribe","type":"bool"}],"name":"registerCustomBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"repeatRegistration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"scheduledTransfusionTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sequenceOffset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRootHash","type":"bytes32"}],"name":"setAllianceListMerkleRoot","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":"bytes32","name":"_merkleRootHash","type":"bytes32"}],"name":"setArcanaListMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRootHash","type":"bytes32"}],"name":"setAspirantListMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"setCurrentPhase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintSupply","type":"uint256"}],"name":"setMintSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"}],"name":"setNextStartTime","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setNotRevealedBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setOperatorFilteringEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"togglePause","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transfuse","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdrawETH","outputs":[],"stateMutability":"payable","type":"function"}]

6080604052611700600c5542600d556011805461ff0019166101001790556015805460ff191690553480156200003457600080fd5b5060405162003873380380620038738339810160408190526200005791620002f6565b60405180604001604052806008815260200167417263616e61485160c01b81525060405180604001604052806005815260200164415243485160d81b8152508160029081620000a791906200045a565b506003620000b682826200045a565b50506000805550620000c83362000103565b620000d262000155565b600e620000e082826200045a565b50600b805460ff19166001179055620000fc336101f462000178565b5062000526565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b62000176733cc6cdda760b79bafa08df41ecfa224f810dceb660016200027d565b565b6127106001600160601b0382161115620001ec5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b038216620002445760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401620001e3565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b6001600160a01b0390911690637d3e3dbe81620002ad5782620002a65750634420e486620002ad565b5063a0af29035b8060e01b60005250306004528160245260008060446000806daaeb6d7670e522a718067333cd4e5af15060006024525050565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156200030a57600080fd5b82516001600160401b03808211156200032257600080fd5b818501915085601f8301126200033757600080fd5b8151818111156200034c576200034c620002e0565b604051601f8201601f19908116603f01168101908382118183101715620003775762000377620002e0565b8160405282815288868487010111156200039057600080fd5b600093505b82841015620003b4578484018601518185018701529285019262000395565b600086848301015280965050505050505092915050565b600181811c90821680620003e057607f821691505b6020821081036200040157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200045557600081815260208120601f850160051c81016020861015620004305750805b601f850160051c820191505b8181101562000451578281556001016200043c565b5050505b505050565b81516001600160401b03811115620004765762000476620002e0565b6200048e81620004878454620003cb565b8462000407565b602080601f831160018114620004c65760008415620004ad5750858301515b600019600386901b1c1916600185901b17855562000451565b600085815260208120601f198616915b82811015620004f757888601518255948401946001909101908401620004d6565b5085821015620005165787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61333d80620005366000396000f3fe6080604052600436106103fa5760003560e01c80637bc8022f11610213578063c002d23d11610123578063dc33e681116100ab578063e985e9c51161007a578063e985e9c514610af1578063ead4158514610b3a578063f2fde38b14610b5a578063f5127c1b14610b7a578063fb796e6c14610b9457600080fd5b8063dc33e68114610a96578063e086e5ec14610ab6578063e269359f14610abe578063e5405ca414610ade57600080fd5b8063c8817fbd116100f2578063c8817fbd14610a3c578063c9d327c714610a44578063cf3630b414610a59578063d547cfb714610a6c578063d89135cd14610a8157600080fd5b8063c002d23d146109bd578063c20f4522146109d9578063c23dc68f146109ef578063c87b56dd14610a1c57600080fd5b806393e6fa77116101a6578063a22cb46511610175578063a22cb46514610935578063a2309ff814610955578063ac568e841461096a578063b7c0b8e81461098a578063b88d4fde146109aa57600080fd5b806393e6fa77146108d557806395d89b41146108eb57806397b0bb2d1461090057806399a2557a1461091557600080fd5b80638462151c116101e25780638462151c1461085457806388fede86146108815780638da5cb5b1461089757806392bb4a93146108b557600080fd5b80637bc8022f146107f95780637d3e1ee4146108195780637e9040901461082c57806383c2fe8e1461084157600080fd5b80633953bb2c1161030e57806357d159c6116102a157806361886a271161027057806361886a271461076e5780636352211e1461078e5780636aa34b66146107ae57806370a08231146107c4578063715018a6146107e457600080fd5b806357d159c6146106fa5780635bbb21771461070d5780635c975abb1461073a5780635e1c07461461075957600080fd5b8063508733d6116102dd578063508733d6146106a85780635485cda5146106bb578063559ab6aa146106ce5780635638e3b6146106e457600080fd5b80633953bb2c1461064c57806342842e0e1461066257806342966c6814610675578063465caa781461069557600080fd5b8063194c2936116103915780632a55205a116103605780632a55205a146105a457806330176e13146105e357806332cb6b0c1461060357806336f1fb1b1461061957806338be67b71461062c57600080fd5b8063194c29361461052157806320c3cf5e1461054157806323b872dd146105715780632478d6391461058457600080fd5b8063081812fc116103cd578063081812fc146104a6578063081c8c44146104de578063095ea7b3146104f357806318160ddd1461050857600080fd5b806301ffc9a7146103ff578063045b7dca14610434578063055ad42e1461045857806306fdde0314610484575b600080fd5b34801561040b57600080fd5b5061041f61041a366004612970565b610bae565b60405190151581526020015b60405180910390f35b34801561044057600080fd5b5061044a600c5481565b60405190815260200161042b565b34801561046457600080fd5b506011546104729060ff1681565b60405160ff909116815260200161042b565b34801561049057600080fd5b50610499610bce565b60405161042b91906129dd565b3480156104b257600080fd5b506104c66104c13660046129f0565b610c60565b6040516001600160a01b03909116815260200161042b565b3480156104ea57600080fd5b50610499610ca4565b610506610501366004612a20565b610d32565b005b34801561051457600080fd5b506001546000540361044a565b34801561052d57600080fd5b5061050661053c366004612ad5565b610d56565b34801561054d57600080fd5b5061041f61055c3660046129f0565b60196020526000908152604090205460ff1681565b61050661057f366004612b1d565b610d6e565b34801561059057600080fd5b5061044a61059f366004612b59565b610da4565b3480156105b057600080fd5b506105c46105bf366004612b74565b610dd1565b604080516001600160a01b03909316835260208301919091520161042b565b3480156105ef57600080fd5b506105066105fe366004612ad5565b610e7f565b34801561060f57600080fd5b5061044a61177081565b610506610627366004612b96565b610e93565b34801561063857600080fd5b506105066106473660046129f0565b61111d565b34801561065857600080fd5b5061044a60175481565b610506610670366004612b1d565b61112a565b34801561068157600080fd5b506105066106903660046129f0565b61115a565b6105066106a3366004612c33565b611168565b6105066106b6366004612c33565b6112ef565b6105066106c9366004612c7e565b6113c2565b3480156106da57600080fd5b5061044a60105481565b3480156106f057600080fd5b5061044a60165481565b610506610708366004612cff565b61140b565b34801561071957600080fd5b5061072d610728366004612d1a565b61142d565b60405161042b9190612d97565b34801561074657600080fd5b5060115461041f90610100900460ff1681565b34801561076557600080fd5b506105066114f8565b34801561077a57600080fd5b5061044a610789366004612b59565b61150a565b34801561079a57600080fd5b506104c66107a93660046129f0565b61152a565b3480156107ba57600080fd5b5061044a60145481565b3480156107d057600080fd5b5061044a6107df366004612b59565b611535565b3480156107f057600080fd5b50610506611583565b34801561080557600080fd5b50610506610814366004612dd9565b611595565b6105066108273660046129f0565b6115a7565b34801561083857600080fd5b5061049961161c565b61050661084f366004612e0c565b611629565b34801561086057600080fd5b5061087461086f366004612b59565b61169a565b60405161042b9190612e3f565b34801561088d57600080fd5b5061044a600d5481565b3480156108a357600080fd5b506008546001600160a01b03166104c6565b3480156108c157600080fd5b506105066108d03660046129f0565b6117a2565b3480156108e157600080fd5b5061044a60135481565b3480156108f757600080fd5b506104996117af565b34801561090c57600080fd5b5061044a600281565b34801561092157600080fd5b50610874610930366004612e0c565b6117be565b34801561094157600080fd5b50610506610950366004612dd9565b611937565b34801561096157600080fd5b5060005461044a565b34801561097657600080fd5b506105066109853660046129f0565b61195b565b34801561099657600080fd5b506105066109a5366004612cff565b6119a0565b6105066109b8366004612e77565b6119bb565b3480156109c957600080fd5b5061044a67016345785d8a000081565b3480156109e557600080fd5b5061044a60125481565b3480156109fb57600080fd5b50610a0f610a0a3660046129f0565b6119f3565b60405161042b9190612ef2565b348015610a2857600080fd5b50610499610a373660046129f0565b611a6b565b610506611b8c565b348015610a5057600080fd5b5061044a600381565b610506610a673660046129f0565b611c2c565b348015610a7857600080fd5b50610499611c39565b348015610a8d57600080fd5b5061044a611c46565b348015610aa257600080fd5b5061044a610ab1366004612b59565b611c51565b610506611c7b565b348015610aca57600080fd5b50610506610ad93660046129f0565b611c8e565b610506610aec366004612c33565b611c9b565b348015610afd57600080fd5b5061041f610b0c366004612f00565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610b4657600080fd5b5061044a610b55366004612b59565b611e03565b348015610b6657600080fd5b50610506610b75366004612b59565b611e23565b348015610b8657600080fd5b5060155461041f9060ff1681565b348015610ba057600080fd5b50600b5461041f9060ff1681565b6000610bb982611e9e565b80610bc85750610bc882611eec565b92915050565b606060028054610bdd90612f2a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c0990612f2a565b8015610c565780601f10610c2b57610100808354040283529160200191610c56565b820191906000526020600020905b815481529060010190602001808311610c3957829003601f168201915b5050505050905090565b6000610c6b82611f21565b610c88576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600e8054610cb190612f2a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cdd90612f2a565b8015610d2a5780601f10610cff57610100808354040283529160200191610d2a565b820191906000526020600020905b815481529060010190602001808311610d0d57829003601f168201915b505050505081565b81600b5460ff1615610d4757610d4781611f48565b610d518383611f8c565b505050565b610d5e611f98565b600e610d6a8282612faa565b5050565b826001600160a01b0381163314610d9357600b5460ff1615610d9357610d9333611f48565b610d9e848484611ff2565b50505050565b6000610bc8826001600160a01b031660009081526005602052604090205460801c6001600160401b031690565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610e465750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610e65906001600160601b03168761307f565b610e6f91906130ac565b91519350909150505b9250929050565b610e87611f98565b600f610d6a8282612faa565b85600c5481610ea160005490565b610eab91906130c0565b1115610eca57604051633b27957560e11b815260040160405180910390fd5b601154610100900460ff1615610ef3576040516306d39fcd60e41b815260040160405180910390fd5b60115460049060ff168114610f1b57604051637a3f3fbf60e11b815260040160405180910390fd5b323314610f3a57604051628b531560e01b815260040160405180910390fd5b60008781526019602052604090205460ff1615610f6a57604051635b80006960e01b815260040160405180910390fd5b6040516001600160601b03193360601b1660208201526034810189905260548101889052607401604051602081830303815290604052805190602001208614610fc657604051631c47a5b160e31b815260040160405180910390fd5b611003858585610ffb8a6020527b19457468657265756d205369676e6564204d6573736167653a0a3332600052603c60042090565b929190612183565b6001600160a01b0316336001600160a01b03161461103457604051633b133f6b60e01b815260040160405180910390fd5b6000878152601960205260408120805460ff1916600117905561105f8967016345785d8a000061307f565b905080341461108157604051630eab4a2360e21b815260040160405180910390fd5b600061108c33611e03565b9050600361109a8b836130c0565b11156110b9576040516392e75eb160e01b815260040160405180910390fd5b6111073360028c901b6110cb336121e4565b6110d591906130d3565b6001600160a01b03909116600090815260056020526040902080546001600160c01b031660c09290921b919091179055565b611111338b612202565b50505050505050505050565b611125611f98565b601255565b826001600160a01b038116331461114f57600b5460ff161561114f5761114f33611f48565b610d9e8484846122dc565b6111658160016122f7565b50565b80600c548161117660005490565b61118091906130c0565b111561119f57604051633b27957560e11b815260040160405180910390fd5b6014546040516001600160601b03193360601b166020820152859185916000906034016040516020818303038152906040528051906020012090506111e68484848461242f565b6112035760405163c8ac23c360e01b815260040160405180910390fd5b601154610100900460ff161561122c576040516306d39fcd60e41b815260040160405180910390fd5b60115460039060ff16815b60ff161461125857604051637a3f3fbf60e11b815260040160405180910390fd5b600061126c8867016345785d8a000061307f565b905080341461128e57604051630eab4a2360e21b815260040160405180910390fd5b600061129933611e03565b905060036112a78a836130c0565b11156112c6576040516392e75eb160e01b815260040160405180910390fd5b6112d83360028b901b6110cb336121e4565b6112e2338a612202565b5050505050505050505050565b80600c54816112fd60005490565b61130791906130c0565b111561132657604051633b27957560e11b815260040160405180910390fd5b6013546040516001600160601b03193360601b1660208201528591859160009060340160405160208183030381529060405280519060200120905061136d8484848461242f565b61138a5760405163c8ac23c360e01b815260040160405180910390fd5b601154610100900460ff16156113b3576040516306d39fcd60e41b815260040160405180910390fd5b60115460029060ff1681611237565b6113ca611f98565b601654156113eb57604051631957aaad60e31b815260040160405180910390fd5b60186113f88284836130fa565b506114044360056130c0565b6016555050565b611413611f98565b601180549115156101000261ff0019909216919091179055565b6060816000816001600160401b0381111561144a5761144a612a4a565b60405190808252806020026020018201604052801561149c57816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816114685790505b50905060005b8281146114ef576114ca8686838181106114be576114be6131b9565b905060200201356119f3565b8282815181106114dc576114dc6131b9565b60209081029190910101526001016114a2565b50949350505050565b611500611f98565b611508612469565b565b6000610bc8611518836121e4565b6001600160401b031660006002612488565b6000610bc8826124a9565b60006001600160a01b03821661155e576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b61158b611f98565b6115086000612529565b61159d611f98565b610d6a828261257b565b6115af611f98565b806000036115c2576011805460ff191690555b806001036115d8576011805460ff191660011790555b806002036115ee576011805460ff191660021790555b80600303611604576011805460ff191660031790555b8060040361116557506011805460ff19166004179055565b60188054610cb190612f2a565b816117708161163760005490565b61164191906130c0565b111561166057604051638a164f6360e01b815260040160405180910390fd5b600d5442101561168357604051639bf67bc160e01b815260040160405180910390fd5b61168b611f98565b600d829055610d9e8484612202565b606060008060006116aa85611535565b90506000816001600160401b038111156116c6576116c6612a4a565b6040519080825280602002602001820160405280156116ef578160200160208202803683370190505b50905061171c60408051608081018252600080825260208201819052918101829052606081019190915290565b60005b8386146117965761172f816125db565b9150816040015161178e5781516001600160a01b03161561174f57815194505b876001600160a01b0316856001600160a01b03160361178e5780838780600101985081518110611781576117816131b9565b6020026020010181815250505b60010161171f565b50909695505050505050565b6117aa611f98565b601355565b606060038054610bdd90612f2a565b60608183106117e057604051631960ccad60e11b815260040160405180910390fd5b6000806117ec60005490565b9050808411156117fa578093505b600061180587611535565b905084861015611824578585038181101561181e578091505b50611828565b5060005b6000816001600160401b0381111561184257611842612a4a565b60405190808252806020026020018201604052801561186b578160200160208202803683370190505b5090508160000361188157935061193092505050565b600061188c886119f3565b90506000816040015161189d575080515b885b8881141580156118af5750848714155b15611924576118bd816125db565b9250826040015161191c5782516001600160a01b0316156118dd57825191505b8a6001600160a01b0316826001600160a01b03160361191c578084888060010199508151811061190f5761190f6131b9565b6020026020010181815250505b60010161189f565b50505092835250909150505b9392505050565b81600b5460ff161561194c5761194c81611f48565b610d518383612617565b905090565b611963611f98565b806117708161197160005490565b61197b91906130c0565b111561199a57604051638a164f6360e01b815260040160405180910390fd5b50600c55565b6119a8611f98565b600b805460ff1916911515919091179055565b836001600160a01b03811633146119e057600b5460ff16156119e0576119e033611f48565b6119ec85858585612683565b5050505050565b6040805160808082018352600080835260208084018290528385018290526060808501839052855193840186528284529083018290529382018190529281018390529091506000548310611a475792915050565b611a50836125db565b9050806040015115611a625792915050565b611930836126c7565b60155460609060ff1615611af557600061177060175484611a8c91906130c0565b611a9691906131cf565b90506000600f8054611aa790612f2a565b905011611ac35760405180602001604052806000815250611930565b600f611ace826126fc565b604051602001611adf9291906131e3565b6040516020818303038152906040529392505050565b600e8054611b0290612f2a565b80601f0160208091040260200160405190810160405280929190818152602001828054611b2e90612f2a565b8015611b7b5780601f10611b5057610100808354040283529160200191611b7b565b820191906000526020600020905b815481529060010190602001808311611b5e57829003601f168201915b50505050509050919050565b919050565b611b94611f98565b601654600003611bb757604051630439b78160e31b815260040160405180910390fd5b601654431015611bda57604051633b2cf00760e21b815260040160405180910390fd5b60155460ff1615611bfe57604051631cfdc09160e31b815260040160405180910390fd5b601654611c0f9061177090406131cf565b611c1a9060016130c0565b6017556015805460ff19166001179055565b611c34611f98565b601055565b600f8054610cb190612f2a565b600061195660015490565b6001600160a01b038116600090815260056020526040808220546001600160401b03911c16610bc8565b611c83611f98565b476111653382612740565b611c96611f98565b601455565b80600c5481611ca960005490565b611cb391906130c0565b1115611cd257604051633b27957560e11b815260040160405180910390fd5b6012546040516001600160601b03193360601b16602082015285918591600090603401604051602081830303815290604052805190602001209050611d198484848461242f565b611d365760405163c8ac23c360e01b815260040160405180910390fd5b601154610100900460ff1615611d5f576040516306d39fcd60e41b815260040160405180910390fd5b60115460019060ff168114611d8757604051637a3f3fbf60e11b815260040160405180910390fd5b6000611d9b8867016345785d8a000061307f565b9050803414611dbd57604051630eab4a2360e21b815260040160405180910390fd5b6000611dc83361150a565b90506002611dd68a836130c0565b1115611df55760405163547c52ef60e01b815260040160405180910390fd5b6112d8338a6110cb336121e4565b6000610bc8611e11836121e4565b6001600160401b031660026005612488565b611e2b611f98565b6001600160a01b038116611e955760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61116581612529565b60006301ffc9a760e01b6001600160e01b031983161480611ecf57506380ac58cd60e01b6001600160e01b03198316145b80610bc85750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b1480610bc857506301ffc9a760e01b6001600160e01b0319831614610bc8565b6000805482108015610bc8575050600090815260046020526040902054600160e01b161590565b69c617113400112233445560005230601a5280603a52600080604460166daaeb6d7670e522a718067333cd4e5afa611f84573d6000803e3d6000fd5b6000603a5250565b610d6a82826001612780565b6008546001600160a01b031633146115085760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611e8c565b6000611ffd826124a9565b9050836001600160a01b0316816001600160a01b0316146120305760405162a1148160e81b815260040160405180910390fd5b6000828152600660205260409020805461205c8187335b6001600160a01b039081169116811491141790565b6120875761206a8633610b0c565b61208757604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166120ae57604051633a954ecd60e21b815260040160405180910390fd5b80156120b957600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b8416900361214b576001840160008181526004602052604081205490036121495760005481146121495760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03166000805160206132e883398151915260405160405180910390a45b505050505050565b60006040517f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116121d95785600052846020528360405282606052602060406080600060015afa5060006060523d6060035191505b604052949350505050565b6001600160a01b031660009081526005602052604090205460c01c90565b60008054908290036122275760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083906000805160206132e88339815191528180a4600183015b8181146122b257808360006000805160206132e8833981519152600080a460010161228c565b50816000036122d357604051622e076360e81b815260040160405180910390fd5b60005550505050565b610d51838383604051806020016040528060008152506119bb565b6000612302836124a9565b90508060008061232086600090815260066020526040902080549091565b91509150841561236057612335818433612047565b612360576123438333610b0c565b61236057604051632ce44b5f60e11b815260040160405180910390fd5b801561236b57600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b851690036123f9576001860160008181526004602052604081205490036123f75760005481146123f75760008181526004602052604090208590555b505b60405186906000906001600160a01b038616906000805160206132e8833981519152908390a45050600180548101905550505050565b60008315612461578360051b8501855b803580851160051b9485526020948518526040600020930181811061243f5750505b501492915050565b611508733cc6cdda760b79bafa08df41ecfa224f810dceb6600161257b565b60008083612499600180861b61327a565b901b8516841c9150509392505050565b60008181526004602052604081205490600160e01b821690036125105780600003611b875760005482106124f057604051636f96cda160e11b815260040160405180910390fd5b5b506000190160008181526004602052604090205480156124f157919050565b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0390911690637d3e3dbe816125a857826125a15750634420e4866125a8565b5063a0af29035b8060e01b60005250306004528160245260008060446000806daaeb6d7670e522a718067333cd4e5af15060006024525050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610bc890612827565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61268e848484610d6e565b6001600160a01b0383163b15610d9e576126aa8484848461286e565b610d9e576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610bc86126f7836124a9565b612827565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806127165750819003601f19909101908152919050565b804710156127565763b12d13eb6000526004601cfd5b6000806000808486620186a0f1610d6a57816000526073600b5360ff6020536016600b82f0505050565b600061278b8361152a565b905081156127ca57336001600160a01b038216146127ca576127ad8133610b0c565b6127ca576040516367d9dca160e11b815260040160405180910390fd5b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906128a390339089908890889060040161328d565b6020604051808303816000875af19250505080156128de575060408051601f3d908101601f191682019092526128db918101906132ca565b60015b61293c573d80801561290c576040519150601f19603f3d011682016040523d82523d6000602084013e612911565b606091505b508051600003612934576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6001600160e01b03198116811461116557600080fd5b60006020828403121561298257600080fd5b81356119308161295a565b60005b838110156129a8578181015183820152602001612990565b50506000910152565b600081518084526129c981602086016020860161298d565b601f01601f19169290920160200192915050565b60208152600061193060208301846129b1565b600060208284031215612a0257600080fd5b5035919050565b80356001600160a01b0381168114611b8757600080fd5b60008060408385031215612a3357600080fd5b612a3c83612a09565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b0380841115612a7a57612a7a612a4a565b604051601f8501601f19908116603f01168101908282118183101715612aa257612aa2612a4a565b81604052809350858152868686011115612abb57600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612ae757600080fd5b81356001600160401b03811115612afd57600080fd5b8201601f81018413612b0e57600080fd5b61295284823560208401612a60565b600080600060608486031215612b3257600080fd5b612b3b84612a09565b9250612b4960208501612a09565b9150604084013590509250925092565b600060208284031215612b6b57600080fd5b61193082612a09565b60008060408385031215612b8757600080fd5b50508035926020909101359150565b60008060008060008060c08789031215612baf57600080fd5b863595506020870135945060408701359350606087013560ff81168114612bd557600080fd5b9598949750929560808101359460a0909101359350915050565b60008083601f840112612c0157600080fd5b5081356001600160401b03811115612c1857600080fd5b6020830191508360208260051b8501011115610e7857600080fd5b600080600060408486031215612c4857600080fd5b83356001600160401b03811115612c5e57600080fd5b612c6a86828701612bef565b909790965060209590950135949350505050565b60008060208385031215612c9157600080fd5b82356001600160401b0380821115612ca857600080fd5b818501915085601f830112612cbc57600080fd5b813581811115612ccb57600080fd5b866020828501011115612cdd57600080fd5b60209290920196919550909350505050565b80358015158114611b8757600080fd5b600060208284031215612d1157600080fd5b61193082612cef565b60008060208385031215612d2d57600080fd5b82356001600160401b03811115612d4357600080fd5b612d4f85828601612bef565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b8181101561179657612dc6838551612d5b565b9284019260809290920191600101612db3565b60008060408385031215612dec57600080fd5b612df583612a09565b9150612e0360208401612cef565b90509250929050565b600080600060608486031215612e2157600080fd5b612e2a84612a09565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b8181101561179657835183529284019291840191600101612e5b565b60008060008060808587031215612e8d57600080fd5b612e9685612a09565b9350612ea460208601612a09565b92506040850135915060608501356001600160401b03811115612ec657600080fd5b8501601f81018713612ed757600080fd5b612ee687823560208401612a60565b91505092959194509250565b60808101610bc88284612d5b565b60008060408385031215612f1357600080fd5b612f1c83612a09565b9150612e0360208401612a09565b600181811c90821680612f3e57607f821691505b602082108103612f5e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610d5157600081815260208120601f850160051c81016020861015612f8b5750805b601f850160051c820191505b8181101561217b57828155600101612f97565b81516001600160401b03811115612fc357612fc3612a4a565b612fd781612fd18454612f2a565b84612f64565b602080601f83116001811461300c5760008415612ff45750858301515b600019600386901b1c1916600185901b17855561217b565b600085815260208120601f198616915b8281101561303b5788860151825594840194600190910190840161301c565b50858210156130595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610bc857610bc8613069565b634e487b7160e01b600052601260045260246000fd5b6000826130bb576130bb613096565b500490565b80820180821115610bc857610bc8613069565b6001600160401b038181168382160190808211156130f3576130f3613069565b5092915050565b6001600160401b0383111561311157613111612a4a565b6131258361311f8354612f2a565b83612f64565b6000601f84116001811461315957600085156131415750838201355b600019600387901b1c1916600186901b1783556119ec565b600083815260209020601f19861690835b8281101561318a578685013582556020948501946001909201910161316a565b50868210156131a75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052603260045260246000fd5b6000826131de576131de613096565b500690565b60008084546131f181612f2a565b60018281168015613209576001811461321e5761324d565b60ff198416875282151583028701945061324d565b8860005260208060002060005b858110156132445781548a82015290840190820161322b565b50505082870194505b50505050835161326181836020880161298d565b64173539b7b760d91b9101908152600501949350505050565b81810381811115610bc857610bc8613069565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132c0908301846129b1565b9695505050505050565b6000602082840312156132dc57600080fd5b81516119308161295a56feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122039cd9fa00935a694e3329b63fdffc4f8b38210fba9ab41f5b7088f24aa2b5a6864736f6c634300081100330000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000005b68747470733a2f2f617263616e612d736f6369616c2d6d6574612e73332e61702d736f757468656173742d312e616d617a6f6e6177732e636f6d2f617263616e615f706c616365686f6c6465725f6d657461646174612e6a736f6e0000000000

Deployed Bytecode

0x6080604052600436106103fa5760003560e01c80637bc8022f11610213578063c002d23d11610123578063dc33e681116100ab578063e985e9c51161007a578063e985e9c514610af1578063ead4158514610b3a578063f2fde38b14610b5a578063f5127c1b14610b7a578063fb796e6c14610b9457600080fd5b8063dc33e68114610a96578063e086e5ec14610ab6578063e269359f14610abe578063e5405ca414610ade57600080fd5b8063c8817fbd116100f2578063c8817fbd14610a3c578063c9d327c714610a44578063cf3630b414610a59578063d547cfb714610a6c578063d89135cd14610a8157600080fd5b8063c002d23d146109bd578063c20f4522146109d9578063c23dc68f146109ef578063c87b56dd14610a1c57600080fd5b806393e6fa77116101a6578063a22cb46511610175578063a22cb46514610935578063a2309ff814610955578063ac568e841461096a578063b7c0b8e81461098a578063b88d4fde146109aa57600080fd5b806393e6fa77146108d557806395d89b41146108eb57806397b0bb2d1461090057806399a2557a1461091557600080fd5b80638462151c116101e25780638462151c1461085457806388fede86146108815780638da5cb5b1461089757806392bb4a93146108b557600080fd5b80637bc8022f146107f95780637d3e1ee4146108195780637e9040901461082c57806383c2fe8e1461084157600080fd5b80633953bb2c1161030e57806357d159c6116102a157806361886a271161027057806361886a271461076e5780636352211e1461078e5780636aa34b66146107ae57806370a08231146107c4578063715018a6146107e457600080fd5b806357d159c6146106fa5780635bbb21771461070d5780635c975abb1461073a5780635e1c07461461075957600080fd5b8063508733d6116102dd578063508733d6146106a85780635485cda5146106bb578063559ab6aa146106ce5780635638e3b6146106e457600080fd5b80633953bb2c1461064c57806342842e0e1461066257806342966c6814610675578063465caa781461069557600080fd5b8063194c2936116103915780632a55205a116103605780632a55205a146105a457806330176e13146105e357806332cb6b0c1461060357806336f1fb1b1461061957806338be67b71461062c57600080fd5b8063194c29361461052157806320c3cf5e1461054157806323b872dd146105715780632478d6391461058457600080fd5b8063081812fc116103cd578063081812fc146104a6578063081c8c44146104de578063095ea7b3146104f357806318160ddd1461050857600080fd5b806301ffc9a7146103ff578063045b7dca14610434578063055ad42e1461045857806306fdde0314610484575b600080fd5b34801561040b57600080fd5b5061041f61041a366004612970565b610bae565b60405190151581526020015b60405180910390f35b34801561044057600080fd5b5061044a600c5481565b60405190815260200161042b565b34801561046457600080fd5b506011546104729060ff1681565b60405160ff909116815260200161042b565b34801561049057600080fd5b50610499610bce565b60405161042b91906129dd565b3480156104b257600080fd5b506104c66104c13660046129f0565b610c60565b6040516001600160a01b03909116815260200161042b565b3480156104ea57600080fd5b50610499610ca4565b610506610501366004612a20565b610d32565b005b34801561051457600080fd5b506001546000540361044a565b34801561052d57600080fd5b5061050661053c366004612ad5565b610d56565b34801561054d57600080fd5b5061041f61055c3660046129f0565b60196020526000908152604090205460ff1681565b61050661057f366004612b1d565b610d6e565b34801561059057600080fd5b5061044a61059f366004612b59565b610da4565b3480156105b057600080fd5b506105c46105bf366004612b74565b610dd1565b604080516001600160a01b03909316835260208301919091520161042b565b3480156105ef57600080fd5b506105066105fe366004612ad5565b610e7f565b34801561060f57600080fd5b5061044a61177081565b610506610627366004612b96565b610e93565b34801561063857600080fd5b506105066106473660046129f0565b61111d565b34801561065857600080fd5b5061044a60175481565b610506610670366004612b1d565b61112a565b34801561068157600080fd5b506105066106903660046129f0565b61115a565b6105066106a3366004612c33565b611168565b6105066106b6366004612c33565b6112ef565b6105066106c9366004612c7e565b6113c2565b3480156106da57600080fd5b5061044a60105481565b3480156106f057600080fd5b5061044a60165481565b610506610708366004612cff565b61140b565b34801561071957600080fd5b5061072d610728366004612d1a565b61142d565b60405161042b9190612d97565b34801561074657600080fd5b5060115461041f90610100900460ff1681565b34801561076557600080fd5b506105066114f8565b34801561077a57600080fd5b5061044a610789366004612b59565b61150a565b34801561079a57600080fd5b506104c66107a93660046129f0565b61152a565b3480156107ba57600080fd5b5061044a60145481565b3480156107d057600080fd5b5061044a6107df366004612b59565b611535565b3480156107f057600080fd5b50610506611583565b34801561080557600080fd5b50610506610814366004612dd9565b611595565b6105066108273660046129f0565b6115a7565b34801561083857600080fd5b5061049961161c565b61050661084f366004612e0c565b611629565b34801561086057600080fd5b5061087461086f366004612b59565b61169a565b60405161042b9190612e3f565b34801561088d57600080fd5b5061044a600d5481565b3480156108a357600080fd5b506008546001600160a01b03166104c6565b3480156108c157600080fd5b506105066108d03660046129f0565b6117a2565b3480156108e157600080fd5b5061044a60135481565b3480156108f757600080fd5b506104996117af565b34801561090c57600080fd5b5061044a600281565b34801561092157600080fd5b50610874610930366004612e0c565b6117be565b34801561094157600080fd5b50610506610950366004612dd9565b611937565b34801561096157600080fd5b5060005461044a565b34801561097657600080fd5b506105066109853660046129f0565b61195b565b34801561099657600080fd5b506105066109a5366004612cff565b6119a0565b6105066109b8366004612e77565b6119bb565b3480156109c957600080fd5b5061044a67016345785d8a000081565b3480156109e557600080fd5b5061044a60125481565b3480156109fb57600080fd5b50610a0f610a0a3660046129f0565b6119f3565b60405161042b9190612ef2565b348015610a2857600080fd5b50610499610a373660046129f0565b611a6b565b610506611b8c565b348015610a5057600080fd5b5061044a600381565b610506610a673660046129f0565b611c2c565b348015610a7857600080fd5b50610499611c39565b348015610a8d57600080fd5b5061044a611c46565b348015610aa257600080fd5b5061044a610ab1366004612b59565b611c51565b610506611c7b565b348015610aca57600080fd5b50610506610ad93660046129f0565b611c8e565b610506610aec366004612c33565b611c9b565b348015610afd57600080fd5b5061041f610b0c366004612f00565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610b4657600080fd5b5061044a610b55366004612b59565b611e03565b348015610b6657600080fd5b50610506610b75366004612b59565b611e23565b348015610b8657600080fd5b5060155461041f9060ff1681565b348015610ba057600080fd5b50600b5461041f9060ff1681565b6000610bb982611e9e565b80610bc85750610bc882611eec565b92915050565b606060028054610bdd90612f2a565b80601f0160208091040260200160405190810160405280929190818152602001828054610c0990612f2a565b8015610c565780601f10610c2b57610100808354040283529160200191610c56565b820191906000526020600020905b815481529060010190602001808311610c3957829003601f168201915b5050505050905090565b6000610c6b82611f21565b610c88576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600e8054610cb190612f2a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cdd90612f2a565b8015610d2a5780601f10610cff57610100808354040283529160200191610d2a565b820191906000526020600020905b815481529060010190602001808311610d0d57829003601f168201915b505050505081565b81600b5460ff1615610d4757610d4781611f48565b610d518383611f8c565b505050565b610d5e611f98565b600e610d6a8282612faa565b5050565b826001600160a01b0381163314610d9357600b5460ff1615610d9357610d9333611f48565b610d9e848484611ff2565b50505050565b6000610bc8826001600160a01b031660009081526005602052604090205460801c6001600160401b031690565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610e465750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610e65906001600160601b03168761307f565b610e6f91906130ac565b91519350909150505b9250929050565b610e87611f98565b600f610d6a8282612faa565b85600c5481610ea160005490565b610eab91906130c0565b1115610eca57604051633b27957560e11b815260040160405180910390fd5b601154610100900460ff1615610ef3576040516306d39fcd60e41b815260040160405180910390fd5b60115460049060ff168114610f1b57604051637a3f3fbf60e11b815260040160405180910390fd5b323314610f3a57604051628b531560e01b815260040160405180910390fd5b60008781526019602052604090205460ff1615610f6a57604051635b80006960e01b815260040160405180910390fd5b6040516001600160601b03193360601b1660208201526034810189905260548101889052607401604051602081830303815290604052805190602001208614610fc657604051631c47a5b160e31b815260040160405180910390fd5b611003858585610ffb8a6020527b19457468657265756d205369676e6564204d6573736167653a0a3332600052603c60042090565b929190612183565b6001600160a01b0316336001600160a01b03161461103457604051633b133f6b60e01b815260040160405180910390fd5b6000878152601960205260408120805460ff1916600117905561105f8967016345785d8a000061307f565b905080341461108157604051630eab4a2360e21b815260040160405180910390fd5b600061108c33611e03565b9050600361109a8b836130c0565b11156110b9576040516392e75eb160e01b815260040160405180910390fd5b6111073360028c901b6110cb336121e4565b6110d591906130d3565b6001600160a01b03909116600090815260056020526040902080546001600160c01b031660c09290921b919091179055565b611111338b612202565b50505050505050505050565b611125611f98565b601255565b826001600160a01b038116331461114f57600b5460ff161561114f5761114f33611f48565b610d9e8484846122dc565b6111658160016122f7565b50565b80600c548161117660005490565b61118091906130c0565b111561119f57604051633b27957560e11b815260040160405180910390fd5b6014546040516001600160601b03193360601b166020820152859185916000906034016040516020818303038152906040528051906020012090506111e68484848461242f565b6112035760405163c8ac23c360e01b815260040160405180910390fd5b601154610100900460ff161561122c576040516306d39fcd60e41b815260040160405180910390fd5b60115460039060ff16815b60ff161461125857604051637a3f3fbf60e11b815260040160405180910390fd5b600061126c8867016345785d8a000061307f565b905080341461128e57604051630eab4a2360e21b815260040160405180910390fd5b600061129933611e03565b905060036112a78a836130c0565b11156112c6576040516392e75eb160e01b815260040160405180910390fd5b6112d83360028b901b6110cb336121e4565b6112e2338a612202565b5050505050505050505050565b80600c54816112fd60005490565b61130791906130c0565b111561132657604051633b27957560e11b815260040160405180910390fd5b6013546040516001600160601b03193360601b1660208201528591859160009060340160405160208183030381529060405280519060200120905061136d8484848461242f565b61138a5760405163c8ac23c360e01b815260040160405180910390fd5b601154610100900460ff16156113b3576040516306d39fcd60e41b815260040160405180910390fd5b60115460029060ff1681611237565b6113ca611f98565b601654156113eb57604051631957aaad60e31b815260040160405180910390fd5b60186113f88284836130fa565b506114044360056130c0565b6016555050565b611413611f98565b601180549115156101000261ff0019909216919091179055565b6060816000816001600160401b0381111561144a5761144a612a4a565b60405190808252806020026020018201604052801561149c57816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816114685790505b50905060005b8281146114ef576114ca8686838181106114be576114be6131b9565b905060200201356119f3565b8282815181106114dc576114dc6131b9565b60209081029190910101526001016114a2565b50949350505050565b611500611f98565b611508612469565b565b6000610bc8611518836121e4565b6001600160401b031660006002612488565b6000610bc8826124a9565b60006001600160a01b03821661155e576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b61158b611f98565b6115086000612529565b61159d611f98565b610d6a828261257b565b6115af611f98565b806000036115c2576011805460ff191690555b806001036115d8576011805460ff191660011790555b806002036115ee576011805460ff191660021790555b80600303611604576011805460ff191660031790555b8060040361116557506011805460ff19166004179055565b60188054610cb190612f2a565b816117708161163760005490565b61164191906130c0565b111561166057604051638a164f6360e01b815260040160405180910390fd5b600d5442101561168357604051639bf67bc160e01b815260040160405180910390fd5b61168b611f98565b600d829055610d9e8484612202565b606060008060006116aa85611535565b90506000816001600160401b038111156116c6576116c6612a4a565b6040519080825280602002602001820160405280156116ef578160200160208202803683370190505b50905061171c60408051608081018252600080825260208201819052918101829052606081019190915290565b60005b8386146117965761172f816125db565b9150816040015161178e5781516001600160a01b03161561174f57815194505b876001600160a01b0316856001600160a01b03160361178e5780838780600101985081518110611781576117816131b9565b6020026020010181815250505b60010161171f565b50909695505050505050565b6117aa611f98565b601355565b606060038054610bdd90612f2a565b60608183106117e057604051631960ccad60e11b815260040160405180910390fd5b6000806117ec60005490565b9050808411156117fa578093505b600061180587611535565b905084861015611824578585038181101561181e578091505b50611828565b5060005b6000816001600160401b0381111561184257611842612a4a565b60405190808252806020026020018201604052801561186b578160200160208202803683370190505b5090508160000361188157935061193092505050565b600061188c886119f3565b90506000816040015161189d575080515b885b8881141580156118af5750848714155b15611924576118bd816125db565b9250826040015161191c5782516001600160a01b0316156118dd57825191505b8a6001600160a01b0316826001600160a01b03160361191c578084888060010199508151811061190f5761190f6131b9565b6020026020010181815250505b60010161189f565b50505092835250909150505b9392505050565b81600b5460ff161561194c5761194c81611f48565b610d518383612617565b905090565b611963611f98565b806117708161197160005490565b61197b91906130c0565b111561199a57604051638a164f6360e01b815260040160405180910390fd5b50600c55565b6119a8611f98565b600b805460ff1916911515919091179055565b836001600160a01b03811633146119e057600b5460ff16156119e0576119e033611f48565b6119ec85858585612683565b5050505050565b6040805160808082018352600080835260208084018290528385018290526060808501839052855193840186528284529083018290529382018190529281018390529091506000548310611a475792915050565b611a50836125db565b9050806040015115611a625792915050565b611930836126c7565b60155460609060ff1615611af557600061177060175484611a8c91906130c0565b611a9691906131cf565b90506000600f8054611aa790612f2a565b905011611ac35760405180602001604052806000815250611930565b600f611ace826126fc565b604051602001611adf9291906131e3565b6040516020818303038152906040529392505050565b600e8054611b0290612f2a565b80601f0160208091040260200160405190810160405280929190818152602001828054611b2e90612f2a565b8015611b7b5780601f10611b5057610100808354040283529160200191611b7b565b820191906000526020600020905b815481529060010190602001808311611b5e57829003601f168201915b50505050509050919050565b919050565b611b94611f98565b601654600003611bb757604051630439b78160e31b815260040160405180910390fd5b601654431015611bda57604051633b2cf00760e21b815260040160405180910390fd5b60155460ff1615611bfe57604051631cfdc09160e31b815260040160405180910390fd5b601654611c0f9061177090406131cf565b611c1a9060016130c0565b6017556015805460ff19166001179055565b611c34611f98565b601055565b600f8054610cb190612f2a565b600061195660015490565b6001600160a01b038116600090815260056020526040808220546001600160401b03911c16610bc8565b611c83611f98565b476111653382612740565b611c96611f98565b601455565b80600c5481611ca960005490565b611cb391906130c0565b1115611cd257604051633b27957560e11b815260040160405180910390fd5b6012546040516001600160601b03193360601b16602082015285918591600090603401604051602081830303815290604052805190602001209050611d198484848461242f565b611d365760405163c8ac23c360e01b815260040160405180910390fd5b601154610100900460ff1615611d5f576040516306d39fcd60e41b815260040160405180910390fd5b60115460019060ff168114611d8757604051637a3f3fbf60e11b815260040160405180910390fd5b6000611d9b8867016345785d8a000061307f565b9050803414611dbd57604051630eab4a2360e21b815260040160405180910390fd5b6000611dc83361150a565b90506002611dd68a836130c0565b1115611df55760405163547c52ef60e01b815260040160405180910390fd5b6112d8338a6110cb336121e4565b6000610bc8611e11836121e4565b6001600160401b031660026005612488565b611e2b611f98565b6001600160a01b038116611e955760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b61116581612529565b60006301ffc9a760e01b6001600160e01b031983161480611ecf57506380ac58cd60e01b6001600160e01b03198316145b80610bc85750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b1480610bc857506301ffc9a760e01b6001600160e01b0319831614610bc8565b6000805482108015610bc8575050600090815260046020526040902054600160e01b161590565b69c617113400112233445560005230601a5280603a52600080604460166daaeb6d7670e522a718067333cd4e5afa611f84573d6000803e3d6000fd5b6000603a5250565b610d6a82826001612780565b6008546001600160a01b031633146115085760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611e8c565b6000611ffd826124a9565b9050836001600160a01b0316816001600160a01b0316146120305760405162a1148160e81b815260040160405180910390fd5b6000828152600660205260409020805461205c8187335b6001600160a01b039081169116811491141790565b6120875761206a8633610b0c565b61208757604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166120ae57604051633a954ecd60e21b815260040160405180910390fd5b80156120b957600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b8416900361214b576001840160008181526004602052604081205490036121495760005481146121495760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03166000805160206132e883398151915260405160405180910390a45b505050505050565b60006040517f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083116121d95785600052846020528360405282606052602060406080600060015afa5060006060523d6060035191505b604052949350505050565b6001600160a01b031660009081526005602052604090205460c01c90565b60008054908290036122275760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083906000805160206132e88339815191528180a4600183015b8181146122b257808360006000805160206132e8833981519152600080a460010161228c565b50816000036122d357604051622e076360e81b815260040160405180910390fd5b60005550505050565b610d51838383604051806020016040528060008152506119bb565b6000612302836124a9565b90508060008061232086600090815260066020526040902080549091565b91509150841561236057612335818433612047565b612360576123438333610b0c565b61236057604051632ce44b5f60e11b815260040160405180910390fd5b801561236b57600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b851690036123f9576001860160008181526004602052604081205490036123f75760005481146123f75760008181526004602052604090208590555b505b60405186906000906001600160a01b038616906000805160206132e8833981519152908390a45050600180548101905550505050565b60008315612461578360051b8501855b803580851160051b9485526020948518526040600020930181811061243f5750505b501492915050565b611508733cc6cdda760b79bafa08df41ecfa224f810dceb6600161257b565b60008083612499600180861b61327a565b901b8516841c9150509392505050565b60008181526004602052604081205490600160e01b821690036125105780600003611b875760005482106124f057604051636f96cda160e11b815260040160405180910390fd5b5b506000190160008181526004602052604090205480156124f157919050565b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0390911690637d3e3dbe816125a857826125a15750634420e4866125a8565b5063a0af29035b8060e01b60005250306004528160245260008060446000806daaeb6d7670e522a718067333cd4e5af15060006024525050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610bc890612827565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61268e848484610d6e565b6001600160a01b0383163b15610d9e576126aa8484848461286e565b610d9e576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610bc86126f7836124a9565b612827565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806127165750819003601f19909101908152919050565b804710156127565763b12d13eb6000526004601cfd5b6000806000808486620186a0f1610d6a57816000526073600b5360ff6020536016600b82f0505050565b600061278b8361152a565b905081156127ca57336001600160a01b038216146127ca576127ad8133610b0c565b6127ca576040516367d9dca160e11b815260040160405180910390fd5b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906128a390339089908890889060040161328d565b6020604051808303816000875af19250505080156128de575060408051601f3d908101601f191682019092526128db918101906132ca565b60015b61293c573d80801561290c576040519150601f19603f3d011682016040523d82523d6000602084013e612911565b606091505b508051600003612934576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6001600160e01b03198116811461116557600080fd5b60006020828403121561298257600080fd5b81356119308161295a565b60005b838110156129a8578181015183820152602001612990565b50506000910152565b600081518084526129c981602086016020860161298d565b601f01601f19169290920160200192915050565b60208152600061193060208301846129b1565b600060208284031215612a0257600080fd5b5035919050565b80356001600160a01b0381168114611b8757600080fd5b60008060408385031215612a3357600080fd5b612a3c83612a09565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b0380841115612a7a57612a7a612a4a565b604051601f8501601f19908116603f01168101908282118183101715612aa257612aa2612a4a565b81604052809350858152868686011115612abb57600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612ae757600080fd5b81356001600160401b03811115612afd57600080fd5b8201601f81018413612b0e57600080fd5b61295284823560208401612a60565b600080600060608486031215612b3257600080fd5b612b3b84612a09565b9250612b4960208501612a09565b9150604084013590509250925092565b600060208284031215612b6b57600080fd5b61193082612a09565b60008060408385031215612b8757600080fd5b50508035926020909101359150565b60008060008060008060c08789031215612baf57600080fd5b863595506020870135945060408701359350606087013560ff81168114612bd557600080fd5b9598949750929560808101359460a0909101359350915050565b60008083601f840112612c0157600080fd5b5081356001600160401b03811115612c1857600080fd5b6020830191508360208260051b8501011115610e7857600080fd5b600080600060408486031215612c4857600080fd5b83356001600160401b03811115612c5e57600080fd5b612c6a86828701612bef565b909790965060209590950135949350505050565b60008060208385031215612c9157600080fd5b82356001600160401b0380821115612ca857600080fd5b818501915085601f830112612cbc57600080fd5b813581811115612ccb57600080fd5b866020828501011115612cdd57600080fd5b60209290920196919550909350505050565b80358015158114611b8757600080fd5b600060208284031215612d1157600080fd5b61193082612cef565b60008060208385031215612d2d57600080fd5b82356001600160401b03811115612d4357600080fd5b612d4f85828601612bef565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b8181101561179657612dc6838551612d5b565b9284019260809290920191600101612db3565b60008060408385031215612dec57600080fd5b612df583612a09565b9150612e0360208401612cef565b90509250929050565b600080600060608486031215612e2157600080fd5b612e2a84612a09565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b8181101561179657835183529284019291840191600101612e5b565b60008060008060808587031215612e8d57600080fd5b612e9685612a09565b9350612ea460208601612a09565b92506040850135915060608501356001600160401b03811115612ec657600080fd5b8501601f81018713612ed757600080fd5b612ee687823560208401612a60565b91505092959194509250565b60808101610bc88284612d5b565b60008060408385031215612f1357600080fd5b612f1c83612a09565b9150612e0360208401612a09565b600181811c90821680612f3e57607f821691505b602082108103612f5e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610d5157600081815260208120601f850160051c81016020861015612f8b5750805b601f850160051c820191505b8181101561217b57828155600101612f97565b81516001600160401b03811115612fc357612fc3612a4a565b612fd781612fd18454612f2a565b84612f64565b602080601f83116001811461300c5760008415612ff45750858301515b600019600386901b1c1916600185901b17855561217b565b600085815260208120601f198616915b8281101561303b5788860151825594840194600190910190840161301c565b50858210156130595787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610bc857610bc8613069565b634e487b7160e01b600052601260045260246000fd5b6000826130bb576130bb613096565b500490565b80820180821115610bc857610bc8613069565b6001600160401b038181168382160190808211156130f3576130f3613069565b5092915050565b6001600160401b0383111561311157613111612a4a565b6131258361311f8354612f2a565b83612f64565b6000601f84116001811461315957600085156131415750838201355b600019600387901b1c1916600186901b1783556119ec565b600083815260209020601f19861690835b8281101561318a578685013582556020948501946001909201910161316a565b50868210156131a75760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052603260045260246000fd5b6000826131de576131de613096565b500690565b60008084546131f181612f2a565b60018281168015613209576001811461321e5761324d565b60ff198416875282151583028701945061324d565b8860005260208060002060005b858110156132445781548a82015290840190820161322b565b50505082870194505b50505050835161326181836020880161298d565b64173539b7b760d91b9101908152600501949350505050565b81810381811115610bc857610bc8613069565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132c0908301846129b1565b9695505050505050565b6000602082840312156132dc57600080fd5b81516119308161295a56feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122039cd9fa00935a694e3329b63fdffc4f8b38210fba9ab41f5b7088f24aa2b5a6864736f6c63430008110033

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

0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000005b68747470733a2f2f617263616e612d736f6369616c2d6d6574612e73332e61702d736f757468656173742d312e616d617a6f6e6177732e636f6d2f617263616e615f706c616365686f6c6465725f6d657461646174612e6a736f6e0000000000

-----Decoded View---------------
Arg [0] : _baseURI (string): https://arcana-social-meta.s3.ap-southeast-1.amazonaws.com/arcana_placeholder_metadata.json

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 000000000000000000000000000000000000000000000000000000000000005b
Arg [2] : 68747470733a2f2f617263616e612d736f6369616c2d6d6574612e73332e6170
Arg [3] : 2d736f757468656173742d312e616d617a6f6e6177732e636f6d2f617263616e
Arg [4] : 615f706c616365686f6c6465725f6d657461646174612e6a736f6e0000000000


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.