ETH Price: $3,167.23 (+3.52%)

Token

Dittos (DITTO)
 

Overview

Max Total Supply

10,000 DITTO

Holders

5,084

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Filtered by Token Holder
gtahomes.eth
Balance
2 DITTO
0xc4cb88c83691ad5aeaea39a22ff77a4004ac6951
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:
Dittos

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 21 : Dittos.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./ERC721A.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./Base64.sol";
import "./strings.sol";

contract Dittos is ERC721A, Ownable {
    mapping(uint256 => string) private _transformations;

    mapping(address => uint256) private _minters;

    bytes4 private ERC721InterfaceId = 0x80ac58cd;
    bytes4 private ERC1155MetadataInterfaceId = 0x0e89341c;

    uint256 public costTransform = 0.01 ether;

    uint16 public MAX_MINT = 1;
    uint256 public MAX_SUPPLY = 10000;
    uint256 public OWNER_SUPPLY = 500;

    constructor() ERC721A("Dittos", "DITTO") {}

    function mint() public {
        require(
            _minters[msg.sender] < MAX_MINT,
            "You are not allowed to mint more Dittos"
        );
        require(
            totalSupply() + OWNER_SUPPLY < MAX_SUPPLY,
            "Max limit of Dittos reached"
        );
        _mint(msg.sender, 1);
        _minters[msg.sender] += 1;
    }

    function ownerMint() public onlyOwner {
        _mint(msg.sender, OWNER_SUPPLY);
    }

    function transform(
        uint256 dittoId,
        address usingContractNFT,
        uint256 usingTokenId
    ) public payable {
        require(
            _exists(dittoId),
            "ERC721Metadata: dittoId for nonexistent token"
        );

        require(
            ownerOf(dittoId) == msg.sender,
            "You are not the owner of this Ditto"
        );

        require(
            msg.value >= costTransform,
            "Transfer amount too low to use Transform"
        );

        if (
            ERC165Checker.supportsInterface(usingContractNFT, ERC721InterfaceId)
        ) {
            (bool success, bytes memory bytesUri) = usingContractNFT.call(
                abi.encodeWithSignature("tokenURI(uint256)", usingTokenId)
            );

            require(success, "Error getting tokenURI data");
            string memory uri = abi.decode(bytesUri, (string));

            _transformations[dittoId] = uri;
        } else if (
            ERC165Checker.supportsInterface(
                usingContractNFT,
                ERC1155MetadataInterfaceId
            )
        ) {
            (bool success, bytes memory bytesUri) = usingContractNFT.call(
                abi.encodeWithSignature("uri(uint256)", usingTokenId)
            );

            require(success, "Error getting URI data");
            string memory uri = abi.decode(bytesUri, (string));

            _transformations[dittoId] = uri;
        } else if (
            usingContractNFT == 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB
        ) {
            string memory uri = tokenURIforPunk(uint16(usingTokenId));
            _transformations[dittoId] = uri;
        } else {
            revert("Provided address is not compatible with ERC721 or ERC1155");
        }
    }

    function untransform(uint256 dittoId) public {
        require(
            _exists(dittoId),
            "ERC721Metadata: dittoId for nonexistent token"
        );

        require(
            ownerOf(dittoId) == msg.sender,
            "You are not the owner of this Ditto"
        );

        _transformations[dittoId] = "";
    }

    function tokenURIforDitto(uint256 tokenId)
        private
        pure
        returns (string memory)
    {
        string
            memory svg = '<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill="#D5FCFF" d="M0 0h24v24H0z"/><path fill="#FFA4C7" d="M6 17h4v1H6zm6-10h3v1h-3zM8 7h2v1H8zm5-1h2v1h-2zm-1 11h4v1h-4zm-7-7h14v7H5z"/><path fill="#FFA4C7" d="M6 8h13v3H6z"/><path fill="#000" d="M4 13h1v4H4zm2-5h1v2H6zm10-1h3v1h-3zm-1-1h1v2h-1zM6 18h4v1H6zm4-1h2v1h-2zm4-7h2v1h-2zm-7 4h2v1H7zm9 3h2v1h-2zm2-1h1v1h-1zM5 17h1v1H5zm4-4h1v1H9zm1-4h1v1h-1zm4-1h1v1h-1zm-2 10h4v1h-4zm-2-7h4v1h-4zm8 0h1v2h-1zm1 2h1v3h-1zm0-5h1v4h-1zM7 7h1v1H7zm6-2h2v1h-2zm-1 1h1v1h-1zm-2 1h2v1h-2zM8 6h2v1H8zm-3 4h1v3H5z"/></svg>';
        string memory json = string(
            abi.encodePacked(
                '{"name": "Ditto #',
                Strings.toString(tokenId),
                '", "description": "Ditto can use Transform to mimic a different ERC721 or ERC1155 token.", "image": "data:image/svg+xml;base64,',
                Base64.encode(bytes(svg)),
                '"}'
            )
        );

        return
            string(
                abi.encodePacked(
                    "data:application/json;base64,",
                    Base64.encode(bytes(json))
                )
            );
    }

    function tokenURIforPunk(uint16 tokenId) private returns (string memory) {
        (
            bool success,
            bytes memory bytesImage
        ) = 0x16F5A35647D6F03D5D3da7b35409D65ba03aF3B2.call(
                abi.encodeWithSignature("punkImageSvg(uint16)", tokenId)
            );

        require(success, "Error getting Punk data");
        string memory imageSVG = abi.decode(bytesImage, (string));

        // Formatting SVG output to display
        string memory substringSvg = strings.substring(
            imageSVG,
            162,
            strings.utfStringLength(imageSVG)
        );

        // Adding svg header and background color
        string memory svg = string(
            abi.encodePacked(
                '<svg xmlns="http://www.w3.org/2000/svg" version="1.2" viewBox="0 0 24 24"><rect x="0" y="0" width="24" height="24" shape-rendering="crispEdges" fill="#638596"/>',
                substringSvg
            )
        );

        string memory json = string(
            abi.encodePacked(
                '{"name": "CryptoPunk #',
                Strings.toString(tokenId),
                '", "description": "Ditto used Transform! It\'s super effective!", "image": "data:image/svg+xml;base64,',
                Base64.encode(bytes(svg)),
                '"}'
            )
        );

        return
            string(
                abi.encodePacked(
                    "data:application/json;base64,",
                    Base64.encode(bytes(json))
                )
            );
    }

    function setTransformCost(uint256 priceInWeis) public onlyOwner {
        costTransform = priceInWeis;
    }

    function withdrawFromContract() public onlyOwner {
        payable(owner()).transfer(address(this).balance);
    }

    function tokenURI(uint256 tokenId)
        public
        view
        override(ERC721A)
        returns (string memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );

        if (bytes(_transformations[tokenId]).length != 0) {
            return _transformations[tokenId];
        }

        return tokenURIforDitto(tokenId);
    }
}

File 2 of 21 : Base64.sol
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(
                    resultPtr,
                    mload(add(tablePtr, and(shr(18, input), 0x3F)))
                )
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(
                    resultPtr,
                    mload(add(tablePtr, and(shr(12, input), 0x3F)))
                )
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(
                    resultPtr,
                    mload(add(tablePtr, and(shr(6, input), 0x3F)))
                )
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

File 3 of 21 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721A.sol';

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _tokenApprovals[tokenId].value;
    }

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public 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 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 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`.
                )

                for {
                    let tokenId := add(startTokenId, 1)
                } iszero(eq(tokenId, end)) {
                    tokenId := add(tokenId, 1)
                } {
                    // Emit the `Transfer` event. Similar to above.
                    log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                }
            }
            if (toMasked == 0) revert MintToZeroAddress();

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

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

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

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

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

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

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

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

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

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

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

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

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

        address from = address(uint160(prevOwnershipPacked));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 4 of 21 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

File 5 of 21 : ERC165Checker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface,
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            _supportsERC165Interface(account, type(IERC165).interfaceId) &&
            !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
        internal
        view
        returns (bool[] memory)
    {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in _interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!_supportsERC165Interface(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     * Interface identification is specified in ERC-165.
     */
    function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);
        (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams);
        if (result.length < 32) return false;
        return success && abi.decode(result, (bool));
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

File 7 of 21 : strings.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library strings {
    function substring(
        string memory str,
        uint256 startIndex,
        uint256 endIndex
    ) internal pure returns (string memory) {
        bytes memory strBytes = bytes(str);
        bytes memory result = new bytes(endIndex - startIndex);
        for (uint256 i = startIndex; i < endIndex; i++) {
            result[i - startIndex] = strBytes[i];
        }
        return string(result);
    }

    function utfStringLength(string memory str)
        internal
        pure
        returns (uint256 length)
    {
        uint256 i = 0;
        bytes memory string_rep = bytes(str);

        while (i < string_rep.length) {
            if (string_rep[i] >> 7 == 0) i += 1;
            else if (string_rep[i] >> 5 == bytes1(uint8(0x6))) i += 2;
            else if (string_rep[i] >> 4 == bytes1(uint8(0xE))) i += 3;
            else if (string_rep[i] >> 3 == bytes1(uint8(0x1E)))
                i += 4;
                //For safety
            else i += 1;

            length++;
        }
    }
}

File 8 of 21 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// 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;

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

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

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

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

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

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

    // =============================================================
    //                        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 9 of 21 : 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 10 of 21 : 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 11 of 21 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

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

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

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

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

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

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

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 12 of 21 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 13 of 21 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 14 of 21 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 16 of 21 : 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 17 of 21 : ERC721URIStorage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721URIStorage.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";

/**
 * @dev ERC721 token with storage based token URI management.
 */
abstract contract ERC721URIStorage is ERC721 {
    using Strings for uint256;

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token");

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }

        return super.tokenURI(tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

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

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }
    }
}

File 18 of 21 : YourCollectible.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4; //Do not change the solidity version as it negativly impacts submission grading

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract YourCollectible is
    ERC721,
    ERC721Enumerable,
    ERC721URIStorage,
    Ownable
{
    using Counters for Counters.Counter;

    Counters.Counter private _tokenIdCounter;

    constructor() ERC721("YourCollectible", "YCB") {}

    function _baseURI() internal pure override returns (string memory) {
        return "https://ipfs.io/ipfs/";
    }

    function mintItem(address to, string memory uri) public returns (uint256) {
        _tokenIdCounter.increment();
        uint256 tokenId = _tokenIdCounter.current();
        _safeMint(to, tokenId);
        _setTokenURI(tokenId, uri);
        return tokenId;
    }

    // The following functions are overrides required by Solidity.

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721, ERC721Enumerable) {
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function _burn(uint256 tokenId)
        internal
        override(ERC721, ERC721URIStorage)
    {
        super._burn(tokenId);
    }

    function tokenURI(uint256 tokenId)
        public
        view
        override(ERC721, ERC721URIStorage)
        returns (string memory)
    {
        return super.tokenURI(tokenId);
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721, ERC721Enumerable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    function punkImageSvg(uint16) public pure returns (string memory) {
        return
            'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.2" viewBox="0 0 24 24"><rect x="8" y="5" width="1" height="1" shape-rendering="crispEdges" fill="#1637a4ff"/><rect x="9" y="5" width="1" height="1" shape-rendering="crispEdges" fill="#1637a4ff"/><rect x="10" y="5" width="1" height="1" shape-rendering="crispEdges" fill="#1637a4ff"/><rect x="11" y="5" width="1" height="1" shape-rendering="crispEdges" fill="#1637a4ff"/><rect x="12" y="5" width="1" height="1" shape-rendering="crispEdges" fill="#1637a4ff"/><rect x="13" y="5" width="1" height="1" shape-rendering="crispEdges" fill="#1637a4ff"/><rect x="14" y="5" width="1" height="1" shape-rendering="crispEdges" fill="#1637a4ff"/><rect x="15" y="5" width="1" height="1" shape-rendering="crispEdges" fill="#1637a4ff"/><rect x="7" y="6" width="1" height="1" shape-rendering="crispEdges" fill="#1637a4ff"/><rect x="8" y="6" width="1" height="1" shape-rendering="crispEdges" fill="#1a43c8ff"/><rect x="9" y="6" width="1" height="1" shape-rendering="crispEdges" fill="#1a43c8ff"/><rect x="10" y="6" width="1" height="1" shape-rendering="crispEdges" fill="#1a43c8ff"/><rect x="11" y="6" width="1" height="1" shape-rendering="crispEdges" fill="#1a43c8ff"/><rect x="12" y="6" width="1" height="1" shape-rendering="crispEdges" fill="#1a43c8ff"/><rect x="13" y="6" width="1" height="1" shape-rendering="crispEdges" fill="#1a43c8ff"/></svg>';
    }
}

File 19 of 21 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

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

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 21 of 21 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"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_MINT","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OWNER_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"costTransform","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"priceInWeis","type":"uint256"}],"name":"setTransformCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"dittoId","type":"uint256"},{"internalType":"address","name":"usingContractNFT","type":"address"},{"internalType":"uint256","name":"usingTokenId","type":"uint256"}],"name":"transform","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"dittoId","type":"uint256"}],"name":"untransform","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawFromContract","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600b80546001600160401b031916670e89341c80ac58cd179055662386f26fc10000600c55600d805461ffff19166001179055612710600e556101f4600f553480156200005057600080fd5b506040805180820182526006815265446974746f7360d01b602080830191825283518085019094526005845264444954544f60d81b9084015281519192916200009c916002916200011c565b508051620000b29060039060208401906200011c565b50506000805550620000c433620000ca565b62000209565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200012a90620001c2565b90600052602060002090601f0160209004810192826200014e576000855562000199565b82601f106200016957805160ff191683800117855562000199565b8280016001018555821562000199579182015b82811115620001995782518255916020019190600101906200017c565b50620001a7929150620001ab565b5090565b5b80821115620001a75760008155600101620001ac565b600281046001821680620001d757607f821691505b60208210811415620001ed57620001ed620001f3565b50919050565b634e487b7160e01b600052602260045260246000fd5b612af780620002196000396000f3fe60806040526004361061019c5760003560e01c806370a08231116100ec578063b75694881161008a578063e985e9c511610064578063e985e9c514610453578063f0292a0314610473578063f2fde38b1461049b578063f6e9936a146104bb57600080fd5b8063b7569488146103fd578063b88d4fde14610413578063c87b56dd1461043357600080fd5b806395d89b41116100c657806395d89b411461039d578063a22cb465146103b2578063b12dc991146103d2578063b662dc9b146103e757600080fd5b806370a082311461034a578063715018a61461036a5780638da5cb5b1461037f57600080fd5b806318160ddd1161015957806342842e0e1161013357806342842e0e146102d55780635e29ec46146102f55780635f589e42146103155780636352211e1461032a57600080fd5b806318160ddd1461027d57806323b872dd1461029f57806332cb6b0c146102bf57600080fd5b806301ffc9a7146101a15780630433d1c8146101d757806306fdde03146101f9578063081812fc1461021b578063095ea7b3146102485780631249c58b14610268575b600080fd5b3480156101ad57600080fd5b506101c16101bc366004611e0d565b6104ce565b6040516101ce9190612529565b60405180910390f35b3480156101e357600080fd5b506101f76101f2366004611e7e565b610520565b005b34801561020557600080fd5b5061020e610558565b6040516101ce9190612545565b34801561022757600080fd5b5061023b610236366004611e7e565b6105ea565b6040516101ce91906124e1565b34801561025457600080fd5b506101f7610263366004611dbf565b61062e565b34801561027457600080fd5b506101f76106ce565b34801561028957600080fd5b50600154600054035b6040516101ce9190612624565b3480156102ab57600080fd5b506101f76102ba366004611cc9565b61076a565b3480156102cb57600080fd5b50610292600e5481565b3480156102e157600080fd5b506101f76102f0366004611cc9565b6108fb565b34801561030157600080fd5b506101f7610310366004611e7e565b61091b565b34801561032157600080fd5b506101f761099c565b34801561033657600080fd5b5061023b610345366004611e7e565b610a02565b34801561035657600080fd5b50610292610365366004611c71565b610a0d565b34801561037657600080fd5b506101f7610a5c565b34801561038b57600080fd5b506008546001600160a01b031661023b565b3480156103a957600080fd5b5061020e610a92565b3480156103be57600080fd5b506101f76103cd366004611d8f565b610aa1565b3480156103de57600080fd5b506101f7610b10565b3480156103f357600080fd5b50610292600f5481565b34801561040957600080fd5b50610292600c5481565b34801561041f57600080fd5b506101f761042e366004611d16565b610b46565b34801561043f57600080fd5b5061020e61044e366004611e7e565b610b90565b34801561045f57600080fd5b506101c161046e366004611c8f565b610c7e565b34801561047f57600080fd5b50600d5461048e9061ffff1681565b6040516101ce9190612616565b3480156104a757600080fd5b506101f76104b6366004611c71565b610cac565b6101f76104c9366004611e9c565b610d05565b60006301ffc9a760e01b6001600160e01b0319831614806104ff57506380ac58cd60e01b6001600160e01b03198316145b8061051a5750635b5e139f60e01b6001600160e01b03198316145b92915050565b6008546001600160a01b031633146105535760405162461bcd60e51b815260040161054a906125b6565b60405180910390fd5b600c55565b60606002805461056790612724565b80601f016020809104026020016040519081016040528092919081815260200182805461059390612724565b80156105e05780601f106105b5576101008083540402835291602001916105e0565b820191906000526020600020905b8154815290600101906020018083116105c357829003601f168201915b5050505050905090565b60006105f582610fd4565b610612576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061063982610a02565b9050336001600160a01b03821614610672576106558133610c7e565b610672576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600d54336000908152600a602052604090205461ffff909116116107045760405162461bcd60e51b815260040161054a906125e6565b600e54600f546001546000540361071b9190612679565b106107385760405162461bcd60e51b815260040161054a906125f6565b610743336001610ffb565b336000908152600a60205260408120805460019290610763908490612679565b9091555050565b6000610775826110f2565b9050836001600160a01b0316816001600160a01b0316146107a85760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b038816909114176107f5576107d88633610c7e565b6107f557604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661081c57604051633a954ecd60e21b815260040160405180910390fd5b801561082757600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b83166108b257600184016000818152600460205260409020546108b05760005481146108b05760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b61091683838360405180602001604052806000815250610b46565b505050565b61092481610fd4565b6109405760405162461bcd60e51b815260040161054a90612566565b3361094a82610a02565b6001600160a01b0316146109705760405162461bcd60e51b815260040161054a906125a6565b6040805160208082018084526000808452858152600990925292902090516109989290611ae5565b5050565b6008546001600160a01b031633146109c65760405162461bcd60e51b815260040161054a906125b6565b6008546040516001600160a01b03909116904780156108fc02916000818181858888f193505050501580156109ff573d6000803e3d6000fd5b50565b600061051a826110f2565b60006001600160a01b038216610a36576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6008546001600160a01b03163314610a865760405162461bcd60e51b815260040161054a906125b6565b610a90600061115a565b565b60606003805461056790612724565b3360008181526007602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190610b04908590612529565b60405180910390a35050565b6008546001600160a01b03163314610b3a5760405162461bcd60e51b815260040161054a906125b6565b610a9033600f54610ffb565b610b5184848461076a565b6001600160a01b0383163b15610b8a57610b6d848484846111ac565b610b8a576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6060610b9b82610fd4565b610bb75760405162461bcd60e51b815260040161054a906125c6565b60008281526009602052604090208054610bd090612724565b159050610c755760008281526009602052604090208054610bf090612724565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1c90612724565b8015610c695780601f10610c3e57610100808354040283529160200191610c69565b820191906000526020600020905b815481529060010190602001808311610c4c57829003601f168201915b50505050509050919050565b61051a826112a4565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6008546001600160a01b03163314610cd65760405162461bcd60e51b815260040161054a906125b6565b6001600160a01b038116610cfc5760405162461bcd60e51b815260040161054a90612576565b6109ff8161115a565b610d0e83610fd4565b610d2a5760405162461bcd60e51b815260040161054a90612566565b33610d3484610a02565b6001600160a01b031614610d5a5760405162461bcd60e51b815260040161054a906125a6565b600c54341015610d7c5760405162461bcd60e51b815260040161054a90612586565b600b54610d8d90839060e01b61132d565b15610e8c57600080836001600160a01b031683604051602401610db09190612624565b60408051601f198184030181529181526020820180516001600160e01b031663c87b56dd60e01b17905251610de59190612245565b6000604051808303816000865af19150503d8060008114610e22576040519150601f19603f3d011682016040523d82523d6000602084013e610e27565b606091505b509150915081610e495760405162461bcd60e51b815260040161054a90612596565b600081806020019051810190610e5f9190611e49565b60008781526009602090815260409091208251929350610e83929091840190611ae5565b50505050505050565b600b54610ea5908390640100000000900460e01b61132d565b15610f6157600080836001600160a01b031683604051602401610ec89190612624565b60408051601f198184030181529181526020820180516001600160e01b03166303a24d0760e21b17905251610efd9190612245565b6000604051808303816000865af19150503d8060008114610f3a576040519150601f19603f3d011682016040523d82523d6000602084013e610f3f565b606091505b509150915081610e495760405162461bcd60e51b815260040161054a90612556565b73b47e3cd837ddf8e4c57f05d70ab865de6e193bbb6001600160a01b0383161415610fbc576000610f9182611349565b60008581526009602090815260409091208251929350610fb5929091840190611ae5565b5050505050565b60405162461bcd60e51b815260040161054a90612606565b600080548210801561051a575050600090815260046020526040902054600160e01b161590565b6000548161101c5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146110cb57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101611093565b50816110e957604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008160005481101561114157600081815260046020526040902054600160e01b811661113f575b8061113857506000190160008181526004602052604090205461111a565b9392505050565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906111e19033908990889088906004016124ef565b602060405180830381600087803b1580156111fb57600080fd5b505af192505050801561122b575060408051601f3d908101601f1916820190925261122891810190611e2b565b60015b611286573d808015611259576040519150601f19603f3d011682016040523d82523d6000602084013e61125e565b606091505b50805161127e576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6060600060405180610280016040528061024a815260200161283861024a9139905060006112d1846114d9565b6112da836115f3565b6040516020016112eb929190612251565b6040516020818303038152906040529050611305816115f3565b6040516020016113159190612400565b60405160208183030381529060405292505050919050565b600061133883611755565b801561113857506111388383611788565b60606000807316f5a35647d6f03d5d3da7b35409d65ba03af3b26001600160a01b03168460405160240161137d9190612616565b60408051601f198184030181529181526020820180516001600160e01b03166374beb04760e01b179052516113b29190612245565b6000604051808303816000865af19150503d80600081146113ef576040519150601f19603f3d011682016040523d82523d6000602084013e6113f4565b606091505b5091509150816114165760405162461bcd60e51b815260040161054a906125d6565b60008180602001905181019061142c9190611e49565b905060006114448260a261143f85611879565b6119ee565b90506000816040516020016114599190612332565b604051602081830303815290604052905060006114798861ffff166114d9565b611482836115f3565b60405160200161149392919061242e565b60405160208183030381529060405290506114ad816115f3565b6040516020016114bd9190612400565b6040516020818303038152906040529650505050505050919050565b6060816114fd5750506040805180820190915260018152600360fc1b602082015290565b8160005b811561152757806115118161277e565b91506115209050600a83612691565b9150611501565b60008167ffffffffffffffff81111561155057634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561157a576020820181803683370190505b5090505b841561129c5761158f6001836126c4565b915061159c600a86612799565b6115a7906030612679565b60f81b8183815181106115ca57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506115ec600a86612691565b945061157e565b606081516000141561161357505060408051602081019091526000815290565b6000604051806060016040528060408152602001612a8260409139905060006003845160026116429190612679565b61164c9190612691565b6116579060046126a5565b67ffffffffffffffff81111561167d57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156116a7576020820181803683370190505b509050600182016020820185865187015b80821015611713576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453600184019350506116b8565b505060038651066001811461172f57600281146117425761174a565b603d6001830353603d600283035361174a565b603d60018303535b509195945050505050565b6000611768826301ffc9a760e01b611788565b801561051a5750611781826001600160e01b0319611788565b1592915050565b6000806301ffc9a760e01b836040516024016117a49190612537565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050600080856001600160a01b0316617530846040516117f79190612245565b6000604051808303818686fa925050503d8060008114611833576040519150601f19603f3d011682016040523d82523d6000602084013e611838565b606091505b5091509150602081511015611853576000935050505061051a565b81801561186f57508080602001905181019061186f9190611def565b9695505050505050565b600080825b80518210156119e75760078183815181106118a957634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031990811690911c166118d4576118cd600183612679565b91506119d5565b8051600360f91b906005908390859081106118ff57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031990811690911c161415611925576118cd600283612679565b8051600760f91b9060049083908590811061195057634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031990811690911c161415611976576118cd600383612679565b8051600f60f91b906003908390859081106119a157634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031990811690911c1614156119c7576118cd600483612679565b6119d2600183612679565b91505b826119df8161277e565b93505061187e565b5050919050565b60608360006119fd85856126c4565b67ffffffffffffffff811115611a2357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611a4d576020820181803683370190505b509050845b84811015611adb57828181518110611a7a57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191682611a9488846126c4565b81518110611ab257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535080611ad38161277e565b915050611a52565b5095945050505050565b828054611af190612724565b90600052602060002090601f016020900481019282611b135760008555611b59565b82601f10611b2c57805160ff1916838001178555611b59565b82800160010185558215611b59579182015b82811115611b59578251825591602001919060010190611b3e565b50611b65929150611b69565b5090565b5b80821115611b655760008155600101611b6a565b6000611b91611b8c8461264e565b612632565b905082815260208101848484011115611ba957600080fd5b611bb48482856126ec565b509392505050565b6000611bca611b8c8461264e565b905082815260208101848484011115611be257600080fd5b611bb48482856126f8565b803561051a81612805565b803561051a81612819565b805161051a81612819565b803561051a81612821565b805161051a81612821565b600082601f830112611c3557600080fd5b813561129c848260208601611b7e565b600082601f830112611c5657600080fd5b815161129c848260208601611bbc565b803561051a81612831565b600060208284031215611c8357600080fd5b600061129c8484611bed565b60008060408385031215611ca257600080fd5b6000611cae8585611bed565b9250506020611cbf85828601611bed565b9150509250929050565b600080600060608486031215611cde57600080fd5b6000611cea8686611bed565b9350506020611cfb86828701611bed565b9250506040611d0c86828701611c66565b9150509250925092565b60008060008060808587031215611d2c57600080fd5b6000611d388787611bed565b9450506020611d4987828801611bed565b9350506040611d5a87828801611c66565b925050606085013567ffffffffffffffff811115611d7757600080fd5b611d8387828801611c24565b91505092959194509250565b60008060408385031215611da257600080fd5b6000611dae8585611bed565b9250506020611cbf85828601611bf8565b60008060408385031215611dd257600080fd5b6000611dde8585611bed565b9250506020611cbf85828601611c66565b600060208284031215611e0157600080fd5b600061129c8484611c03565b600060208284031215611e1f57600080fd5b600061129c8484611c0e565b600060208284031215611e3d57600080fd5b600061129c8484611c19565b600060208284031215611e5b57600080fd5b815167ffffffffffffffff811115611e7257600080fd5b61129c84828501611c45565b600060208284031215611e9057600080fd5b600061129c8484611c66565b600080600060608486031215611eb157600080fd5b6000611cea8686611c66565b611ec6816126db565b82525050565b801515611ec6565b6001600160e01b03198116611ec6565b6000611eee825190565b808452602084019350611f058185602086016126f8565b601f01601f19169290920192915050565b6000611f20825190565b611f2e8185602086016126f8565b9290920192915050565b60168152600060208201754572726f722067657474696e6720555249206461746160501b815291505b5060200190565b602d81526000602082017f4552433732314d657461646174613a20646974746f496420666f72206e6f6e6581526c3c34b9ba32b73a103a37b5b2b760991b602082015291505b5060400190565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b60208201529150611fae565b602881526000602082017f5472616e7366657220616d6f756e7420746f6f206c6f7720746f20757365205481526772616e73666f726d60c01b60208201529150611fae565b601b81526000602082017f4572726f722067657474696e6720746f6b656e5552492064617461000000000081529150611f61565b602381526000602082017f596f7520617265206e6f7420746865206f776e6572206f66207468697320446981526274746f60e81b60208201529150611fae565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657291019081526000611f61565b602f81526000602082017f4552433732314d657461646174613a2055524920717565727920666f72206e6f81526e3732bc34b9ba32b73a103a37b5b2b760891b60208201529150611fae565b601781526000602082017f4572726f722067657474696e672050756e6b206461746100000000000000000081529150611f61565b602781526000602082017f596f7520617265206e6f7420616c6c6f77656420746f206d696e74206d6f726581526620446974746f7360c81b60208201529150611fae565b601b81526000602082017f4d6178206c696d6974206f6620446974746f732072656163686564000000000081529150611f61565b603981526000602082017f50726f76696465642061646472657373206973206e6f7420636f6d706174696281527f6c65207769746820455243373231206f7220455243313135350000000000000060208201529150611fae565b61ffff8116611ec6565b80611ec6565b60006111388284611f16565b707b226e616d65223a2022446974746f202360781b815260110160006122778285611f16565b7f222c20226465736372697074696f6e223a2022446974746f2063616e2075736581527f205472616e73666f726d20746f206d696d6963206120646966666572656e742060208201527f455243373231206f72204552433131353520746f6b656e2e222c2022696d616760408201527f65223a2022646174613a696d6167652f7376672b786d6c3b6261736536342c0060608201529150607f82015b915061231f8284611f16565b61227d60f01b815291506002820161129c565b7f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323081527f30302f737667222076657273696f6e3d22312e32222076696577426f783d223060208201527f2030203234203234223e3c7265637420783d22302220793d223022207769647460408201527f683d22323422206865696768743d223234222073686170652d72656e6465726960608201527f6e673d2263726973704564676573222066696c6c3d2223363338353936222f3e6080820152600060a082015b91506111388284611f16565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000601d82016123f4565b757b226e616d65223a202243727970746f50756e6b202360501b815260160160006124598285611f16565b7f222c20226465736372697074696f6e223a2022446974746f207573656420547281527f616e73666f726d2120497427732073757065722065666665637469766521222c60208201527f2022696d616765223a2022646174613a696d6167652f7376672b786d6c3b62616040820152641cd94d8d0b60da1b6060820152915060658201612313565b6020810161051a8284611ebd565b608081016124fd8287611ebd565b61250a6020830186611ebd565b612517604083018561223f565b818103606083015261186f8184611ee4565b6020810161051a8284611ecc565b6020810161051a8284611ed4565b602080825281016111388184611ee4565b6020808252810161051a81611f38565b6020808252810161051a81611f68565b6020808252810161051a81611fb5565b6020808252810161051a81611ff8565b6020808252810161051a8161203d565b6020808252810161051a81612071565b6020808252810161051a816120b1565b6020808252810161051a816120e3565b6020808252810161051a8161212f565b6020808252810161051a81612163565b6020808252810161051a816121a7565b6020808252810161051a816121db565b6020810161051a8284612235565b6020810161051a828461223f565b600061263d60405190565b90506126498282612751565b919050565b600067ffffffffffffffff821115612668576126686127ef565b601f19601f83011660200192915050565b6000821982111561268c5761268c6127ad565b500190565b6000826126a0576126a06127c3565b500490565b60008160001904831182151516156126bf576126bf6127ad565b500290565b6000828210156126d6576126d66127ad565b500390565b60006001600160a01b03821661051a565b82818337506000910152565b60005b838110156127135781810151838201526020016126fb565b83811115610b8a5750506000910152565b60028104600182168061273857607f821691505b6020821081141561274b5761274b6127d9565b50919050565b601f19601f830116810181811067ffffffffffffffff82111715612777576127776127ef565b6040525050565b6000600019821415612792576127926127ad565b5060010190565b6000826127a8576127a86127c3565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b61280e816126db565b81146109ff57600080fd5b80151561280e565b6001600160e01b0319811661280e565b8061280e56fe3c7376672076696577426f783d22302030203234203234222066696c6c3d226e6f6e652220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f737667223e3c706174682066696c6c3d22234435464346462220643d224d30203068323476323448307a222f3e3c706174682066696c6c3d22234646413443372220643d224d362031376834763148367a6d362d313068337631682d337a4d3820376832763148387a6d352d3168327631682d327a6d2d3120313168347631682d347a6d2d372d37683134763748357a222f3e3c706174682066696c6c3d22234646413443372220643d224d362038683133763348367a222f3e3c706174682066696c6c3d22233030302220643d224d342031336831763448347a6d322d356831763248367a6d31302d3168337631682d337a6d2d312d3168317632682d317a4d362031386834763148367a6d342d3168327631682d327a6d342d3768327631682d327a6d2d3720346832763148377a6d39203368327631682d327a6d322d3168317631682d317a4d352031376831763148357a6d342d346831763148397a6d312d3468317631682d317a6d342d3168317631682d317a6d2d3220313068347631682d347a6d2d322d3768347631682d347a6d38203068317632682d317a6d31203268317633682d317a6d302d3568317634682d317a4d3720376831763148377a6d362d3268327631682d327a6d2d31203168317631682d317a6d2d32203168327631682d327a4d3820366832763148387a6d2d3320346831763348357a222f3e3c2f7376673e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220479a4d0db4d3eeed26cb8f8dc9521d89e98b4df2b0d4d78b331072d5d8bc254164736f6c63430008040033

Deployed Bytecode

0x60806040526004361061019c5760003560e01c806370a08231116100ec578063b75694881161008a578063e985e9c511610064578063e985e9c514610453578063f0292a0314610473578063f2fde38b1461049b578063f6e9936a146104bb57600080fd5b8063b7569488146103fd578063b88d4fde14610413578063c87b56dd1461043357600080fd5b806395d89b41116100c657806395d89b411461039d578063a22cb465146103b2578063b12dc991146103d2578063b662dc9b146103e757600080fd5b806370a082311461034a578063715018a61461036a5780638da5cb5b1461037f57600080fd5b806318160ddd1161015957806342842e0e1161013357806342842e0e146102d55780635e29ec46146102f55780635f589e42146103155780636352211e1461032a57600080fd5b806318160ddd1461027d57806323b872dd1461029f57806332cb6b0c146102bf57600080fd5b806301ffc9a7146101a15780630433d1c8146101d757806306fdde03146101f9578063081812fc1461021b578063095ea7b3146102485780631249c58b14610268575b600080fd5b3480156101ad57600080fd5b506101c16101bc366004611e0d565b6104ce565b6040516101ce9190612529565b60405180910390f35b3480156101e357600080fd5b506101f76101f2366004611e7e565b610520565b005b34801561020557600080fd5b5061020e610558565b6040516101ce9190612545565b34801561022757600080fd5b5061023b610236366004611e7e565b6105ea565b6040516101ce91906124e1565b34801561025457600080fd5b506101f7610263366004611dbf565b61062e565b34801561027457600080fd5b506101f76106ce565b34801561028957600080fd5b50600154600054035b6040516101ce9190612624565b3480156102ab57600080fd5b506101f76102ba366004611cc9565b61076a565b3480156102cb57600080fd5b50610292600e5481565b3480156102e157600080fd5b506101f76102f0366004611cc9565b6108fb565b34801561030157600080fd5b506101f7610310366004611e7e565b61091b565b34801561032157600080fd5b506101f761099c565b34801561033657600080fd5b5061023b610345366004611e7e565b610a02565b34801561035657600080fd5b50610292610365366004611c71565b610a0d565b34801561037657600080fd5b506101f7610a5c565b34801561038b57600080fd5b506008546001600160a01b031661023b565b3480156103a957600080fd5b5061020e610a92565b3480156103be57600080fd5b506101f76103cd366004611d8f565b610aa1565b3480156103de57600080fd5b506101f7610b10565b3480156103f357600080fd5b50610292600f5481565b34801561040957600080fd5b50610292600c5481565b34801561041f57600080fd5b506101f761042e366004611d16565b610b46565b34801561043f57600080fd5b5061020e61044e366004611e7e565b610b90565b34801561045f57600080fd5b506101c161046e366004611c8f565b610c7e565b34801561047f57600080fd5b50600d5461048e9061ffff1681565b6040516101ce9190612616565b3480156104a757600080fd5b506101f76104b6366004611c71565b610cac565b6101f76104c9366004611e9c565b610d05565b60006301ffc9a760e01b6001600160e01b0319831614806104ff57506380ac58cd60e01b6001600160e01b03198316145b8061051a5750635b5e139f60e01b6001600160e01b03198316145b92915050565b6008546001600160a01b031633146105535760405162461bcd60e51b815260040161054a906125b6565b60405180910390fd5b600c55565b60606002805461056790612724565b80601f016020809104026020016040519081016040528092919081815260200182805461059390612724565b80156105e05780601f106105b5576101008083540402835291602001916105e0565b820191906000526020600020905b8154815290600101906020018083116105c357829003601f168201915b5050505050905090565b60006105f582610fd4565b610612576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061063982610a02565b9050336001600160a01b03821614610672576106558133610c7e565b610672576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600d54336000908152600a602052604090205461ffff909116116107045760405162461bcd60e51b815260040161054a906125e6565b600e54600f546001546000540361071b9190612679565b106107385760405162461bcd60e51b815260040161054a906125f6565b610743336001610ffb565b336000908152600a60205260408120805460019290610763908490612679565b9091555050565b6000610775826110f2565b9050836001600160a01b0316816001600160a01b0316146107a85760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b038816909114176107f5576107d88633610c7e565b6107f557604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661081c57604051633a954ecd60e21b815260040160405180910390fd5b801561082757600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b83166108b257600184016000818152600460205260409020546108b05760005481146108b05760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b61091683838360405180602001604052806000815250610b46565b505050565b61092481610fd4565b6109405760405162461bcd60e51b815260040161054a90612566565b3361094a82610a02565b6001600160a01b0316146109705760405162461bcd60e51b815260040161054a906125a6565b6040805160208082018084526000808452858152600990925292902090516109989290611ae5565b5050565b6008546001600160a01b031633146109c65760405162461bcd60e51b815260040161054a906125b6565b6008546040516001600160a01b03909116904780156108fc02916000818181858888f193505050501580156109ff573d6000803e3d6000fd5b50565b600061051a826110f2565b60006001600160a01b038216610a36576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6008546001600160a01b03163314610a865760405162461bcd60e51b815260040161054a906125b6565b610a90600061115a565b565b60606003805461056790612724565b3360008181526007602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190610b04908590612529565b60405180910390a35050565b6008546001600160a01b03163314610b3a5760405162461bcd60e51b815260040161054a906125b6565b610a9033600f54610ffb565b610b5184848461076a565b6001600160a01b0383163b15610b8a57610b6d848484846111ac565b610b8a576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6060610b9b82610fd4565b610bb75760405162461bcd60e51b815260040161054a906125c6565b60008281526009602052604090208054610bd090612724565b159050610c755760008281526009602052604090208054610bf090612724565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1c90612724565b8015610c695780601f10610c3e57610100808354040283529160200191610c69565b820191906000526020600020905b815481529060010190602001808311610c4c57829003601f168201915b50505050509050919050565b61051a826112a4565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6008546001600160a01b03163314610cd65760405162461bcd60e51b815260040161054a906125b6565b6001600160a01b038116610cfc5760405162461bcd60e51b815260040161054a90612576565b6109ff8161115a565b610d0e83610fd4565b610d2a5760405162461bcd60e51b815260040161054a90612566565b33610d3484610a02565b6001600160a01b031614610d5a5760405162461bcd60e51b815260040161054a906125a6565b600c54341015610d7c5760405162461bcd60e51b815260040161054a90612586565b600b54610d8d90839060e01b61132d565b15610e8c57600080836001600160a01b031683604051602401610db09190612624565b60408051601f198184030181529181526020820180516001600160e01b031663c87b56dd60e01b17905251610de59190612245565b6000604051808303816000865af19150503d8060008114610e22576040519150601f19603f3d011682016040523d82523d6000602084013e610e27565b606091505b509150915081610e495760405162461bcd60e51b815260040161054a90612596565b600081806020019051810190610e5f9190611e49565b60008781526009602090815260409091208251929350610e83929091840190611ae5565b50505050505050565b600b54610ea5908390640100000000900460e01b61132d565b15610f6157600080836001600160a01b031683604051602401610ec89190612624565b60408051601f198184030181529181526020820180516001600160e01b03166303a24d0760e21b17905251610efd9190612245565b6000604051808303816000865af19150503d8060008114610f3a576040519150601f19603f3d011682016040523d82523d6000602084013e610f3f565b606091505b509150915081610e495760405162461bcd60e51b815260040161054a90612556565b73b47e3cd837ddf8e4c57f05d70ab865de6e193bbb6001600160a01b0383161415610fbc576000610f9182611349565b60008581526009602090815260409091208251929350610fb5929091840190611ae5565b5050505050565b60405162461bcd60e51b815260040161054a90612606565b600080548210801561051a575050600090815260046020526040902054600160e01b161590565b6000548161101c5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146110cb57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101611093565b50816110e957604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008160005481101561114157600081815260046020526040902054600160e01b811661113f575b8061113857506000190160008181526004602052604090205461111a565b9392505050565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906111e19033908990889088906004016124ef565b602060405180830381600087803b1580156111fb57600080fd5b505af192505050801561122b575060408051601f3d908101601f1916820190925261122891810190611e2b565b60015b611286573d808015611259576040519150601f19603f3d011682016040523d82523d6000602084013e61125e565b606091505b50805161127e576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6060600060405180610280016040528061024a815260200161283861024a9139905060006112d1846114d9565b6112da836115f3565b6040516020016112eb929190612251565b6040516020818303038152906040529050611305816115f3565b6040516020016113159190612400565b60405160208183030381529060405292505050919050565b600061133883611755565b801561113857506111388383611788565b60606000807316f5a35647d6f03d5d3da7b35409d65ba03af3b26001600160a01b03168460405160240161137d9190612616565b60408051601f198184030181529181526020820180516001600160e01b03166374beb04760e01b179052516113b29190612245565b6000604051808303816000865af19150503d80600081146113ef576040519150601f19603f3d011682016040523d82523d6000602084013e6113f4565b606091505b5091509150816114165760405162461bcd60e51b815260040161054a906125d6565b60008180602001905181019061142c9190611e49565b905060006114448260a261143f85611879565b6119ee565b90506000816040516020016114599190612332565b604051602081830303815290604052905060006114798861ffff166114d9565b611482836115f3565b60405160200161149392919061242e565b60405160208183030381529060405290506114ad816115f3565b6040516020016114bd9190612400565b6040516020818303038152906040529650505050505050919050565b6060816114fd5750506040805180820190915260018152600360fc1b602082015290565b8160005b811561152757806115118161277e565b91506115209050600a83612691565b9150611501565b60008167ffffffffffffffff81111561155057634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561157a576020820181803683370190505b5090505b841561129c5761158f6001836126c4565b915061159c600a86612799565b6115a7906030612679565b60f81b8183815181106115ca57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506115ec600a86612691565b945061157e565b606081516000141561161357505060408051602081019091526000815290565b6000604051806060016040528060408152602001612a8260409139905060006003845160026116429190612679565b61164c9190612691565b6116579060046126a5565b67ffffffffffffffff81111561167d57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156116a7576020820181803683370190505b509050600182016020820185865187015b80821015611713576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453600184019350506116b8565b505060038651066001811461172f57600281146117425761174a565b603d6001830353603d600283035361174a565b603d60018303535b509195945050505050565b6000611768826301ffc9a760e01b611788565b801561051a5750611781826001600160e01b0319611788565b1592915050565b6000806301ffc9a760e01b836040516024016117a49190612537565b604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050600080856001600160a01b0316617530846040516117f79190612245565b6000604051808303818686fa925050503d8060008114611833576040519150601f19603f3d011682016040523d82523d6000602084013e611838565b606091505b5091509150602081511015611853576000935050505061051a565b81801561186f57508080602001905181019061186f9190611def565b9695505050505050565b600080825b80518210156119e75760078183815181106118a957634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031990811690911c166118d4576118cd600183612679565b91506119d5565b8051600360f91b906005908390859081106118ff57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031990811690911c161415611925576118cd600283612679565b8051600760f91b9060049083908590811061195057634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031990811690911c161415611976576118cd600383612679565b8051600f60f91b906003908390859081106119a157634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031990811690911c1614156119c7576118cd600483612679565b6119d2600183612679565b91505b826119df8161277e565b93505061187e565b5050919050565b60608360006119fd85856126c4565b67ffffffffffffffff811115611a2357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611a4d576020820181803683370190505b509050845b84811015611adb57828181518110611a7a57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191682611a9488846126c4565b81518110611ab257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535080611ad38161277e565b915050611a52565b5095945050505050565b828054611af190612724565b90600052602060002090601f016020900481019282611b135760008555611b59565b82601f10611b2c57805160ff1916838001178555611b59565b82800160010185558215611b59579182015b82811115611b59578251825591602001919060010190611b3e565b50611b65929150611b69565b5090565b5b80821115611b655760008155600101611b6a565b6000611b91611b8c8461264e565b612632565b905082815260208101848484011115611ba957600080fd5b611bb48482856126ec565b509392505050565b6000611bca611b8c8461264e565b905082815260208101848484011115611be257600080fd5b611bb48482856126f8565b803561051a81612805565b803561051a81612819565b805161051a81612819565b803561051a81612821565b805161051a81612821565b600082601f830112611c3557600080fd5b813561129c848260208601611b7e565b600082601f830112611c5657600080fd5b815161129c848260208601611bbc565b803561051a81612831565b600060208284031215611c8357600080fd5b600061129c8484611bed565b60008060408385031215611ca257600080fd5b6000611cae8585611bed565b9250506020611cbf85828601611bed565b9150509250929050565b600080600060608486031215611cde57600080fd5b6000611cea8686611bed565b9350506020611cfb86828701611bed565b9250506040611d0c86828701611c66565b9150509250925092565b60008060008060808587031215611d2c57600080fd5b6000611d388787611bed565b9450506020611d4987828801611bed565b9350506040611d5a87828801611c66565b925050606085013567ffffffffffffffff811115611d7757600080fd5b611d8387828801611c24565b91505092959194509250565b60008060408385031215611da257600080fd5b6000611dae8585611bed565b9250506020611cbf85828601611bf8565b60008060408385031215611dd257600080fd5b6000611dde8585611bed565b9250506020611cbf85828601611c66565b600060208284031215611e0157600080fd5b600061129c8484611c03565b600060208284031215611e1f57600080fd5b600061129c8484611c0e565b600060208284031215611e3d57600080fd5b600061129c8484611c19565b600060208284031215611e5b57600080fd5b815167ffffffffffffffff811115611e7257600080fd5b61129c84828501611c45565b600060208284031215611e9057600080fd5b600061129c8484611c66565b600080600060608486031215611eb157600080fd5b6000611cea8686611c66565b611ec6816126db565b82525050565b801515611ec6565b6001600160e01b03198116611ec6565b6000611eee825190565b808452602084019350611f058185602086016126f8565b601f01601f19169290920192915050565b6000611f20825190565b611f2e8185602086016126f8565b9290920192915050565b60168152600060208201754572726f722067657474696e6720555249206461746160501b815291505b5060200190565b602d81526000602082017f4552433732314d657461646174613a20646974746f496420666f72206e6f6e6581526c3c34b9ba32b73a103a37b5b2b760991b602082015291505b5060400190565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181526564647265737360d01b60208201529150611fae565b602881526000602082017f5472616e7366657220616d6f756e7420746f6f206c6f7720746f20757365205481526772616e73666f726d60c01b60208201529150611fae565b601b81526000602082017f4572726f722067657474696e6720746f6b656e5552492064617461000000000081529150611f61565b602381526000602082017f596f7520617265206e6f7420746865206f776e6572206f66207468697320446981526274746f60e81b60208201529150611fae565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657291019081526000611f61565b602f81526000602082017f4552433732314d657461646174613a2055524920717565727920666f72206e6f81526e3732bc34b9ba32b73a103a37b5b2b760891b60208201529150611fae565b601781526000602082017f4572726f722067657474696e672050756e6b206461746100000000000000000081529150611f61565b602781526000602082017f596f7520617265206e6f7420616c6c6f77656420746f206d696e74206d6f726581526620446974746f7360c81b60208201529150611fae565b601b81526000602082017f4d6178206c696d6974206f6620446974746f732072656163686564000000000081529150611f61565b603981526000602082017f50726f76696465642061646472657373206973206e6f7420636f6d706174696281527f6c65207769746820455243373231206f7220455243313135350000000000000060208201529150611fae565b61ffff8116611ec6565b80611ec6565b60006111388284611f16565b707b226e616d65223a2022446974746f202360781b815260110160006122778285611f16565b7f222c20226465736372697074696f6e223a2022446974746f2063616e2075736581527f205472616e73666f726d20746f206d696d6963206120646966666572656e742060208201527f455243373231206f72204552433131353520746f6b656e2e222c2022696d616760408201527f65223a2022646174613a696d6167652f7376672b786d6c3b6261736536342c0060608201529150607f82015b915061231f8284611f16565b61227d60f01b815291506002820161129c565b7f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323081527f30302f737667222076657273696f6e3d22312e32222076696577426f783d223060208201527f2030203234203234223e3c7265637420783d22302220793d223022207769647460408201527f683d22323422206865696768743d223234222073686170652d72656e6465726960608201527f6e673d2263726973704564676573222066696c6c3d2223363338353936222f3e6080820152600060a082015b91506111388284611f16565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000601d82016123f4565b757b226e616d65223a202243727970746f50756e6b202360501b815260160160006124598285611f16565b7f222c20226465736372697074696f6e223a2022446974746f207573656420547281527f616e73666f726d2120497427732073757065722065666665637469766521222c60208201527f2022696d616765223a2022646174613a696d6167652f7376672b786d6c3b62616040820152641cd94d8d0b60da1b6060820152915060658201612313565b6020810161051a8284611ebd565b608081016124fd8287611ebd565b61250a6020830186611ebd565b612517604083018561223f565b818103606083015261186f8184611ee4565b6020810161051a8284611ecc565b6020810161051a8284611ed4565b602080825281016111388184611ee4565b6020808252810161051a81611f38565b6020808252810161051a81611f68565b6020808252810161051a81611fb5565b6020808252810161051a81611ff8565b6020808252810161051a8161203d565b6020808252810161051a81612071565b6020808252810161051a816120b1565b6020808252810161051a816120e3565b6020808252810161051a8161212f565b6020808252810161051a81612163565b6020808252810161051a816121a7565b6020808252810161051a816121db565b6020810161051a8284612235565b6020810161051a828461223f565b600061263d60405190565b90506126498282612751565b919050565b600067ffffffffffffffff821115612668576126686127ef565b601f19601f83011660200192915050565b6000821982111561268c5761268c6127ad565b500190565b6000826126a0576126a06127c3565b500490565b60008160001904831182151516156126bf576126bf6127ad565b500290565b6000828210156126d6576126d66127ad565b500390565b60006001600160a01b03821661051a565b82818337506000910152565b60005b838110156127135781810151838201526020016126fb565b83811115610b8a5750506000910152565b60028104600182168061273857607f821691505b6020821081141561274b5761274b6127d9565b50919050565b601f19601f830116810181811067ffffffffffffffff82111715612777576127776127ef565b6040525050565b6000600019821415612792576127926127ad565b5060010190565b6000826127a8576127a86127c3565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b61280e816126db565b81146109ff57600080fd5b80151561280e565b6001600160e01b0319811661280e565b8061280e56fe3c7376672076696577426f783d22302030203234203234222066696c6c3d226e6f6e652220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f737667223e3c706174682066696c6c3d22234435464346462220643d224d30203068323476323448307a222f3e3c706174682066696c6c3d22234646413443372220643d224d362031376834763148367a6d362d313068337631682d337a4d3820376832763148387a6d352d3168327631682d327a6d2d3120313168347631682d347a6d2d372d37683134763748357a222f3e3c706174682066696c6c3d22234646413443372220643d224d362038683133763348367a222f3e3c706174682066696c6c3d22233030302220643d224d342031336831763448347a6d322d356831763248367a6d31302d3168337631682d337a6d2d312d3168317632682d317a4d362031386834763148367a6d342d3168327631682d327a6d342d3768327631682d327a6d2d3720346832763148377a6d39203368327631682d327a6d322d3168317631682d317a4d352031376831763148357a6d342d346831763148397a6d312d3468317631682d317a6d342d3168317631682d317a6d2d3220313068347631682d347a6d2d322d3768347631682d347a6d38203068317632682d317a6d31203268317633682d317a6d302d3568317634682d317a4d3720376831763148377a6d362d3268327631682d327a6d2d31203168317631682d317a6d2d32203168327631682d327a4d3820366832763148387a6d2d3320346831763348357a222f3e3c2f7376673e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220479a4d0db4d3eeed26cb8f8dc9521d89e98b4df2b0d4d78b331072d5d8bc254164736f6c63430008040033

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.