ETH Price: $3,353.37 (+0.56%)

Token

Squiggle Farewell (SF#9998)
 

Overview

Max Total Supply

469 SF#9998

Holders

469

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
nix.eth
Balance
1 SF#9998
0x3424cd7d170949636c300e62674a3dfb7706fc35
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
SquiggleFarewell

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 15 : SquiggleFarewell.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;

/**
@title  SquiggleFarewell
@author marka
@notice Much ♥ to Erick / Snowfro 
*/

import "erc721a/contracts/ERC721A.sol";
import "erc721a/contracts/extensions/ERC721ABurnable.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Utils} from "./Utils.sol";
import {IScriptyBuilderV2, HTMLRequest, HTMLTagType, HTMLTag} from "../lib/scripty/interfaces/IScriptyBuilderV2.sol";

interface IArtBlocks {
    function ownerOf(uint256 tokenId) external view returns (address);

    function showTokenHashes(
        uint256 _tokenId
    ) external view returns (bytes32[] memory);

    function projectScriptByIndex(
        uint256 _projectId,
        uint256 _index
    ) external view returns (string memory);
}

interface IRelic {
    function inscriptions(uint256 id) external view returns (address);

    function message() external view returns (string memory);
}

contract SquiggleFarewell is ERC721A, ERC721ABurnable, Ownable {

    address constant snowfroAddress = 0xf3860788D1597cecF938424bAABe976FaC87dC26; 

    address public immutable scriptyBuilderAddress =
        0xD7587F110E08F4D120A231bA97d3B577A81Df022;
    address public immutable scriptyStorageAddress =
        0xbD11994aABB55Da86DC246EBB17C1Be0af5b7699;
    address public immutable ethfsFileStorageAddress =
        0x8FAA1AAb9DA8c75917C43Fb24fDdb513edDC3245;

    IArtBlocks public artblocks =
        IArtBlocks(0x059EDD72Cd353dF5106D2B9cC5ab83a52287aC3a);
    IRelic public relic = IRelic(0x9b917686DD68B68A780cB8Bf70aF46617A7b3f80);

    error NotSnowfro();
    error MintClosed();
    error NoContracts();
    error InvalidInscriptionId();
    error InscriptionIdMismatch();
    error TokenAlreadyMinted();

    uint256 public constant MAX_SUPPLY = 3149;
    bool mintEnabled;
    mapping(uint256 => address) public farewells;
    mapping(uint256 => uint256) public farewellsOrder;

    event MintedFarewell(address a, uint tokenId);

    constructor() ERC721A("Squiggle Farewell", "SF#9998") Ownable(msg.sender) {}

    function mintTokenZero() public {
        if (msg.sender != snowfroAddress) revert NotSnowfro();
        if (_exists(0)) revert TokenAlreadyMinted();

        farewells[0] = snowfroAddress;
        farewellsOrder[0] = 0;

        _mint(snowfroAddress, 1);

        mintEnabled = true;

        emit MintedFarewell(snowfroAddress, 0);
    }

    function mint(uint256 _inscriptionId) public {
        if (mintEnabled == false) revert MintClosed();
        if (_inscriptionId < 0 || _inscriptionId >= MAX_SUPPLY)
            revert InvalidInscriptionId();
        if (relic.inscriptions(_inscriptionId) != msg.sender)
            revert InscriptionIdMismatch();
        if (_exists(_inscriptionId)) revert TokenAlreadyMinted();

        address a = msg.sender;
        farewells[_inscriptionId] = a;
        uint256 orderId = uint256(totalSupply());
        farewellsOrder[_inscriptionId] = orderId;

        // non-consecutive mints, except for inscriptionId == 0 (tokenZero)
        _mintSpot(a, _inscriptionId);

        emit MintedFarewell(a, _inscriptionId);
    }

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

        return renderAsDataUri(_tokenId);
    }

    function renderAsDataUri(
        uint256 _tokenId
    ) public view returns (string memory) {

        // image generation and metadata

        string memory colorRelic;
        string memory colorFarewell;
        string memory matchedOrder = "No";
        uint256 hueRelic;
        uint256 hueFarewell;

        uint256 farewellOrder = farewellsOrder[_tokenId];
        
        uint256 positionRelic = 5000 - mapValue(_tokenId, 0, 3148, 0, 2500);
        uint256 positionFarewell = 5000 + mapValue(farewellsOrder[_tokenId], 0, 3148, 0, 2500);

        
        // let there be light
        if (_tokenId == farewellOrder) {
            hueRelic = 9998;
            hueFarewell = 9998;
            colorRelic = "hsl(9998, 0%, 100%)"; // any hsl color with 100% light will be white
            colorFarewell = "hsl(9998, 0%, 100%)"; // any hsl color with 100% light will be white
            matchedOrder = "Yes";
        } 
        else {
            hueRelic = mapValue(_tokenId % 3150, 0, 3149, 0, 360);
            colorRelic = string(
                abi.encodePacked("hsl(", Utils.uint2str(hueRelic), ", 100%, 50%)")
            );

            hueFarewell = mapValue(farewellOrder % 3150, 0, 3149, 0, 360);
            colorFarewell= string(
                abi.encodePacked("hsl(", Utils.uint2str(hueFarewell), ", 100%, 50%)")
            );
        }

        string memory squiggleSVG = generateSVG(colorRelic, colorFarewell, positionRelic, positionFarewell);
        string memory imageMetadata = string.concat(
            '"image":"data:image/svg+xml;base64,',
            Utils.encode(bytes(squiggleSVG)),
            '"'
        );

        // squiggle composability

        uint256 squiggleTokenPrimaryId = 9998;
        uint256 squiggleTokenFallbackId = 0;
        uint256 squiggleTokenId = squiggleTokenPrimaryId;
        bytes32 squiggleHashBytes32;

        if (isArtBlocksTokenMinted(squiggleTokenPrimaryId)) {
            squiggleTokenId = squiggleTokenPrimaryId;
            squiggleHashBytes32 = artblocks.showTokenHashes(
                squiggleTokenPrimaryId
            )[0];
        } else {
            squiggleTokenId = squiggleTokenFallbackId;
            squiggleHashBytes32 = artblocks.showTokenHashes(
                squiggleTokenFallbackId
            )[0];
        }

        string memory squiggleHashString = Utils.bytes32ToHexString(
            squiggleHashBytes32
        );

        // scripty.sol & ethfs.xyz

        // css
        HTMLTag[] memory headTags = new HTMLTag[](2);
        headTags[0]
            .tagOpen = "%253Cmeta%2520name%253D%2522viewport%2522%2520content%253D%2522width%253Ddevice-width%252C%2520initial-scale%253D1%252C%2520maximum-scale%253D1%2522%253E";
        headTags[1].tagOpen = "%253Cstyle%253E";
        headTags[1]
            .tagContent = "html%2520%257B%250A%2520%2520height%253A%2520100%2525%253B%250A%257D%250Abody%2520%257B%250A%2520%2520min-height%253A%2520100%2525%253B%250A%2520%2520margin%253A%25200%253B%250A%2520%2520padding%253A%25200%253B%250A%257D%250Acanvas%2520%257B%250A%2520%2520padding%253A%25200%253B%250A%2520%2520margin%253A%2520auto%253B%250A%2520%2520display%253A%2520block%253B%250A%2520%2520position%253A%2520absolute%253B%250A%2520%2520top%253A%25200%253B%250A%2520%2520bottom%253A%25200%253B%250A%2520%2520left%253A%25200%253B%250A%2520%2520right%253A%25200%253B%250A%257D";
        headTags[1].tagClose = "%253C%252Fstyle%253E";

        // p5.js from ethfs.xyz
        HTMLTag[] memory bodyTags = new HTMLTag[](4);
        bodyTags[0].name = "p5-v1.5.0.min.js.gz";
        bodyTags[0].tagType = HTMLTagType.scriptGZIPBase64DataURI;
        bodyTags[0].contractAddress = ethfsFileStorageAddress;

        // gunzipScripts from scripty.sol
        bodyTags[1].name = "gunzipScripts-0.0.1";
        bodyTags[1].tagType = HTMLTagType.script;
        bodyTags[1].contractAddress = scriptyStorageAddress;

        // p5.js script ala ArtBlocks generator
        bodyTags[2]
            .tagOpen = "%253Cscript%2520src%253D%2522data%253Atext%252Fjavascript%253Bbase64%252C";
        string memory squiggleHashCombinedString = string.concat(
            'let tokenData = {"tokenId":"',
            Utils.toString(squiggleTokenId),
            '","hashes":["0x',
            squiggleHashString,
            '"]}'
        );
        string memory squiggleHashCombinedStringBase64 = Utils.encode(
            bytes(squiggleHashCombinedString)
        );
        bodyTags[2].tagContent = bytes(squiggleHashCombinedStringBase64);
        bodyTags[2].tagClose = "%2522%253E%253C%252Fscript%253E";

        // p5.js Squiggle script, modified
        bodyTags[3]
            .tagOpen = "%253Cscript%2520src%253D%2522data%253Atext%252Fjavascript%253Bbase64%252C";

        string memory squiggleScriptBase64 = getModifiedArtBlocksScript(_tokenId);

        bodyTags[3].tagContent = bytes(squiggleScriptBase64);
        bodyTags[3].tagClose = "%2522%253E%253C%252Fscript%253E";

        // create scripty htmlRequest
        HTMLRequest memory htmlRequest;
        htmlRequest.headTags = headTags;
        htmlRequest.bodyTags = bodyTags;

        // encode scripty htmlRequest
        bytes memory doubleURLEncodedHTMLDataURI = IScriptyBuilderV2(
            scriptyBuilderAddress
        ).getHTMLURLSafe(htmlRequest);

        // complete metadata
        return
            string(
                abi.encodePacked(
                    "data:application/json,",
                    "%7B%22name%22%3A%22Squiggle%20Farewell%20%23", // {"name":"Squiggle Farewell #
                    Utils.toString(_tokenId),
                    "%22%2C%20%22description%22%3A%22A%20token%20representing%20your%20inscription%20on%20the%20Relic%20contract%20that%20produces%20a%20fully%20on-chain%20Squiggle%20%239998%22%2C", // ", "description":"A token representing your inscription on the Relic contract that produces a fully on-chain Squiggle #9998",
                    "%22attributes%22%3A%5B", // "attributes":[
                    "%7B%22trait_type%22%3A%22Hue%20Relic%22%2C%22value%22%3A%22", //{"trait_type":"Hue Relic","value":"
                    Utils.toString(hueRelic),
                    "%22%7D", // "}
                    "%2C%7B%22trait_type%22%3A%22Hue%20Farewell%22%2C%22value%22%3A%22", // ,{"trait_type":"Hue Farewell","value":"
                    Utils.toString(hueFarewell),
                    "%22%7D", // "}
                    "%2C%7B%22trait_type%22%3A%22Order%20Relic%22%2C%22value%22%3A%22", // ,{"trait_type":"Order Relic","value":"
                    Utils.toString(_tokenId),
                    "%22%7D", // "}
                    "%2C%7B%22trait_type%22%3A%22Order%20Farewell%22%2C%22value%22%3A%22", // ,{"trait_type":"Order Farewell","value":"
                    Utils.toString(farewellOrder),
                    "%22%7D", // "}
                    "%2C%7B%22trait_type%22%3A%22Matched%20Order%22%2C%22value%22%3A%22", // ,{"trait_type":"Matched Order","value":"
                    matchedOrder,
                    "%22%7D", // "}
                    "%5D", // ]
                    "%2C", // ,
                    imageMetadata,
                    "%2C", // ,
                    "%22animation_url%22%3A%22", // "animation_url":"
                    doubleURLEncodedHTMLDataURI,
                    "%22%7D" // "}
                )
            );
    }

    function isArtBlocksTokenMinted(uint256 _tokenId) public view returns (bool) {
        try artblocks.ownerOf(_tokenId) returns (address owner) {
            return owner != address(0);
        } catch {
            return false;
        }
    }

    function mapValue(
        uint256 _value,
        uint256 _minInput,
        uint256 _maxInput,
        uint256 _minOutput,
        uint256 _maxOutput
    ) internal pure returns (uint256) {
        return
            _minOutput +
            ((_value - _minInput) * (_maxOutput - _minOutput)) /
            (_maxInput - _minInput);
    }

    function generateSVG(
        string memory _colorRelic,
        string memory _colorFarewell,
        uint256 _positionRelic,
        uint256 _positionFarewell
    ) public pure returns (string memory) {
        
        return
            string(
                abi.encodePacked(
                    '<svg viewBox="0 0 10000 10000" xmlns="http://www.w3.org/2000/svg" style="width: 100%; height: 100%; background-color: black;">',
                    '<circle cx="',
                    Utils.uint2str(_positionRelic),
                    '" cy="',
                    Utils.uint2str(5000),
                    '" r="400" fill="none" stroke-width="100" stroke="',
                    _colorRelic,
                    '" />',
                    '<circle cx="',
                    Utils.uint2str(_positionFarewell),
                    '" cy="',
                    Utils.uint2str(5000),
                    '" r="400" fill="none" stroke-width="100" stroke="',
                    _colorFarewell,
                    '" />',
                    "</svg>"
                )
            );
    }

    // required for _mintSpot
    function _sequentialUpTo()
        internal
        view
        virtual
        override
        returns (uint256)
    {
        return 0;
    }

    // Not required as defaults to 0
    // function _startTokenId() internal view virtual override returns (uint) {
    //     return 0;
    // }

    function setMintOpen(bool _val) external onlyOwner {
        mintEnabled = _val;
    }

    function withdraw() external onlyOwner {
        (bool sent, ) = payable(owner()).call{value: address(this).balance}("");
        require(sent, "Withdraw failed");
    }

    // Script Replace Functions

    function getModifiedArtBlocksScript(uint256 _tokenId) public view returns (string memory) {
        // Get the script from the artblocks contract
        bytes memory squiggleScript = bytes(
            artblocks.projectScriptByIndex(0, 0)
        );

        // Convert bytes to string
        string memory scriptStr = string(squiggleScript);

        // Find and replace the line
        bytes memory oldLine = bytes("let backgroundIndex = 0;");
        bytes memory newLine = bytes("let backgroundIndex = 10;");
        scriptStr = _replace(scriptStr, oldLine, newLine);

        // Convert the modified string back to bytes
        bytes memory modifiedScript = bytes(scriptStr);

        // Encode to Base64
        string memory squiggleScriptBase64 = Utils.encode(modifiedScript);

        return squiggleScriptBase64;
    }

    function _replace(
        string memory _str,
        bytes memory _oldLine,
        bytes memory _newLine
    ) internal pure returns (string memory) {
        bytes memory strBytes = bytes(_str);

        // Find the start index of the old line
        int256 index = _indexOf(strBytes, _oldLine);
        require(index >= 0, "Old line not found");

        // Calculate lengths
        uint256 oldLength = _oldLine.length;
        uint256 newLength = _newLine.length;
        uint256 beforeOld = uint256(index);

        // Create a new bytes array with the new length
        bytes memory result = new bytes(
            strBytes.length - oldLength + newLength
        );

        // Copy the bytes before the old line
        for (uint256 i = 0; i < beforeOld; i++) {
            result[i] = strBytes[i];
        }

        // Copy the new line
        for (uint256 i = 0; i < newLength; i++) {
            result[beforeOld + i] = _newLine[i];
        }

        // Copy the bytes after the old line
        for (uint256 i = beforeOld + oldLength; i < strBytes.length; i++) {
            result[newLength + i - oldLength] = strBytes[i];
        }

        return string(result);
    }

    function _indexOf(
        bytes memory _haystack,
        bytes memory _needle
    ) internal pure returns (int256) {
        if (_needle.length == 0 || _haystack.length < _needle.length) {
            return -1;
        }
        bool found = false;
        for (uint256 i = 0; i <= _haystack.length - _needle.length; i++) {
            found = true;
            for (uint256 j = 0; j < _needle.length; j++) {
                if (_haystack[i + j] != _needle[j]) {
                    found = false;
                    break;
                }
            }
            if (found) {
                return int256(i);
            }
        }
        return -1;
    }


    // Soulbound tokens
    // Override transfer functions to prevent transfers
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal override {
        // allow mint and burn
        if (from != address(0) && to != address(0)) {
            revert("Soulbound token: transfer is not allowed");
        }

        super._beforeTokenTransfers(from, to, firstTokenId, batchSize);
    }

    // Override approve functions to prevent approvals
    function approve(
        address to,
        uint256 tokenId
    ) public payable virtual override(ERC721A, IERC721A) {
        revert("Soulbound token: approval is not allowed");
    }

    function setApprovalForAll(
        address operator,
        bool approved
    ) public virtual override(ERC721A, IERC721A) {
        revert("Soulbound token: approval is not allowed");
    }
}

File 2 of 15 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// 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()`.
 *
 * The `_sequentialUpTo()` function can be overriden to enable spot mints
 * (i.e. non-consecutive mints) for `tokenId`s greater than `_sequentialUpTo()`.
 *
 * Assumptions:
 *
 * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
 */
contract 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;

    // The amount of tokens minted above `_sequentialUpTo()`.
    // We call these spot mints (i.e. non-sequential mints).
    uint256 private _spotMinted;

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

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

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

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

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

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

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

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() public view virtual override returns (uint256 result) {
        // Counter underflow is impossible as `_burnCounter` cannot be incremented
        // more than `_currentIndex + _spotMinted - _startTokenId()` times.
        unchecked {
            // With spot minting, the intermediate `result` can be temporarily negative,
            // and the computation must be unchecked.
            result = _currentIndex - _burnCounter - _startTokenId();
            if (_sequentialUpTo() != type(uint256).max) result += _spotMinted;
        }
    }

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

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

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

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

    /**
     * @dev Returns the number of tokens in `owner`'s account.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        if (owner == address(0)) _revert(BalanceQueryForZeroAddress.selector);
        return _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.selector);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns whether `packed` represents a token that exists.
     */
    function _packedOwnershipExists(uint256 packed) private pure returns (bool result) {
        assembly {
            // The following is equivalent to `owner != address(0) && burned == false`.
            // Symbolically tested.
            result := gt(and(packed, _BITMASK_ADDRESS), and(packed, _BITMASK_BURNED))
        }
    }

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

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

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

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

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

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

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

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

        _beforeTokenTransfers(from, to, tokenId, 1);

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

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // We can directly increment and decrement the balances.
            --_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;
                    }
                }
            }
        }

        // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
        uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS;
        assembly {
            // Emit the `Transfer` event.
            log4(
                0, // Start of data (0, since no data).
                0, // End of data (0, since no data).
                _TRANSFER_EVENT_SIGNATURE, // Signature.
                from, // `from`.
                toMasked, // `to`.
                tokenId // `tokenId`.
            )
        }
        if (toMasked == 0) _revert(TransferToZeroAddress.selector);

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

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

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

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

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

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * `from` - Previous owner of the given token ID.
     * `to` - Target address that will receive the token.
     * `tokenId` - Token ID to be transferred.
     * `_data` - Optional data to send along with the call.
     *
     * Returns whether the call correctly returned the expected magic value.
     */
    function _checkContractOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        try ERC721A__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.selector);
            }
            assembly {
                revert(add(32, reason), mload(reason))
            }
        }
    }

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

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

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

        // Overflows are incredibly unrealistic.
        // `balance` and `numberMinted` have a maximum limit of 2**64.
        // `tokenId` has a maximum limit of 2**256.
        unchecked {
            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

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

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

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

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

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

            do {
                assembly {
                    // Emit the `Transfer` event.
                    log4(
                        0, // Start of data (0, since no data).
                        0, // End of data (0, since no data).
                        _TRANSFER_EVENT_SIGNATURE, // Signature.
                        0, // `address(0)`.
                        toMasked, // `to`.
                        tokenId // `tokenId`.
                    )
                }
                // The `!=` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
            } while (++tokenId != end);

            _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.selector);
        if (quantity == 0) _revert(MintZeroQuantity.selector);
        if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector);

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

        // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _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)
            );

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

            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.selector);
                    }
                } while (index < end);
                // This prevents reentrancy to `_safeMint`.
                // It does not prevent reentrancy to `_safeMintSpot`.
                if (_currentIndex != end) revert();
            }
        }
    }

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

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

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

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

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

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

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

            assembly {
                // Emit the `Transfer` event.
                log4(
                    0, // Start of data (0, since no data).
                    0, // End of data (0, since no data).
                    _TRANSFER_EVENT_SIGNATURE, // Signature.
                    0, // `address(0)`.
                    toMasked, // `to`.
                    tokenId // `tokenId`.
                )
            }

            ++_spotMinted;
        }

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

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

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

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

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

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

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

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

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

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

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

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

        address from = address(uint160(prevOwnershipPacked));

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

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

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

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

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // Updates:
            // - `balance -= 1`.
            // - `numberBurned += 1`.
            //
            // We can directly decrement the balance, and increment the number burned.
            // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
            _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 + _spotMinted` 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.selector);
        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)
        }
    }

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

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

pragma solidity ^0.8.4;

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

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

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

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

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

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

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

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

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

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

File 5 of 15 : Utils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;

// copied from: https://github.com/Vectorized/solady/blob/2353e93b77eb6a4a99514c127b753e99a088ae68/src/utils/LibString.sol#L31

library Utils {
    function abs(int x) internal pure returns (int) {
        return x >= 0 ? x : -x;
    }

    function max(int a, int b) internal pure returns (int) {
        return a > b ? a : b;
    }

    function min(int a, int b) internal pure returns (int) {
        return a < b ? a : b;
    }

    /// @dev Returns the base 10 decimal representation of `value`.
    function toString(uint256 value) internal pure returns (string memory str) {
        /// @solidity memory-safe-assembly
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits.
            str := add(mload(0x40), 0x80)
            // Update the free memory pointer to allocate.
            mstore(0x40, add(str, 0x20))
            // Zeroize the slot after the string.
            mstore(str, 0)

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

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

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

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

    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.
    /// See: https://datatracker.ietf.org/doc/html/rfc4648
    /// @param fileSafe  Whether to replace '+' with '-' and '/' with '_'.
    /// @param noPadding Whether to strip away the padding.
    function encode(bytes memory data, bool fileSafe, bool noPadding) internal pure returns (string memory result) {
        /// @solidity memory-safe-assembly
        assembly {
            let dataLength := mload(data)

            if dataLength {
                // Multiply by 4/3 rounded up.
                // The `shl(2, ...)` is equivalent to multiplying by 4.
                let encodedLength := shl(2, div(add(dataLength, 2), 3))

                // Set `result` to point to the start of the free memory.
                result := mload(0x40)

                // Store the table into the scratch space.
                // Offsetted by -1 byte so that the `mload` will load the character.
                // We will rewrite the free memory pointer at `0x40` later with
                // the allocated size.
                // The magic constant 0x0670 will turn "-_" into "+/".
                mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef")
                mstore(0x3f, xor("ghijklmnopqrstuvwxyz0123456789-_", mul(iszero(fileSafe), 0x0670)))

                // Skip the first slot, which stores the length.
                let ptr := add(result, 0x20)
                let end := add(ptr, encodedLength)

                // Run over the input, 3 bytes at a time.
                for {} 1 {} {
                    data := add(data, 3) // Advance 3 bytes.
                    let input := mload(data)

                    // Write 4 bytes. Optimized for fewer stack operations.
                    mstore8(0, mload(and(shr(18, input), 0x3F)))
                    mstore8(1, mload(and(shr(12, input), 0x3F)))
                    mstore8(2, mload(and(shr(6, input), 0x3F)))
                    mstore8(3, mload(and(input, 0x3F)))
                    mstore(ptr, mload(0x00))

                    ptr := add(ptr, 4) // Advance 4 bytes.
                    if iszero(lt(ptr, end)) { break }
                }
                mstore(0x40, add(end, 0x20)) // Allocate the memory.
                // Equivalent to `o = [0, 2, 1][dataLength % 3]`.
                let o := div(2, mod(dataLength, 3))
                // Offset `ptr` and pad with '='. We can simply write over the end.
                mstore(sub(ptr, o), shl(240, 0x3d3d))
                // Set `o` to zero if there is padding.
                o := mul(iszero(iszero(noPadding)), o)
                mstore(sub(ptr, o), 0) // Zeroize the slot after the string.
                mstore(result, sub(encodedLength, o)) // Store the length.
            }
        }
    }

    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.
    /// Equivalent to `encode(data, false, false)`.
    function encode(bytes memory data) internal pure returns (string memory result) {
        result = encode(data, false, false);
    }

    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.
    /// Equivalent to `encode(data, fileSafe, false)`.
    function encode(bytes memory data, bool fileSafe) internal pure returns (string memory result) {
        result = encode(data, fileSafe, false);
    }

    function bytes32ToString(bytes32 _bytes32) public pure returns (string memory) {
        uint8 i = 0;
        while (i < 32 && _bytes32[i] != 0) {
            i++;
        }
        bytes memory bytesArray = new bytes(i);
        for (i = 0; i < 32 && _bytes32[i] != 0; i++) {
            bytesArray[i] = _bytes32[i];
        }
        return string(bytesArray);
    }

    // Function to convert an array of bytes32 to an array of strings
    function bytes32ArrayToStringArray(bytes32[] memory _bytes32Array) public pure returns (string[] memory) {
        string[] memory stringArray = new string[](_bytes32Array.length);
        for (uint256 i = 0; i < _bytes32Array.length; i++) {
            stringArray[i] = bytes32ToString(_bytes32Array[i]);
        }
        return stringArray;
    }


    function bytes32ToBytes(bytes32 _bytes32) public pure returns (bytes memory) {
        bytes memory byteArray = new bytes(32);
        for (uint256 i = 0; i < 32; i++) {
            byteArray[i] = _bytes32[i];
        }
        return byteArray;
    }


    function byteToHexChar(uint8 b) internal pure returns (bytes1) {
        if (b < 10) {
            return bytes1(b + 0x30); // 0x30 is ASCII '0'
        } else {
            return bytes1(b + 0x57); // 0x57 is ASCII 'a' - 10
        }
    }

    // Convert bytes32 to a hex string
    function bytes32ToHexString(bytes32 _bytes32) public pure returns (string memory) {
        bytes memory hexString = new bytes(64); // 2 hex characters per byte
        for (uint256 i = 0; i < 32; i++) {
            uint8 b = uint8(_bytes32[i]);
            hexString[2*i] = byteToHexChar(b >> 4); // high nibble
            hexString[2*i+1] = byteToHexChar(b & 0x0f); // low nibble
        }
        return string(hexString);
    }


    // Convert uint256 to string
    function uint2str(uint256 _i) internal pure returns (string memory) {
        if (_i == 0) {
            return "0";
        }
        uint256 j = _i;
        uint256 len;
        while (j != 0) {
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint256 k = len;
        while (_i != 0) {
            k = k-1;
            uint8 temp = (48 + uint8(_i - _i / 10 * 10));
            bytes1 b1 = bytes1(temp);
            bstr[k] = b1;
            _i /= 10;
        }
        return string(bstr);
    }

   


}

File 6 of 15 : IScriptyBuilderV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

///////////////////////////////////////////////////////////
// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //
// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //
// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //
// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //
// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //
// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //
///////////////////////////////////////////////////////////

/**
  @title A generic HTML builder that fetches and assembles given JS requests.
  @author @0xthedude
  @author @xtremetom

  Special thanks to @cxkoda and @frolic
*/

import "./IScriptyHTML.sol";
import "./IScriptyHTMLURLSafe.sol";

interface IScriptyBuilderV2 is IScriptyHTML, IScriptyHTMLURLSafe {}

File 7 of 15 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// 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();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 15 : IERC721ABurnable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import '../IERC721A.sol';

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

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

pragma solidity ^0.8.20;

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

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

File 10 of 15 : IScriptyHTML.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

///////////////////////////////////////////////////////////
// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //
// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //
// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //
// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //
// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //
// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //
///////////////////////////////////////////////////////////

import {HTMLRequest, HTMLTagType, HTMLTag} from "./../core/ScriptyCore.sol";

interface IScriptyHTML {
    // =============================================================
    //                      RAW HTML GETTERS
    // =============================================================

    /**
     * @notice  Get HTML with requested head tags and body tags
     * @dev Your HTML is returned in the following format:
     *      <html>
     *          <head>
     *              [tagOpen[0]][contractRequest[0] | tagContent[0]][tagClose[0]]
     *              [tagOpen[1]][contractRequest[0] | tagContent[1]][tagClose[1]]
     *              ...
     *              [tagOpen[n]][contractRequest[0] | tagContent[n]][tagClose[n]]
     *          </head>
     *          <body>
     *              [tagOpen[0]][contractRequest[0] | tagContent[0]][tagClose[0]]
     *              [tagOpen[1]][contractRequest[0] | tagContent[1]][tagClose[1]]
     *              ...
     *              [tagOpen[n]][contractRequest[0] | tagContent[n]][tagClose[n]]
     *          </body>
     *      </html>
     * @param htmlRequest - HTMLRequest
     * @return Full HTML with head and body tags
     */
    function getHTML(
        HTMLRequest memory htmlRequest
    ) external view returns (bytes memory);

    // =============================================================
    //                      ENCODED HTML GETTERS
    // =============================================================

    /**
     * @notice Get {getHTML} and base64 encode it
     * @param htmlRequest - HTMLRequest
     * @return Full HTML with head and script tags, base64 encoded
     */
    function getEncodedHTML(
        HTMLRequest memory htmlRequest
    ) external view returns (bytes memory);

    // =============================================================
    //                      STRING UTILITIES
    // =============================================================

    /**
     * @notice Convert {getHTML} output to a string
     * @param htmlRequest - HTMLRequest
     * @return {getHTMLWrapped} as a string
     */
    function getHTMLString(
        HTMLRequest memory htmlRequest
    ) external view returns (string memory);

    /**
     * @notice Convert {getEncodedHTML} output to a string
     * @param htmlRequest - HTMLRequest
     * @return {getEncodedHTML} as a string
     */
    function getEncodedHTMLString(
        HTMLRequest memory htmlRequest
    ) external view returns (string memory);
}

File 11 of 15 : IScriptyHTMLURLSafe.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

///////////////////////////////////////////////////////////
// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //
// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //
// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //
// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //
// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //
// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //
///////////////////////////////////////////////////////////

import {HTMLRequest, HTMLTagType, HTMLTag} from "./../core/ScriptyCore.sol";

interface IScriptyHTMLURLSafe {
    // =============================================================
    //                      RAW HTML GETTERS
    // =============================================================

    /**
     * @notice  Get URL safe HTML with requested head tags and body tags
     * @dev Any tags with tagType = 1/script are converted to base64 and wrapped
     *      with <script src="data:text/javascript;base64,[SCRIPT]"></script>
     *
     *      [WARNING]: Large non-base64 libraries that need base64 encoding
     *      carry a high risk of causing a gas out. Highly advised the use
     *      of base64 encoded scripts where possible
     *
     *      Your HTML is returned in the following format:
     *
     *      <html>
     *          <head>
     *              [tagOpen[0]][contractRequest[0] | tagContent[0]][tagClose[0]]
     *              [tagOpen[1]][contractRequest[0] | tagContent[1]][tagClose[1]]
     *              ...
     *              [tagOpen[n]][contractRequest[0] | tagContent[n]][tagClose[n]]
     *          </head>
     *          <body>
     *              [tagOpen[0]][contractRequest[0] | tagContent[0]][tagClose[0]]
     *              [tagOpen[1]][contractRequest[0] | tagContent[1]][tagClose[1]]
     *              ...
     *              [tagOpen[n]][contractRequest[0] | tagContent[n]][tagClose[n]]
     *          </body>
     *      </html>
     * @param htmlRequest - HTMLRequest
     * @return Full HTML with head and body tags
     */
    function getHTMLURLSafe(
        HTMLRequest memory htmlRequest
    ) external view returns (bytes memory);

    // =============================================================
    //                      STRING UTILITIES
    // =============================================================

    /**
     * @notice Convert {getHTMLURLSafe} output to a string
     * @param htmlRequest - HTMLRequest
     * @return {getHTMLURLSafe} as a string
     */
    function getHTMLURLSafeString(
        HTMLRequest memory htmlRequest
    ) external view returns (string memory);
}

File 12 of 15 : ScriptyCore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

///////////////////////////////////////////////////////////
// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //
// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //
// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //
// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //
// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //
// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //
///////////////////////////////////////////////////////////
//░░░░░░░░░░░░░░░░░░░░░░    CORE    ░░░░░░░░░░░░░░░░░░░░░//
///////////////////////////////////////////////////////////

import {HTMLRequest, HTMLTagType, HTMLTag} from "./ScriptyStructs.sol";
import {DynamicBuffer} from "./../utils/DynamicBuffer.sol";
import {IScriptyContractStorage} from "./../interfaces/IScriptyContractStorage.sol";

contract ScriptyCore {
    using DynamicBuffer for bytes;

    // =============================================================
    //                        TAG CONSTANTS
    // =============================================================

    // data:text/html;base64,
    // raw
    // 22 bytes
    bytes public constant DATA_HTML_BASE64_URI_RAW = "data:text/html;base64,";
    // url encoded
    // 21 bytes
    bytes public constant DATA_HTML_URL_SAFE = "data%3Atext%2Fhtml%2C";

    // <html>,
    // raw
    // 6 bytes
    bytes public constant HTML_OPEN_RAW = "<html>";
    // url encoded
    // 10 bytes
    bytes public constant HTML_OPEN_URL_SAFE = "%3Chtml%3E";

    // <head>,
    // raw
    // 6 bytes
    bytes public constant HEAD_OPEN_RAW = "<head>";
    // url encoded
    // 10 bytes
    bytes public constant HEAD_OPEN_URL_SAFE = "%3Chead%3E";

    // </head>,
    // raw
    // 7 bytes
    bytes public constant HEAD_CLOSE_RAW = "</head>";
    // url encoded
    // 13 bytes
    bytes public constant HEAD_CLOSE_URL_SAFE = "%3C%2Fhead%3E";

    // <body>
    // 6 bytes
    bytes public constant BODY_OPEN_RAW = "<body>";
    // url encoded
    // 10 bytes
    bytes public constant BODY_OPEN_URL_SAFE = "%3Cbody%3E";

    // </body></html>
    // 14 bytes
    bytes public constant HTML_BODY_CLOSED_RAW = "</body></html>";
    // 26 bytes
    bytes public constant HTML_BODY_CLOSED_URL_SAFE =
        "%3C%2Fbody%3E%3C%2Fhtml%3E";

    // [RAW]
    // HTML_OPEN + HEAD_OPEN + HEAD_CLOSE + BODY_OPEN + HTML_BODY_CLOSED
    uint256 public constant URLS_RAW_BYTES = 39;

    // [URL_SAFE]
    // DATA_HTML_URL_SAFE + HTML_OPEN + HEAD_OPEN + HEAD_CLOSE + BODY_OPEN + HTML_BODY_CLOSED
    uint256 public constant URLS_SAFE_BYTES = 90;

    // [RAW]
    // HTML_OPEN + HTML_CLOSE
    uint256 public constant HTML_RAW_BYTES = 13;

    // [RAW]
    // HEAD_OPEN + HEAD_CLOSE
    uint256 public constant HEAD_RAW_BYTES = 13;

    // [RAW]
    // BODY_OPEN + BODY_CLOSE
    uint256 public constant BODY_RAW_BYTES = 13;

    // All raw
    // HTML_RAW_BYTES + HEAD_RAW_BYTES + BODY_RAW_BYTES
    uint256 public constant RAW_BYTES = 39;

    // [URL_SAFE]
    // HTML_OPEN + HTML_CLOSE
    uint256 public constant HTML_URL_SAFE_BYTES = 23;

    // [URL_SAFE]
    // HEAD_OPEN + HEAD_CLOSE
    uint256 public constant HEAD_URL_SAFE_BYTES = 23;

    // [URL_SAFE]
    // BODY_OPEN + BODY_CLOSE
    uint256 public constant BODY_SAFE_BYTES = 23;

    // All url safe
    // HTML_URL_SAFE_BYTES + HEAD_URL_SAFE_BYTES + BODY_URL_SAFE_BYTES
    // %3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E
    uint256 public constant URL_SAFE_BYTES = 69;

    // data:text/html;base64,
    uint256 public constant HTML_BASE64_DATA_URI_BYTES = 22;

    // =============================================================
    //                    TAG OPEN CLOSE TEMPLATES
    // =============================================================

    /**
     * @notice Grab tag open and close depending on tag type
     * @dev
     *      tagType: 0/HTMLTagType.useTagOpenAndClose or any other:
     *          [tagOpen][CONTENT][tagClose]
     *
     *      tagType: 1/HTMLTagType.script:
     *          <script>[SCRIPT]</script>
     *
     *      tagType: 2/HTMLTagType.scriptBase64DataURI:
     *          <script src="data:text/javascript;base64,[SCRIPT]"></script>
     *
     *      tagType: 3/HTMLTagType.scriptGZIPBase64DataURI:
     *          <script type="text/javascript+gzip" src="data:text/javascript;base64,[SCRIPT]"></script>
     *
     *      tagType: 4/HTMLTagType.scriptPNGBase64DataURI
     *          <script type="text/javascript+png" name="[NAME]" src="data:text/javascript;base64,[SCRIPT]"></script>
     *
     *      [IMPORTANT NOTE]: The tags `text/javascript+gzip` and `text/javascript+png` are used to identify scripts
     *      during decompression
     *
     * @param htmlTag - HTMLTag data for code
     * @return (tagOpen, tagClose) - Tag open and close as a tuple
     */
    function tagOpenCloseForHTMLTag(
        HTMLTag memory htmlTag
    ) public pure returns (bytes memory, bytes memory) {
        if (htmlTag.tagType == HTMLTagType.script) {
            return ("<script>", "</script>");
        } else if (htmlTag.tagType == HTMLTagType.scriptBase64DataURI) {
            return ('<script src="data:text/javascript;base64,', '"></script>');
        } else if (htmlTag.tagType == HTMLTagType.scriptGZIPBase64DataURI) {
            return (
                '<script type="text/javascript+gzip" src="data:text/javascript;base64,',
                '"></script>'
            );
        } else if (htmlTag.tagType == HTMLTagType.scriptPNGBase64DataURI) {
            return (
                '<script type="text/javascript+png" src="data:text/javascript;base64,',
                '"></script>'
            );
        }
        return (htmlTag.tagOpen, htmlTag.tagClose);
    }

    /**
     * @notice Grab URL safe tag open and close depending on tag type
     * @dev
     *      tagType: 0/HTMLTagType.useTagOpenAndClose or any other:
     *          [tagOpen][scriptContent or scriptFromContract][tagClose]
     *
     *      tagType: 1/HTMLTagType.script:
     *      tagType: 2/HTMLTagType.scriptBase64DataURI:
     *          <script src="data:text/javascript;base64,[SCRIPT]"></script>
     *
     *      tagType: 3/HTMLTagType.scriptGZIPBase64DataURI:
     *          <script type="text/javascript+gzip" src="data:text/javascript;base64,[SCRIPT]"></script>
     *
     *      tagType: 4/HTMLTagType.scriptPNGBase64DataURI
     *          <script type="text/javascript+png" name="[NAME]" src="data:text/javascript;base64,[SCRIPT]"></script>
     *
     *      [IMPORTANT NOTE]: The tags `text/javascript+gzip` and `text/javascript+png` are used to identify scripts
     *      during decompression
     *
     * @param htmlTag - HTMLTag data for code
     * @return (tagOpen, tagClose) - Tag open and close as a tuple
     */
    function tagOpenCloseForHTMLTagURLSafe(
        HTMLTag memory htmlTag
    ) public pure returns (bytes memory, bytes memory) {
        if (
            htmlTag.tagType == HTMLTagType.script ||
            htmlTag.tagType == HTMLTagType.scriptBase64DataURI
        ) {
            // <script src="data:text/javascript;base64,
            // "></script>
            return (
                "%253Cscript%2520src%253D%2522data%253Atext%252Fjavascript%253Bbase64%252C",
                "%2522%253E%253C%252Fscript%253E"
            );
        } else if (htmlTag.tagType == HTMLTagType.scriptGZIPBase64DataURI) {
            // <script type="text/javascript+gzip" src="data:text/javascript;base64,
            // "></script>
            return (
                "%253Cscript%2520type%253D%2522text%252Fjavascript%252Bgzip%2522%2520src%253D%2522data%253Atext%252Fjavascript%253Bbase64%252C",
                "%2522%253E%253C%252Fscript%253E"
            );
        } else if (htmlTag.tagType == HTMLTagType.scriptPNGBase64DataURI) {
            // <script type="text/javascript+png" src="data:text/javascript;base64,
            // "></script>
            return (
                "%253Cscript%2520type%253D%2522text%252Fjavascript%252Bpng%2522%2520src%253D%2522data%253Atext%252Fjavascript%253Bbase64%252C",
                "%2522%253E%253C%252Fscript%253E"
            );
        }
        return (htmlTag.tagOpen, htmlTag.tagClose);
    }

    // =============================================================
    //                      TAG CONTENT FETCHER
    // =============================================================

    /**
     * @notice Grabs requested tag content from storage
     * @dev
     *      If given HTMLTag contains non empty contractAddress
     *      this method will fetch the content from given storage
     *      contract. Otherwise, it will return the tagContent
     *      from the given htmlTag.
     *
     * @param htmlTag - HTMLTag
     */
    function fetchTagContent(
        HTMLTag memory htmlTag
    ) public view returns (bytes memory) {
        if (htmlTag.contractAddress != address(0)) {
            return
                IScriptyContractStorage(htmlTag.contractAddress).getContent(
                    htmlTag.name,
                    htmlTag.contractData
                );
        }
        return htmlTag.tagContent;
    }

    // =============================================================
    //                        SIZE OPERATIONS
    // =============================================================

    /**
     * @notice Calculate the buffer size post base64 encoding
     * @param value - Starting buffer size
     * @return Final buffer size as uint256
     */
    function sizeForBase64Encoding(
        uint256 value
    ) public pure returns (uint256) {
        unchecked {
            return 4 * ((value + 2) / 3);
        }
    }

    /**
     * @notice Adds the required tag open/close and calculates buffer size of tags
     * @dev Effectively multiple functions bundled into one as this saves gas
     * @param htmlTags - Array of HTMLTag
     * @param isURLSafe - Bool to handle tag content/open/close encoding
     * @return Total buffersize of updated HTMLTags
     */
    function _enrichHTMLTags(
        HTMLTag[] memory htmlTags,
        bool isURLSafe
    ) internal view returns (uint256) {
        if (htmlTags.length == 0) {
            return 0;
        }

        bytes memory tagOpen;
        bytes memory tagClose;
        bytes memory tagContent;

        uint256 totalSize;
        uint256 length = htmlTags.length;
        uint256 i;

        unchecked {
            do {
                tagContent = fetchTagContent(htmlTags[i]);
                htmlTags[i].tagContent = tagContent;

                if (isURLSafe && htmlTags[i].tagType == HTMLTagType.script) {
                    totalSize += sizeForBase64Encoding(tagContent.length);
                } else {
                    totalSize += tagContent.length;
                }

                if (isURLSafe) {
                    (tagOpen, tagClose) = tagOpenCloseForHTMLTagURLSafe(
                        htmlTags[i]
                    );
                } else {
                    (tagOpen, tagClose) = tagOpenCloseForHTMLTag(htmlTags[i]);
                }

                htmlTags[i].tagOpen = tagOpen;
                htmlTags[i].tagClose = tagClose;

                totalSize += tagOpen.length;
                totalSize += tagClose.length;
            } while (++i < length);
        }
        return totalSize;
    }

    // =============================================================
    //                     HTML CONCATENATION
    // =============================================================

    /**
     * @notice Append tags to the html buffer for tags
     * @param htmlFile - bytes buffer
     * @param htmlTags - Tags being added to buffer
     * @param base64EncodeTagContent - Bool to handle tag content encoding
     */
    function _appendHTMLTags(
        bytes memory htmlFile,
        HTMLTag[] memory htmlTags,
        bool base64EncodeTagContent
    ) internal pure {
        uint256 i;
        unchecked {
            do {
                _appendHTMLTag(htmlFile, htmlTags[i], base64EncodeTagContent);
            } while (++i < htmlTags.length);
        }
    }

    /**
     * @notice Append tag to the html buffer
     * @param htmlFile - bytes buffer
     * @param htmlTag - Request being added to buffer
     * @param base64EncodeTagContent - Bool to handle tag content encoding
     */
    function _appendHTMLTag(
        bytes memory htmlFile,
        HTMLTag memory htmlTag,
        bool base64EncodeTagContent
    ) internal pure {
        htmlFile.appendSafe(htmlTag.tagOpen);
        if (base64EncodeTagContent) {
            htmlFile.appendSafeBase64(htmlTag.tagContent, false, false);
        } else {
            htmlFile.appendSafe(htmlTag.tagContent);
        }
        htmlFile.appendSafe(htmlTag.tagClose);
    }
}

File 13 of 15 : ScriptyStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

///////////////////////////////////////////////////////////
// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //
// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //
// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //
// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //
// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //
// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //
///////////////////////////////////////////////////////////
//░░░░░░░░░░░░░░░░░░░    REQUESTS    ░░░░░░░░░░░░░░░░░░░░//
///////////////////////////////////////////////////////////

struct HTMLRequest {
    HTMLTag[] headTags;
    HTMLTag[] bodyTags;
}

enum HTMLTagType {
    useTagOpenAndClose,
    script,
    scriptBase64DataURI,
    scriptGZIPBase64DataURI,
    scriptPNGBase64DataURI
}

struct HTMLTag {
    string name;
    address contractAddress;
    bytes contractData;
    HTMLTagType tagType;
    bytes tagOpen;
    bytes tagClose;
    bytes tagContent;
}

File 14 of 15 : DynamicBuffer.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)

pragma solidity ^0.8.22;

/// @title DynamicBuffer
/// @author David Huber (@cxkoda) and Simon Fremaux (@dievardump). See also
///         https://raw.githubusercontent.com/dievardump/solidity-dynamic-buffer
/// @notice This library is used to allocate a big amount of container memory
//          which will be subsequently filled without needing to reallocate
///         memory.
/// @dev First, allocate memory.
///      Then use `buffer.appendUnchecked(theBytes)` or `appendSafe()` if
///      bounds checking is required.
library DynamicBuffer {
    /// @notice Allocates container space for the DynamicBuffer
    /// @param capacity_ The intended max amount of bytes in the buffer
    /// @return buffer The memory location of the buffer
    /// @dev Allocates `capacity_ + 0x60` bytes of space
    ///      The buffer array starts at the first container data position,
    ///      (i.e. `buffer = container + 0x20`)
    function allocate(uint256 capacity_)
        internal
        pure
        returns (bytes memory buffer)
    {
        assembly {
            // Get next-free memory address
            let container := mload(0x40)

            // Allocate memory by setting a new next-free address
            {
                // Add 2 x 32 bytes in size for the two length fields
                // Add 32 bytes safety space for 32B chunked copy
                let size := add(capacity_, 0x60)
                let newNextFree := add(container, size)
                mstore(0x40, newNextFree)
            }

            // Set the correct container length
            {
                let length := add(capacity_, 0x40)
                mstore(container, length)
            }

            // The buffer starts at idx 1 in the container (0 is length)
            buffer := add(container, 0x20)

            // Init content with length 0
            mstore(buffer, 0)
        }

        return buffer;
    }

    /// @notice Appends data to buffer, and update buffer length
    /// @param buffer the buffer to append the data to
    /// @param data the data to append
    /// @dev Does not perform out-of-bound checks (container capacity)
    ///      for efficiency.
    function appendUnchecked(bytes memory buffer, bytes memory data)
        internal
        pure
    {
        assembly {
            let length := mload(data)
            for {
                data := add(data, 0x20)
                let dataEnd := add(data, length)
                let copyTo := add(buffer, add(mload(buffer), 0x20))
            } lt(data, dataEnd) {
                data := add(data, 0x20)
                copyTo := add(copyTo, 0x20)
            } {
                // Copy 32B chunks from data to buffer.
                // This may read over data array boundaries and copy invalid
                // bytes, which doesn't matter in the end since we will
                // later set the correct buffer length, and have allocated an
                // additional word to avoid buffer overflow.
                mstore(copyTo, mload(data))
            }

            // Update buffer length
            mstore(buffer, add(mload(buffer), length))
        }
    }

    /// @notice Appends data to buffer, and update buffer length
    /// @param buffer the buffer to append the data to
    /// @param data the data to append
    /// @dev Performs out-of-bound checks and calls `appendUnchecked`.
    function appendSafe(bytes memory buffer, bytes memory data) internal pure {
        checkOverflow(buffer, data.length);
        appendUnchecked(buffer, data);
    }

    /// @notice Appends data encoded as Base64 to buffer.
    /// @param fileSafe  Whether to replace '+' with '-' and '/' with '_'.
    /// @param noPadding Whether to strip away the padding.
    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.
    /// See: https://datatracker.ietf.org/doc/html/rfc4648
    /// Author: Modified from Solady (https://github.com/vectorized/solady/blob/main/src/utils/Base64.sol)
    /// Author: Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Base64.sol)
    /// Author: Modified from (https://github.com/Brechtpd/base64/blob/main/base64.sol) by Brecht Devos.
    function appendSafeBase64(
        bytes memory buffer,
        bytes memory data,
        bool fileSafe,
        bool noPadding
    ) internal pure {
        uint256 dataLength = data.length;

        if (data.length == 0) {
            return;
        }

        uint256 encodedLength;
        uint256 r;
        assembly {
            // For each 3 bytes block, we will have 4 bytes in the base64
            // encoding: `encodedLength = 4 * divCeil(dataLength, 3)`.
            // The `shl(2, ...)` is equivalent to multiplying by 4.
            encodedLength := shl(2, div(add(dataLength, 2), 3))

            r := mod(dataLength, 3)
            if noPadding {
                // if r == 0 => no modification
                // if r == 1 => encodedLength -= 2
                // if r == 2 => encodedLength -= 1
                encodedLength := sub(
                    encodedLength,
                    add(iszero(iszero(r)), eq(r, 1))
                )
            }
        }

        checkOverflow(buffer, encodedLength);

        assembly {
            let nextFree := mload(0x40)

            // Store the table into the scratch space.
            // Offsetted by -1 byte so that the `mload` will load the character.
            // We will rewrite the free memory pointer at `0x40` later with
            // the allocated size.
            mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef")
            mstore(
                0x3f,
                sub(
                    "ghijklmnopqrstuvwxyz0123456789-_",
                    // The magic constant 0x0230 will translate "-_" + "+/".
                    mul(iszero(fileSafe), 0x0230)
                )
            )

            // Skip the first slot, which stores the length.
            let ptr := add(add(buffer, 0x20), mload(buffer))
            let end := add(data, dataLength)

            // Run over the input, 3 bytes at a time.
            // prettier-ignore
            // solhint-disable-next-line no-empty-blocks
            for {} 1 {} {
                    data := add(data, 3) // Advance 3 bytes.
                    let input := mload(data)

                    // Write 4 bytes. Optimized for fewer stack operations.
                    mstore8(    ptr    , mload(and(shr(18, input), 0x3F)))
                    mstore8(add(ptr, 1), mload(and(shr(12, input), 0x3F)))
                    mstore8(add(ptr, 2), mload(and(shr( 6, input), 0x3F)))
                    mstore8(add(ptr, 3), mload(and(        input , 0x3F)))
                    
                    ptr := add(ptr, 4) // Advance 4 bytes.
                    // prettier-ignore
                    if iszero(lt(data, end)) { break }
                }

            if iszero(noPadding) {
                // Offset `ptr` and pad with '='. We can simply write over the end.
                mstore8(sub(ptr, iszero(iszero(r))), 0x3d) // Pad at `ptr - 1` if `r > 0`.
                mstore8(sub(ptr, shl(1, eq(r, 1))), 0x3d) // Pad at `ptr - 2` if `r == 1`.
            }

            mstore(buffer, add(mload(buffer), encodedLength))
            mstore(0x40, nextFree)
        }
    }

    /// @notice Appends data encoded as Base64 to buffer.
    /// @param fileSafe  Whether to replace '+' with '-' and '/' with '_'.
    /// @param noPadding Whether to strip away the padding.
    /// @dev Encodes `data` using the base64 encoding described in RFC 4648.
    /// See: https://datatracker.ietf.org/doc/html/rfc4648
    /// Author: Modified from Solady (https://github.com/vectorized/solady/blob/main/src/utils/Base64.sol)
    /// Author: Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/Base64.sol)
    /// Author: Modified from (https://github.com/Brechtpd/base64/blob/main/base64.sol) by Brecht Devos.
    function appendUncheckedBase64(
        bytes memory buffer,
        bytes memory data,
        bool fileSafe,
        bool noPadding
    ) internal pure {
        uint256 dataLength = data.length;

        if (data.length == 0) {
            return;
        }

        uint256 encodedLength;
        uint256 r;
        assembly {
            // For each 3 bytes block, we will have 4 bytes in the base64
            // encoding: `encodedLength = 4 * divCeil(dataLength, 3)`.
            // The `shl(2, ...)` is equivalent to multiplying by 4.
            encodedLength := shl(2, div(add(dataLength, 2), 3))

            r := mod(dataLength, 3)
            if noPadding {
                // if r == 0 => no modification
                // if r == 1 => encodedLength -= 2
                // if r == 2 => encodedLength -= 1
                encodedLength := sub(
                    encodedLength,
                    add(iszero(iszero(r)), eq(r, 1))
                )
            }
        }

        assembly {
            let nextFree := mload(0x40)

            // Store the table into the scratch space.
            // Offsetted by -1 byte so that the `mload` will load the character.
            // We will rewrite the free memory pointer at `0x40` later with
            // the allocated size.
            mstore(0x1f, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef")
            mstore(
                0x3f,
                sub(
                    "ghijklmnopqrstuvwxyz0123456789-_",
                    // The magic constant 0x0230 will translate "-_" + "+/".
                    mul(iszero(fileSafe), 0x0230)
                )
            )

            // Skip the first slot, which stores the length.
            let ptr := add(add(buffer, 0x20), mload(buffer))
            let end := add(data, dataLength)

            // Run over the input, 3 bytes at a time.
            // prettier-ignore
            // solhint-disable-next-line no-empty-blocks
            for {} 1 {} {
                    data := add(data, 3) // Advance 3 bytes.
                    let input := mload(data)

                    // Write 4 bytes. Optimized for fewer stack operations.
                    mstore8(    ptr    , mload(and(shr(18, input), 0x3F)))
                    mstore8(add(ptr, 1), mload(and(shr(12, input), 0x3F)))
                    mstore8(add(ptr, 2), mload(and(shr( 6, input), 0x3F)))
                    mstore8(add(ptr, 3), mload(and(        input , 0x3F)))
                    
                    ptr := add(ptr, 4) // Advance 4 bytes.
                    // prettier-ignore
                    if iszero(lt(data, end)) { break }
                }

            if iszero(noPadding) {
                // Offset `ptr` and pad with '='. We can simply write over the end.
                mstore8(sub(ptr, iszero(iszero(r))), 0x3d) // Pad at `ptr - 1` if `r > 0`.
                mstore8(sub(ptr, shl(1, eq(r, 1))), 0x3d) // Pad at `ptr - 2` if `r == 1`.
            }

            mstore(buffer, add(mload(buffer), encodedLength))
            mstore(0x40, nextFree)
        }
    }

    /// @notice Returns the capacity of a given buffer.
    function capacity(bytes memory buffer) internal pure returns (uint256) {
        uint256 cap;
        assembly {
            cap := sub(mload(sub(buffer, 0x20)), 0x40)
        }
        return cap;
    }

    /// @notice Reverts if the buffer will overflow after appending a given
    /// number of bytes.
    function checkOverflow(bytes memory buffer, uint256 addedLength)
        internal
        pure
    {
        uint256 cap = capacity(buffer);
        uint256 newLength = buffer.length + addedLength;
        if (cap < newLength) {
            revert("DynamicBuffer: Appending out of bounds.");
        }
    }
}

File 15 of 15 : IScriptyContractStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

///////////////////////////////////////////////////////////
// ░██████╗░█████╗░██████╗░██╗██████╗░████████╗██╗░░░██╗ //
// ██╔════╝██╔══██╗██╔══██╗██║██╔══██╗╚══██╔══╝╚██╗░██╔╝ //
// ╚█████╗░██║░░╚═╝██████╔╝██║██████╔╝░░░██║░░░░╚████╔╝░ //
// ░╚═══██╗██║░░██╗██╔══██╗██║██╔═══╝░░░░██║░░░░░╚██╔╝░░ //
// ██████╔╝╚█████╔╝██║░░██║██║██║░░░░░░░░██║░░░░░░██║░░░ //
// ╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░░░░░░░╚═╝░░░░░░╚═╝░░░ //
///////////////////////////////////////////////////////////

interface IScriptyContractStorage {
    // =============================================================
    //                            GETTERS
    // =============================================================

    /**
     * @notice Get the full content
     * @param name - Name given to the script. Eg: threejs.min.js_r148
     * @param data - Arbitrary data to be passed to storage
     * @return script - Full script from merged chunks
     */
    function getContent(string calldata name, bytes memory data)
        external
        view
        returns (bytes memory script);
}

Settings
{
  "remappings": [
    "@openzeppelin/=node_modules/@openzeppelin/",
    "erc721a/=node_modules/erc721a/",
    "forge-std/=lib/forge-std/src/",
    "scripty/=lib/scripty/",
    "solady/=lib/solady/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {
    "src/Utils.sol": {
      "Utils": "0xa4131c5d569bf73547c6dd6daa88a86b61e82557"
    }
  }
}

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":"InscriptionIdMismatch","type":"error"},{"inputs":[],"name":"InvalidInscriptionId","type":"error"},{"inputs":[],"name":"MintClosed","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NoContracts","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","type":"error"},{"inputs":[],"name":"NotSnowfro","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TokenAlreadyMinted","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":false,"internalType":"address","name":"a","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"MintedFarewell","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_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":"payable","type":"function"},{"inputs":[],"name":"artblocks","outputs":[{"internalType":"contract IArtBlocks","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ethfsFileStorageAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"farewells","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"farewellsOrder","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_colorRelic","type":"string"},{"internalType":"string","name":"_colorFarewell","type":"string"},{"internalType":"uint256","name":"_positionRelic","type":"uint256"},{"internalType":"uint256","name":"_positionFarewell","type":"uint256"}],"name":"generateSVG","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getModifiedArtBlocksScript","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isArtBlocksTokenMinted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_inscriptionId","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintTokenZero","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":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"relic","outputs":[{"internalType":"contract IRelic","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"renderAsDataUri","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"scriptyBuilderAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"scriptyStorageAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_val","type":"bool"}],"name":"setMintOpen","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":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e0604052346200026057620000146200027b565b60207014dc5d5a59d9db194811985c995dd95b1b607a1b60208301526200003a6200029f565b660a68c46727272760cb1b60208201528251929091906001600160401b0384116200025a57620000778462000071600254620002c3565b62000300565b602091601f8511600114620001c957509280620000b192620000ba95600092620001bd575b50508160011b916000199060031b1c19161790565b600255620003b6565b600080553315620001a457620000d033620004a4565b73d7587f110e08f4d120a231ba97d3b577a81df02260805273bd11994aabb55da86dc246ebb17c1be0af5b769960a052738faa1aab9da8c75917c43fb24fddb513eddc324560c052600a80546001600160a01b03191673059edd72cd353df5106d2b9cc5ab83a52287ac3a179055600b80546001600160a01b031916739b917686dd68b68a780cb8bf70af46617a7b3f801790556040516135d19081620004ee8239608051818181610f7a01526123f8015260a051818181610e040152612316015260c0518181816110b901526122ac0152f35b604051631e4fbdf760e01b815260006004820152602490fd5b0151905038806200009c565b60026000529190601f1985167f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace936000905b82821062000241575050916001939186620000ba97941062000227575b505050811b01600255620003b6565b015160001960f88460031b161c1916905538808062000218565b80600186978294978701518155019601940190620001fb565b62000265565b600080fd5b634e487b7160e01b600052604160045260246000fd5b60408051919082016001600160401b038111838210176200025a5760405260118252565b60408051919082016001600160401b038111838210176200025a5760405260078252565b90600182811c92168015620002f5575b6020831014620002df57565b634e487b7160e01b600052602260045260246000fd5b91607f1691620002d3565b601f81116200030d575050565b60009060026000526020600020906020601f850160051c8301941062000350575b601f0160051c01915b8281106200034457505050565b81815560010162000337565b90925082906200032e565b601f811162000368575050565b60009060036000526020600020906020601f850160051c83019410620003ab575b601f0160051c01915b8281106200039f57505050565b81815560010162000392565b909250829062000389565b80519091906001600160401b0381116200025a57620003e281620003dc600354620002c3565b6200035b565b602080601f83116001146200041c57508190620004179394600092620001bd5750508160011b916000199060031b1c19161790565b600355565b6003600052601f198316949091907fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b926000905b8782106200048b57505083600195961062000471575b505050811b01600355565b015160001960f88460031b161c1916905538808062000466565b8060018596829496860151815501950193019062000450565b600980546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a356fe6080604052600436101561001257600080fd5b60003560e01c806301ffc9a714610237578063032e6a2c1461023257806306fdde031461022d578063081812fc14610228578063095ea7b31461022357806318160ddd1461021e57806323b872dd1461021957806332cb6b0c146102145780633ccfd60b1461020f57806342842e0e1461020a57806342966c68146102055780635d0bb112146102005780635dab7f77146101fb5780636352211e146101f657806370a08231146101f1578063715018a6146101ec5780638b46adac146101e75780638da5cb5b146101e257806395d89b41146101dd578063a0712d68146101d8578063a1d62680146101d3578063a22cb465146101ce578063a4590bd0146101c9578063a9cb35ae146101c4578063b88d4fde146101bf578063b8d06e7a146101ba578063c2f14a2d146101b5578063c87b56dd146101b0578063e3b71f87146101ab578063e985e9c5146101a6578063f2fde38b146101a1578063f7da37621461019c578063f8004d31146101975763f936b40c1461019257600080fd5b61112d565b6110e8565b6110a3565b611011565b610fa9565b610f64565b610ed9565b610eb1565b610e95565b610e33565b610dee565b610dc5565b610d48565b610d29565b610b8f565b610ac9565b610aa0565b610a74565b610a16565b6109b8565b610989565b610916565b6107ec565b61065e565b610625565b6105b0565b610593565b61057f565b610526565b6104b9565b610455565b610346565b6102c1565b610253565b6001600160e01b031981160361024e57565b600080fd5b3461024e57602036600319011261024e5760206004356102728161023c565b63ffffffff60e01b166301ffc9a760e01b81149081156102b0575b811561029f575b506040519015158152f35b635b5e139f60e01b14905038610294565b6380ac58cd60e01b8114915061028d565b3461024e57600036600319011261024e57600a546040516001600160a01b039091168152602090f35b60005b8381106102fd5750506000910152565b81810151838201526020016102ed565b90602091610326815180928185528580860191016102ea565b601f01601f1916010190565b90602061034392818152019061030d565b90565b3461024e57600080600319360112610452576040519080600254906001918060011c9260018216928315610448575b60209260208610851461043457858852602088019490811561041357506001146103ba575b6103b6876103aa81890382610888565b60405191829182610332565b0390f35b600260005294509192917f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b83861061040257505050910190506103aa826103b6388061039a565b8054858701529482019481016103e6565b60ff191685525050505090151560051b0190506103aa826103b6388061039a565b634e487b7160e01b82526022600452602482fd5b93607f1693610375565b80fd5b3461024e57602036600319011261024e5760043561047281612ce4565b15610497576000526006602052602060018060a01b0360406000205416604051908152f35b6333d1c03960e21b60005260046000fd5b6001600160a01b0381160361024e57565b604036600319011261024e576104d06004356104a8565b60405162461bcd60e51b815260206004820152602860248201527f536f756c626f756e6420746f6b656e3a20617070726f76616c206973206e6f7460448201526708185b1b1bddd95960c21b6064820152608490fd5b3461024e57600036600319011261024e57602061054b60005460015490036008540190565b604051908152f35b606090600319011261024e5760043561056b816104a8565b90602435610578816104a8565b9060443590565b61059161058b36610553565b91611254565b005b3461024e57600036600319011261024e576020604051610c4d8152f35b3461024e57600080600319360112610452576105ca612eb5565b8080808060018060a01b036009541647905af16105e56113d7565b50156105ee5780f35b60405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc819985a5b1959608a1b6044820152606490fd5b61062e36610553565b6040519160208301938385106001600160401b038611176106595761059194604052600084526129c2565b610820565b3461024e57602036600319011261024e5760043561067b81612d8b565b60008281526006602052604090208054916001600160a01b038116913380851490841417156106a9565b1590565b61079e575b6000936106ba84612e18565b610795575b506001600160a01b038216600090815260056020526040902080546fffffffffffffffffffffffffffffffff0190556001600160a01b0382164260a01b17600360e01b17610717856000526004602052604060002090565b55600160e11b81161561074c575b5060008051602061357c8339815191528280a461059161074760015460010190565b600155565b60018401610764816000526004602052604060002090565b5415610771575b50610725565b8354811461076b5761078d906000526004602052604060002090565b55388061076b565b839055386106bf565b6107e26106a56107db336107c48760018060a01b03166000526007602052604060002090565b9060018060a01b0316600052602052604060002090565b5460ff1690565b156106ae57612d48565b3461024e57602036600319011261024e57600435600052600c602052602060018060a01b0360406000205416604051908152f35b634e487b7160e01b600052604160045260246000fd5b60e081019081106001600160401b0382111761065957604052565b604081019081106001600160401b0382111761065957604052565b61026081019081106001600160401b0382111761065957604052565b90601f801991011681019081106001600160401b0382111761065957604052565b6001600160401b03811161065957601f01601f191660200190565b9291926108d0826108a9565b916108de6040519384610888565b82948184528183011161024e578281602093846000960137010152565b9080601f8301121561024e57816020610343933591016108c4565b3461024e57608036600319011261024e576001600160401b0360043581811161024e576109479036906004016108fb565b9060243590811161024e576103b6916109676109759236906004016108fb565b906064359160443591611461565b60405191829160208352602083019061030d565b3461024e57602036600319011261024e5760206001600160a01b036109af600435612d8b565b16604051908152f35b3461024e57602036600319011261024e576004356109d5816104a8565b6001600160a01b03168015610a0557600052600560205260206001600160401b0360406000205416604051908152f35b6323d3ad8160e21b60005260046000fd5b3461024e5760008060031936011261045257610a30612eb5565b600980546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b3461024e57602036600319011261024e57600435600052600d6020526020604060002054604051908152f35b3461024e57600036600319011261024e576009546040516001600160a01b039091168152602090f35b3461024e57600080600319360112610452576040519080600354906001918060011c9260018216928315610b85575b6020926020861085146104345785885260208801949081156104135750600114610b2c576103b6876103aa81890382610888565b600360005294509192917fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b838610610b7457505050910190506103aa826103b6388061039a565b805485870152948201948101610b58565b93607f1693610af8565b3461024e57602036600319011261024e576004803590600b5460ff8160a01c1615610d1957610c4d831015610d09576040516376e0659960e01b815282810184815290916001600160a01b03916020918491829003830190829085165afa918215610d0457600092610cd3575b5033911603610cc457610c0e82612ce4565b610cb6577ff7889fa98fb338f4dc3234c4ac4d3bf180e7af8a3a4f521fc318596a6b0fd53e610cb183610c6e33610c4f83600052600c602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b600054600154600854910301610c8e82600052600d602052604060002090565b55610c998133613097565b60408051338152602081019290925290918291820190565b0390a1005b60405162a5a1f560e01b8152fd5b6040516306e8659360e51b8152fd5b610cf691925060203d602011610cfd575b610cee8183610888565b8101906115f9565b9038610bfc565b503d610ce4565b61160e565b50604051632210334b60e21b8152fd5b5060405163589ed34b60e01b8152fd5b3461024e57602036600319011261024e576103b66109756004356120ab565b3461024e57604036600319011261024e57610d646004356104a8565b6024358015150361024e5760405162461bcd60e51b815260206004820152602860248201527f536f756c626f756e6420746f6b656e3a20617070726f76616c206973206e6f7460448201526708185b1b1bddd95960c21b6064820152608490fd5b3461024e57600036600319011261024e57600b546040516001600160a01b039091168152602090f35b3461024e57600036600319011261024e576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b608036600319011261024e57600435610e4b816104a8565b602435610e57816104a8565b606435916001600160401b03831161024e573660238401121561024e57610e8b6105919336906024816004013591016108c4565b91604435916129c2565b3461024e57602036600319011261024e576103b6610975612a05565b3461024e57602036600319011261024e576020610ecf600435612c4c565b6040519015158152f35b3461024e57602036600319011261024e57600435610ef681612ce4565b15610f07576109756103b6916120ab565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b3461024e57600036600319011261024e576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b3461024e57604036600319011261024e57602060ff611005600435610fcd816104a8565b60243590610fda826104a8565b60018060a01b03166000526007845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b3461024e57602036600319011261024e5760043561102e816104a8565b611036612eb5565b6001600160a01b0390811690811561108a57600954826bffffffffffffffffffffffff60a01b821617600955167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b604051631e4fbdf760e01b815260006004820152602490fd5b3461024e57600036600319011261024e576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b3461024e57602036600319011261024e5760043580151580910361024e5761110e612eb5565b600b805460ff60a01b191660a09290921b60ff60a01b16919091179055005b3461024e576000806003193601126104525773f3860788d1597cecf938424baabe976fac87dc26330361124257611162612c9d565b61123157808052600c6020526040812080546001600160a01b03191673f3860788d1597cecf938424baabe976fac87dc2617905560008052600d602052807f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ee556111ca6132f8565b600b805460ff60a01b1916600160a01b1790557ff7889fa98fb338f4dc3234c4ac4d3bf180e7af8a3a4f521fc318596a6b0fd53e6040518061122b819060006020604084019373f3860788d1597cecf938424baabe976fac87dc2681520152565b0390a180f35b60405162a5a1f560e01b8152600490fd5b604051633ceefd7d60e21b8152600490fd5b91909161126082612d8b565b6001600160a01b0391821693908281168590036113d257600084815260066020526040902080546112a06001600160a01b03881633908114908314171590565b6113a2575b6112af8488612e8d565b611398575b506001600160a01b038516600090815260056020526040902080546000190190556001600160a01b0382166000908152600560205260409020805460010190556001600160a01b0382164260a01b17600160e11b1761131d856000526004602052604060002090565b55600160e11b81161561134e575b5016809260008051602061357c833981519152600080a41561134957565b612d69565b60018401611366816000526004602052604060002090565b5415611373575b5061132b565b600054811461136d57611390906000526004602052604060002090565b55388061136d565b60009055386112b4565b6113c86106a56107db336107c48b60018060a01b03166000526007602052604060002090565b156112a557612d48565b612d59565b3d15611402573d906113e8826108a9565b916113f66040519384610888565b82523d6000602084013e565b606090565b9061141a602092828151948592016102ea565b0190565b7f2220723d22343030222066696c6c3d226e6f6e6522207374726f6b652d7769648152703a341e91189818111039ba3937b5b29e9160791b602082015260310190565b9161146b90612fe2565b91611474612f5a565b9361147e90612fe2565b611486612f5a565b91604051958695602087017f3c7376672076696577426f783d223020302031303030302031303030302220789052604087017f6d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f7376679052606087017f22207374796c653d2277696474683a20313030253b206865696768743a2031309052608087017f30253b206261636b67726f756e642d636f6c6f723a20626c61636b3b223e000090526b1e31b4b931b6329031bc1e9160a11b609e88015260aa870161154b91611407565b65111031bc9e9160d11b815260060161156391611407565b61156c9061141e565b61157591611407565b631110179f60e11b81526004016b1e31b4b931b6329031bc1e9160a11b8152600c016115a091611407565b65111031bc9e9160d11b81526006016115b891611407565b6115c19061141e565b6115ca91611407565b631110179f60e11b8152600401651e17b9bb339f60d11b81526006015b03601f19810182526103439082610888565b9081602091031261024e5751610343816104a8565b6040513d6000823e3d90fd5b6040519061162782610851565b60028252614e6f60f01b6020830152565b634e487b7160e01b600052601160045260246000fd5b9061138891820391821161165e57565b611638565b60001981019190821161165e57565b9190820391821161165e57565b9061138891820180921161165e57565b9190820180921161165e57565b604051906116a982610851565b601382527268736c28393939382c2030252c20313030252960681b6020830152565b604051906116d882610851565b600382526259657360e81b6020830152565b90611755604460405180947f22696d616765223a22646174613a696d6167652f7376672b786d6c3b626173656020830152620d8d0b60ea1b604083015261173b8151809260206043860191016102ea565b8101601160f91b6043820152036024810185520183610888565b565b6001600160401b0381116106595760051b60200190565b602090818184031261024e578051906001600160401b03821161024e57019180601f8401121561024e5782516117a381611757565b936117b16040519586610888565b818552838086019260051b82010192831161024e578301905b8282106117d8575050505090565b815181529083019083016117ca565b634e487b7160e01b600052603260045260246000fd5b80511561180a5760200190565b6117e7565b80516001101561180a5760400190565b80516002101561180a5760600190565b80516003101561180a5760800190565b60208183031261024e578051906001600160401b03821161024e570181601f8201121561024e578051611871816108a9565b9261187f6040519485610888565b8184526020828401011161024e5761034391602080850191016102ea565b6040906040516060908181018181106001600160401b038211176106595760405260028152809360009160005b8281106118d8575050505050565b60209083516118e681610836565b868152828681830152878683015286888301528760808301528760a08301528760c08301528285010152016118ca565b6040906040519160a09060a084018481106001600160401b03821117610659576040526004845283926000805b60808082101561198b5784516020929161195c82610836565b60608083528085928784860152818a8601528782860152840152808984015260c0830152828a01015201611943565b5050509293505050565b6040519060c082018281106001600160401b0382111761065957604052609982527f6d756d2d7363616c65253235334431253235323225323533450000000000000060a0837f25323533436d65746125323532306e616d65253235334425323532327669657760208201527f706f727425323532322532353230636f6e74656e74253235334425323532327760408201527f6964746825323533446465766963652d7769647468253235324325323532306960608201527f6e697469616c2d7363616c65253235334431253235324325323532306d61786960808201520152565b60405190611a8382610851565b600f82526e25323533437374796c65253235334560881b6020830152565b60405190611aae8261086c565b61022f82526e094c8d4cd0894c8d4c10494c8d4dd1608a1b610240837f68746d6c2532353230253235374225323530412532353230253235323068656960208201527f676874253235334125323532303130302532353235253235334225323530412560408201527f323537442532353041626f64792532353230253235374225323530412532353260608201527f3025323532306d696e2d6865696768742532353341253235323031303025323560808201527f323525323533422532353041253235323025323532306d617267696e2532353360a08201527f412532353230302532353342253235304125323532302532353230706164646960c08201527f6e6725323533412532353230302532353342253235304125323537442532353060e08201527f4163616e766173253235323025323537422532353041253235323025323532306101008201527f70616464696e67253235334125323532303025323533422532353041253235326101208201527f3025323532306d617267696e253235334125323532306175746f2532353342256101408201527f3235304125323532302532353230646973706c617925323533412532353230626101608201527f6c6f636b2532353342253235304125323532302532353230706f736974696f6e6101808201527f253235334125323532306162736f6c75746525323533422532353041253235326101a08201527f302532353230746f7025323533412532353230302532353342253235304125326101c08201527f3532302532353230626f74746f6d2532353341253235323030253235334225326101e08201527f353041253235323025323532306c6566742532353341253235323030253235336102008201527f42253235304125323532302532353230726967687425323533412532353230306102208201520152565b60405190611d6b82610851565b6014825273253235334325323532467374796c65253235334560601b6020830152565b60405190611d9b82610851565b6013825272381a96bb18971a97181736b4b71735399733bd60691b6020830152565b60405190611dca82610851565b601382527267756e7a6970536372697074732d302e302e3160681b6020830152565b60405190608082018281106001600160401b0382111761065957604052604982526873653634253235324360b81b6060837f253235334373637269707425323532307372632532353344253235323264617460208201527f6125323533417465787425323532466a6176617363726970742532353342626160408201520152565b604e611755919392936040519485917f6c657420746f6b656e44617461203d207b22746f6b656e4964223a22000000006020840152611eb6815180926020603c870191016102ea565b82016e0445844d0c2e6d0cae64474b64460f608b1b603c820152611ee4825180936020604b850191016102ea565b0162225d7d60e81b604b82015203602e810185520183610888565b60405190611f0c82610851565b601f82527f25323532322532353345253235334325323532467363726970742532353345006020830152565b60405190604082018281106001600160401b038211176106595760405260606020838281520152565b906005821015611f6e5752565b634e487b7160e01b600052602160045260246000fd5b908082519081815260208091019281808460051b8301019501936000915b848310611fb25750505050505090565b9091929394958480612054600193601f198682030187528a5161204161202e612009611fe760e085519080885287019061030d565b898060a01b03888601511688870152604080860151908783039088015261030d565b61201b60608086015190870190611f61565b608080850151908683039087015261030d565b60a080840151908583039086015261030d565b9160c0809201519181840391015261030d565b9801930193019194939290611fa2565b906103439160208152602061208483516040838501526060840190611f84565b920151906040601f1982850301910152611f84565b65094c8c894dd160d21b815260060190565b6000906120b661161a565b91506120cc81600052600d602052604060002090565b546120de6120d983613174565b61164e565b916121046120ff6120f983600052600d602052604060002090565b54613174565b61167f565b93818303612902575061270e9261214561214061213b869761212461169c565b9461212d61169c565b6121356116cb565b96611461565b6133c5565b6116ea565b916000612150612be1565b156128875750600a5461270e9490612178906001600160a01b03165b6001600160a01b031690565b6040516309c6aaad60e21b815261270e600482015290600090829060249082905afa8015610d04576121b76000916121d8938391612865575b506117fd565b515b6040518093819263c68b378760e01b8352600483019190602083019252565b038173a4131c5d569bf73547c6dd6daa88a86b61e825575af48015610d04576123f4966000928392612849575b5061236161213b61221461189d565b936080612220866117fd565b510161222a611995565b905260806122378661180f565b5101612241611a76565b905260c061224e8661180f565b5101612258611aa1565b905260a06122658661180f565b510161226f611d5e565b905261235c61227c611916565b94612286866117fd565b5161228f611d8e565b90526122a7606061229f886117fd565b510160039052565b6122e77f000000000000000000000000000000000000000000000000000000000000000060206122d6896117fd565b516001600160a01b03909216910152565b6122f08661180f565b516122f9611dbd565b905261231160606123098861180f565b510160019052565b6123407f000000000000000000000000000000000000000000000000000000000000000060206122d68961180f565b608061234b8761181f565b5101612355611dec565b90526131ac565b611e6d565b60c061236c8361181f565b51015260a061237a8261181f565b5101612384611eff565b905260806123918261182f565b510161239b611dec565b90526123a5612a05565b60c06123b08361182f565b51015260a06123be8261182f565b51016123c8611eff565b90526123d2611f38565b918252602082015260405180978192635b872e9760e01b835260048301612064565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa948515610d0457600095612824575b5061243b826131ac565b95612445906131ac565b9661244f906131ac565b91612459906131ac565b90612463906131ac565b6040517519185d184e985c1c1b1a58d85d1a5bdb8bda9cdbdb8b60521b6020820152978897919391603689017f2537422532326e616d652532322533412532325371756967676c65253230466181526b726577656c6c25323025323360a01b6020820152602c016124d391611407565b7f2532322532432532302532326465736372697074696f6e25323225334125323281527f41253230746f6b656e253230726570726573656e74696e67253230796f75722560208201527f3230696e736372697074696f6e2532306f6e25323074686525323052656c696360408201527f253230636f6e74726163742532307468617425323070726f647563657325323060608201527f6125323066756c6c792532306f6e2d636861696e2532305371756967676c652560808201526e32302532333939393825323225324360881b60a082015260af017512991930ba3a3934b13aba32b99299191299a0929aa160511b81526016017f25374225323274726169745f747970652532322533412532324875652532305281527f656c696325323225324325323276616c756525323225334125323200000000006020820152603b0161261d91611407565b61262690612099565b7f25324325374225323274726169745f747970652532322533412532324875652581527f32304661726577656c6c25323225324325323276616c756525323225334125326020820152601960f91b604082015260410161268591611407565b61268e90612099565b7f25324325374225323274726169745f747970652532322533412532324f72646581527f7225323052656c696325323225324325323276616c756525323225334125323260208201526040016126e391611407565b6126ec90612099565b7f25324325374225323274726169745f747970652532322533412532324f72646581527f722532304661726577656c6c25323225324325323276616c756525323225334160208201526212991960e91b604082015260430161274d91611407565b61275690612099565b7f25324325374225323274726169745f747970652532322533412532324d61746381527f6865642532304f7264657225323225324325323276616c756525323225334125602082015261191960f11b60408201526042016127b691611407565b6127bf90612099565b62094d5160ea1b81526003016225324360e81b81526003016127e091611407565b6225324360e81b81526003017f253232616e696d6174696f6e5f75726c25323225334125323200000000000000815260190161281b91611407565b6115e790612099565b6128429195503d806000833e61283a8183610888565b81019061183f565b9338612431565b61285e9192503d8085833e61283a8183610888565b9038612205565b61288191503d8085833e6128798183610888565b81019061176e565b386121b1565b600a5490949085906128a1906001600160a01b031661216c565b6040516309c6aaad60e21b815260006004820152908290829060249082905afa918215610d04576121d892600092826128e193926128e7575b50506117fd565b516121b9565b6128fb92503d8091833e6128798183610888565b38806128da565b61214561214061213b61298f9761293497610c4e61295b6129bc61295b61292d61292d858d06613190565b9d8e612fe2565b61297360405193849261295560208501600490630d0e6d8560e31b81520190565b90611407565b6b2c20313030252c203530252960a01b8152600c0190565b0391612987601f1993848101835282610888565b948d06613190565b6129b060405194859261295560208501600490630d0e6d8560e31b81520190565b03908101835282610888565b90611461565b9291906129d0828286611254565b803b6129dd575b50505050565b6129e693613200565b156129f457388080806129d7565b6368d2bf6b60e11b60005260046000fd5b600a54604051638c3c9cdd60e01b81526000600482018190526024820181905292918390829060449082906001600160a01b03165afa908115610d04578391612bc7575b50604051612a5681610851565b601881527f6c6574206261636b67726f756e64496e646578203d20303b0000000000000000602082015260405191612a8d83610851565b601983527f6c6574206261636b67726f756e64496e646578203d2031303b000000000000006020840152612ac182826134b1565b91612ace868412156132b7565b519083519282612af0612aeb86612ae6848751611672565b61168f565b612ef0565b95885b838110612b9f5750885b868110612b6c575050612b0f9161168f565b8151811015612b5d5780612b36612b2860019385612f49565b516001600160f81b03191690565b612b56612b4c86612b47858a61168f565b611672565b918a1a9188612f49565b5301612b0f565b505050506103439192506133c5565b819250612b7e612b2882600194612f49565b612b95612b8b838761168f565b918c1a918a612f49565b5301908491612afd565b6001919250612bb1612b288287612f49565b8a1a612bbd828a612f49565b5301908491612af3565b612bdb91503d8085833e61283a8183610888565b38612a49565b600a546040516331a9108f60e11b815261270e60048201526001600160a01b03916020908290602490829086165afa60009181612c2b575b50612c25575050600090565b16151590565b612c4591925060203d602011610cfd57610cee8183610888565b9038612c19565b600a546040516331a9108f60e11b815260048101929092526001600160a01b0391906020908290602490829086165afa60009181612c2b5750612c25575050600090565b801561165e576000190190565b600090600080600054612cae575050565b9192505b8082526004602052604082205480612cd75750612cd0604091612c90565b9050612cb2565b600160e01b161592915050565b90600091600081612d245780548210612cfb575050565b9192505b8082526004602052604082205480612cd75750612d1d604091612c90565b9050612cff565b90815260046020526040902054600160e01b81166001600160a01b03909116119150565b632ce44b5f60e11b60005260046000fd5b62a1148160e81b60005260046000fd5b633a954ecd60e21b60005260046000fd5b636f96cda160e11b60005260046000fd5b612d9f816000526004602052604060002090565b549080612dfd578115612dbb5750600160e01b8116612d7a5790565b9050600054811015612df8575b60001901600081815260046020526040902054908115612df15750600160e01b8116612d7a5790565b9050612dc8565b612d7a565b50600160e01b81166001600160a01b0382161115612d7a5790565b6001600160a01b0316151580612e85575b612e2f57565b60405162461bcd60e51b815260206004820152602860248201527f536f756c626f756e6420746f6b656e3a207472616e73666572206973206e6f7460448201526708185b1b1bddd95960c21b6064820152608490fd5b506000612e29565b6001600160a01b0390811615159182612ea9575b5050612e2f57565b16151590503880612ea1565b6009546001600160a01b03163303612ec957565b60405163118cdaa760e01b8152336004820152602490fd5b600019811461165e5760010190565b90612efa826108a9565b612f076040519182610888565b8281528092612f18601f19916108a9565b0190602036910137565b90600a820291808304600a149015171561165e57565b60ff166030019060ff821161165e57565b90815181101561180a570160200190565b60008061138880805b612fce575080612f7284612ef0565b93905b612f7f5750505090565b612f8890611663565b90600a810490612f9782612f22565b810390811161165e576001600160f81b031990612fb69060ff16612f38565b60f81b16831a612fc68386612f49565b539081612f75565b92612fda600a91612ee1565b930480612f63565b801561307957806000826000935b613065575081612fff84612ef0565b93905b61300c5750505090565b61301590611663565b9161305161304161303c613036600a85049461303086612f22565b90611672565b60ff1690565b612f38565b60f81b6001600160f81b03191690565b821a61305d8486612f49565b539182613002565b92613071600a91612ee1565b930480612ff0565b5060405161308681610851565b60018152600360fc1b602082015290565b8115613163576130b1826000526004602052604060002090565b546001600160a01b039190600160e01b811690831611613152576001600160a01b0381164260a01b17600160e11b176130f4846000526004602052604060002090565b556001600160a01b038116600090815260056020526040902068010000000000000001815401905516801561314257600060008051602061357c8339815191528180a4600160085401600855565b622e076360e81b60005260046000fd5b63c991cbb160e01b60005260046000fd5b63149284b360e21b60005260046000fd5b6109c49081810291818304149015171561165e57610c4c900490565b6101689081810291818304149015171561165e57610c4d900490565b90604051608081019260a0820160405260008452925b6000190192600a9060308282060185530492836131c257809350608091030191601f1901918252565b9081602091031261024e57516103438161023c565b9260209161324993600060018060a01b0360405180978196829584630a85bd0160e11b9c8d8652336004870152166024850152604484015260806064840152608483019061030d565b0393165af160009181613286575b50613278576132646113d7565b80511561327357805190602001fd5b6129f4565b6001600160e01b0319161490565b6132a991925060203d6020116132b0575b6132a18183610888565b8101906131eb565b9038613257565b503d613297565b156132be57565b60405162461bcd60e51b815260206004820152601260248201527113db19081b1a5b99481b9bdd08199bdd5b9960721b6044820152606490fd5b60008054907c020000000000000000f3860788d1597cecf938424baabe976fac87dc264260a01b17613334836000526004602052604060002090565b5573f3860788d1597cecf938424baabe976fac87dc26918282526005602052604082206801000000000000000181540190556001926001820193826133b6576001815b613383575b5050505055565b156133a5575b838184848760008051602061357c8339815191528180a4613377565b80920191848303613389578061337c565b6340b23f1d60e11b8452600484fd5b906060918051806133d4575050565b9092506003926002906003600284010460021b92604051957f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f52603f936106707f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f18603f5260208801918689019560048260208901975b0194855183808260121c16519160009283538181600c1c1651600153818160061c165188531651855351815201938685101561348d57600490839061344d565b5050505091506040600093016040526003613d3d60f01b9106600204820352528252565b9080518015908115613570575b50613568576000905b6134d48351825190611672565b821161355f5760019260005b8251811015613555576134ff612b286134f9838761168f565b84612f49565b61351c61350f612b288487612f49565b6001600160f81b03191690565b6001600160f81b031990911603613535576001016134e0565b5092509060005b61354f5761354990612ee1565b906134c7565b91505090565b509291909161353c565b50505060001990565b505060001990565b9050825110386134be56feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220491059256050df62545fcd451b13032f96cc181fc8347de6d416b8f579f7607964736f6c63430008180033

Deployed Bytecode

0x6080604052600436101561001257600080fd5b60003560e01c806301ffc9a714610237578063032e6a2c1461023257806306fdde031461022d578063081812fc14610228578063095ea7b31461022357806318160ddd1461021e57806323b872dd1461021957806332cb6b0c146102145780633ccfd60b1461020f57806342842e0e1461020a57806342966c68146102055780635d0bb112146102005780635dab7f77146101fb5780636352211e146101f657806370a08231146101f1578063715018a6146101ec5780638b46adac146101e75780638da5cb5b146101e257806395d89b41146101dd578063a0712d68146101d8578063a1d62680146101d3578063a22cb465146101ce578063a4590bd0146101c9578063a9cb35ae146101c4578063b88d4fde146101bf578063b8d06e7a146101ba578063c2f14a2d146101b5578063c87b56dd146101b0578063e3b71f87146101ab578063e985e9c5146101a6578063f2fde38b146101a1578063f7da37621461019c578063f8004d31146101975763f936b40c1461019257600080fd5b61112d565b6110e8565b6110a3565b611011565b610fa9565b610f64565b610ed9565b610eb1565b610e95565b610e33565b610dee565b610dc5565b610d48565b610d29565b610b8f565b610ac9565b610aa0565b610a74565b610a16565b6109b8565b610989565b610916565b6107ec565b61065e565b610625565b6105b0565b610593565b61057f565b610526565b6104b9565b610455565b610346565b6102c1565b610253565b6001600160e01b031981160361024e57565b600080fd5b3461024e57602036600319011261024e5760206004356102728161023c565b63ffffffff60e01b166301ffc9a760e01b81149081156102b0575b811561029f575b506040519015158152f35b635b5e139f60e01b14905038610294565b6380ac58cd60e01b8114915061028d565b3461024e57600036600319011261024e57600a546040516001600160a01b039091168152602090f35b60005b8381106102fd5750506000910152565b81810151838201526020016102ed565b90602091610326815180928185528580860191016102ea565b601f01601f1916010190565b90602061034392818152019061030d565b90565b3461024e57600080600319360112610452576040519080600254906001918060011c9260018216928315610448575b60209260208610851461043457858852602088019490811561041357506001146103ba575b6103b6876103aa81890382610888565b60405191829182610332565b0390f35b600260005294509192917f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b83861061040257505050910190506103aa826103b6388061039a565b8054858701529482019481016103e6565b60ff191685525050505090151560051b0190506103aa826103b6388061039a565b634e487b7160e01b82526022600452602482fd5b93607f1693610375565b80fd5b3461024e57602036600319011261024e5760043561047281612ce4565b15610497576000526006602052602060018060a01b0360406000205416604051908152f35b6333d1c03960e21b60005260046000fd5b6001600160a01b0381160361024e57565b604036600319011261024e576104d06004356104a8565b60405162461bcd60e51b815260206004820152602860248201527f536f756c626f756e6420746f6b656e3a20617070726f76616c206973206e6f7460448201526708185b1b1bddd95960c21b6064820152608490fd5b3461024e57600036600319011261024e57602061054b60005460015490036008540190565b604051908152f35b606090600319011261024e5760043561056b816104a8565b90602435610578816104a8565b9060443590565b61059161058b36610553565b91611254565b005b3461024e57600036600319011261024e576020604051610c4d8152f35b3461024e57600080600319360112610452576105ca612eb5565b8080808060018060a01b036009541647905af16105e56113d7565b50156105ee5780f35b60405162461bcd60e51b815260206004820152600f60248201526e15da5d1a191c985dc819985a5b1959608a1b6044820152606490fd5b61062e36610553565b6040519160208301938385106001600160401b038611176106595761059194604052600084526129c2565b610820565b3461024e57602036600319011261024e5760043561067b81612d8b565b60008281526006602052604090208054916001600160a01b038116913380851490841417156106a9565b1590565b61079e575b6000936106ba84612e18565b610795575b506001600160a01b038216600090815260056020526040902080546fffffffffffffffffffffffffffffffff0190556001600160a01b0382164260a01b17600360e01b17610717856000526004602052604060002090565b55600160e11b81161561074c575b5060008051602061357c8339815191528280a461059161074760015460010190565b600155565b60018401610764816000526004602052604060002090565b5415610771575b50610725565b8354811461076b5761078d906000526004602052604060002090565b55388061076b565b839055386106bf565b6107e26106a56107db336107c48760018060a01b03166000526007602052604060002090565b9060018060a01b0316600052602052604060002090565b5460ff1690565b156106ae57612d48565b3461024e57602036600319011261024e57600435600052600c602052602060018060a01b0360406000205416604051908152f35b634e487b7160e01b600052604160045260246000fd5b60e081019081106001600160401b0382111761065957604052565b604081019081106001600160401b0382111761065957604052565b61026081019081106001600160401b0382111761065957604052565b90601f801991011681019081106001600160401b0382111761065957604052565b6001600160401b03811161065957601f01601f191660200190565b9291926108d0826108a9565b916108de6040519384610888565b82948184528183011161024e578281602093846000960137010152565b9080601f8301121561024e57816020610343933591016108c4565b3461024e57608036600319011261024e576001600160401b0360043581811161024e576109479036906004016108fb565b9060243590811161024e576103b6916109676109759236906004016108fb565b906064359160443591611461565b60405191829160208352602083019061030d565b3461024e57602036600319011261024e5760206001600160a01b036109af600435612d8b565b16604051908152f35b3461024e57602036600319011261024e576004356109d5816104a8565b6001600160a01b03168015610a0557600052600560205260206001600160401b0360406000205416604051908152f35b6323d3ad8160e21b60005260046000fd5b3461024e5760008060031936011261045257610a30612eb5565b600980546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b3461024e57602036600319011261024e57600435600052600d6020526020604060002054604051908152f35b3461024e57600036600319011261024e576009546040516001600160a01b039091168152602090f35b3461024e57600080600319360112610452576040519080600354906001918060011c9260018216928315610b85575b6020926020861085146104345785885260208801949081156104135750600114610b2c576103b6876103aa81890382610888565b600360005294509192917fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b838610610b7457505050910190506103aa826103b6388061039a565b805485870152948201948101610b58565b93607f1693610af8565b3461024e57602036600319011261024e576004803590600b5460ff8160a01c1615610d1957610c4d831015610d09576040516376e0659960e01b815282810184815290916001600160a01b03916020918491829003830190829085165afa918215610d0457600092610cd3575b5033911603610cc457610c0e82612ce4565b610cb6577ff7889fa98fb338f4dc3234c4ac4d3bf180e7af8a3a4f521fc318596a6b0fd53e610cb183610c6e33610c4f83600052600c602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b600054600154600854910301610c8e82600052600d602052604060002090565b55610c998133613097565b60408051338152602081019290925290918291820190565b0390a1005b60405162a5a1f560e01b8152fd5b6040516306e8659360e51b8152fd5b610cf691925060203d602011610cfd575b610cee8183610888565b8101906115f9565b9038610bfc565b503d610ce4565b61160e565b50604051632210334b60e21b8152fd5b5060405163589ed34b60e01b8152fd5b3461024e57602036600319011261024e576103b66109756004356120ab565b3461024e57604036600319011261024e57610d646004356104a8565b6024358015150361024e5760405162461bcd60e51b815260206004820152602860248201527f536f756c626f756e6420746f6b656e3a20617070726f76616c206973206e6f7460448201526708185b1b1bddd95960c21b6064820152608490fd5b3461024e57600036600319011261024e57600b546040516001600160a01b039091168152602090f35b3461024e57600036600319011261024e576040517f000000000000000000000000bd11994aabb55da86dc246ebb17c1be0af5b76996001600160a01b03168152602090f35b608036600319011261024e57600435610e4b816104a8565b602435610e57816104a8565b606435916001600160401b03831161024e573660238401121561024e57610e8b6105919336906024816004013591016108c4565b91604435916129c2565b3461024e57602036600319011261024e576103b6610975612a05565b3461024e57602036600319011261024e576020610ecf600435612c4c565b6040519015158152f35b3461024e57602036600319011261024e57600435610ef681612ce4565b15610f07576109756103b6916120ab565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b3461024e57600036600319011261024e576040517f000000000000000000000000d7587f110e08f4d120a231ba97d3b577a81df0226001600160a01b03168152602090f35b3461024e57604036600319011261024e57602060ff611005600435610fcd816104a8565b60243590610fda826104a8565b60018060a01b03166000526007845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b3461024e57602036600319011261024e5760043561102e816104a8565b611036612eb5565b6001600160a01b0390811690811561108a57600954826bffffffffffffffffffffffff60a01b821617600955167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b604051631e4fbdf760e01b815260006004820152602490fd5b3461024e57600036600319011261024e576040517f0000000000000000000000008faa1aab9da8c75917c43fb24fddb513eddc32456001600160a01b03168152602090f35b3461024e57602036600319011261024e5760043580151580910361024e5761110e612eb5565b600b805460ff60a01b191660a09290921b60ff60a01b16919091179055005b3461024e576000806003193601126104525773f3860788d1597cecf938424baabe976fac87dc26330361124257611162612c9d565b61123157808052600c6020526040812080546001600160a01b03191673f3860788d1597cecf938424baabe976fac87dc2617905560008052600d602052807f81955a0a11e65eac625c29e8882660bae4e165a75d72780094acae8ece9a29ee556111ca6132f8565b600b805460ff60a01b1916600160a01b1790557ff7889fa98fb338f4dc3234c4ac4d3bf180e7af8a3a4f521fc318596a6b0fd53e6040518061122b819060006020604084019373f3860788d1597cecf938424baabe976fac87dc2681520152565b0390a180f35b60405162a5a1f560e01b8152600490fd5b604051633ceefd7d60e21b8152600490fd5b91909161126082612d8b565b6001600160a01b0391821693908281168590036113d257600084815260066020526040902080546112a06001600160a01b03881633908114908314171590565b6113a2575b6112af8488612e8d565b611398575b506001600160a01b038516600090815260056020526040902080546000190190556001600160a01b0382166000908152600560205260409020805460010190556001600160a01b0382164260a01b17600160e11b1761131d856000526004602052604060002090565b55600160e11b81161561134e575b5016809260008051602061357c833981519152600080a41561134957565b612d69565b60018401611366816000526004602052604060002090565b5415611373575b5061132b565b600054811461136d57611390906000526004602052604060002090565b55388061136d565b60009055386112b4565b6113c86106a56107db336107c48b60018060a01b03166000526007602052604060002090565b156112a557612d48565b612d59565b3d15611402573d906113e8826108a9565b916113f66040519384610888565b82523d6000602084013e565b606090565b9061141a602092828151948592016102ea565b0190565b7f2220723d22343030222066696c6c3d226e6f6e6522207374726f6b652d7769648152703a341e91189818111039ba3937b5b29e9160791b602082015260310190565b9161146b90612fe2565b91611474612f5a565b9361147e90612fe2565b611486612f5a565b91604051958695602087017f3c7376672076696577426f783d223020302031303030302031303030302220789052604087017f6d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f7376679052606087017f22207374796c653d2277696474683a20313030253b206865696768743a2031309052608087017f30253b206261636b67726f756e642d636f6c6f723a20626c61636b3b223e000090526b1e31b4b931b6329031bc1e9160a11b609e88015260aa870161154b91611407565b65111031bc9e9160d11b815260060161156391611407565b61156c9061141e565b61157591611407565b631110179f60e11b81526004016b1e31b4b931b6329031bc1e9160a11b8152600c016115a091611407565b65111031bc9e9160d11b81526006016115b891611407565b6115c19061141e565b6115ca91611407565b631110179f60e11b8152600401651e17b9bb339f60d11b81526006015b03601f19810182526103439082610888565b9081602091031261024e5751610343816104a8565b6040513d6000823e3d90fd5b6040519061162782610851565b60028252614e6f60f01b6020830152565b634e487b7160e01b600052601160045260246000fd5b9061138891820391821161165e57565b611638565b60001981019190821161165e57565b9190820391821161165e57565b9061138891820180921161165e57565b9190820180921161165e57565b604051906116a982610851565b601382527268736c28393939382c2030252c20313030252960681b6020830152565b604051906116d882610851565b600382526259657360e81b6020830152565b90611755604460405180947f22696d616765223a22646174613a696d6167652f7376672b786d6c3b626173656020830152620d8d0b60ea1b604083015261173b8151809260206043860191016102ea565b8101601160f91b6043820152036024810185520183610888565b565b6001600160401b0381116106595760051b60200190565b602090818184031261024e578051906001600160401b03821161024e57019180601f8401121561024e5782516117a381611757565b936117b16040519586610888565b818552838086019260051b82010192831161024e578301905b8282106117d8575050505090565b815181529083019083016117ca565b634e487b7160e01b600052603260045260246000fd5b80511561180a5760200190565b6117e7565b80516001101561180a5760400190565b80516002101561180a5760600190565b80516003101561180a5760800190565b60208183031261024e578051906001600160401b03821161024e570181601f8201121561024e578051611871816108a9565b9261187f6040519485610888565b8184526020828401011161024e5761034391602080850191016102ea565b6040906040516060908181018181106001600160401b038211176106595760405260028152809360009160005b8281106118d8575050505050565b60209083516118e681610836565b868152828681830152878683015286888301528760808301528760a08301528760c08301528285010152016118ca565b6040906040519160a09060a084018481106001600160401b03821117610659576040526004845283926000805b60808082101561198b5784516020929161195c82610836565b60608083528085928784860152818a8601528782860152840152808984015260c0830152828a01015201611943565b5050509293505050565b6040519060c082018281106001600160401b0382111761065957604052609982527f6d756d2d7363616c65253235334431253235323225323533450000000000000060a0837f25323533436d65746125323532306e616d65253235334425323532327669657760208201527f706f727425323532322532353230636f6e74656e74253235334425323532327760408201527f6964746825323533446465766963652d7769647468253235324325323532306960608201527f6e697469616c2d7363616c65253235334431253235324325323532306d61786960808201520152565b60405190611a8382610851565b600f82526e25323533437374796c65253235334560881b6020830152565b60405190611aae8261086c565b61022f82526e094c8d4cd0894c8d4c10494c8d4dd1608a1b610240837f68746d6c2532353230253235374225323530412532353230253235323068656960208201527f676874253235334125323532303130302532353235253235334225323530412560408201527f323537442532353041626f64792532353230253235374225323530412532353260608201527f3025323532306d696e2d6865696768742532353341253235323031303025323560808201527f323525323533422532353041253235323025323532306d617267696e2532353360a08201527f412532353230302532353342253235304125323532302532353230706164646960c08201527f6e6725323533412532353230302532353342253235304125323537442532353060e08201527f4163616e766173253235323025323537422532353041253235323025323532306101008201527f70616464696e67253235334125323532303025323533422532353041253235326101208201527f3025323532306d617267696e253235334125323532306175746f2532353342256101408201527f3235304125323532302532353230646973706c617925323533412532353230626101608201527f6c6f636b2532353342253235304125323532302532353230706f736974696f6e6101808201527f253235334125323532306162736f6c75746525323533422532353041253235326101a08201527f302532353230746f7025323533412532353230302532353342253235304125326101c08201527f3532302532353230626f74746f6d2532353341253235323030253235334225326101e08201527f353041253235323025323532306c6566742532353341253235323030253235336102008201527f42253235304125323532302532353230726967687425323533412532353230306102208201520152565b60405190611d6b82610851565b6014825273253235334325323532467374796c65253235334560601b6020830152565b60405190611d9b82610851565b6013825272381a96bb18971a97181736b4b71735399733bd60691b6020830152565b60405190611dca82610851565b601382527267756e7a6970536372697074732d302e302e3160681b6020830152565b60405190608082018281106001600160401b0382111761065957604052604982526873653634253235324360b81b6060837f253235334373637269707425323532307372632532353344253235323264617460208201527f6125323533417465787425323532466a6176617363726970742532353342626160408201520152565b604e611755919392936040519485917f6c657420746f6b656e44617461203d207b22746f6b656e4964223a22000000006020840152611eb6815180926020603c870191016102ea565b82016e0445844d0c2e6d0cae64474b64460f608b1b603c820152611ee4825180936020604b850191016102ea565b0162225d7d60e81b604b82015203602e810185520183610888565b60405190611f0c82610851565b601f82527f25323532322532353345253235334325323532467363726970742532353345006020830152565b60405190604082018281106001600160401b038211176106595760405260606020838281520152565b906005821015611f6e5752565b634e487b7160e01b600052602160045260246000fd5b908082519081815260208091019281808460051b8301019501936000915b848310611fb25750505050505090565b9091929394958480612054600193601f198682030187528a5161204161202e612009611fe760e085519080885287019061030d565b898060a01b03888601511688870152604080860151908783039088015261030d565b61201b60608086015190870190611f61565b608080850151908683039087015261030d565b60a080840151908583039086015261030d565b9160c0809201519181840391015261030d565b9801930193019194939290611fa2565b906103439160208152602061208483516040838501526060840190611f84565b920151906040601f1982850301910152611f84565b65094c8c894dd160d21b815260060190565b6000906120b661161a565b91506120cc81600052600d602052604060002090565b546120de6120d983613174565b61164e565b916121046120ff6120f983600052600d602052604060002090565b54613174565b61167f565b93818303612902575061270e9261214561214061213b869761212461169c565b9461212d61169c565b6121356116cb565b96611461565b6133c5565b6116ea565b916000612150612be1565b156128875750600a5461270e9490612178906001600160a01b03165b6001600160a01b031690565b6040516309c6aaad60e21b815261270e600482015290600090829060249082905afa8015610d04576121b76000916121d8938391612865575b506117fd565b515b6040518093819263c68b378760e01b8352600483019190602083019252565b038173a4131c5d569bf73547c6dd6daa88a86b61e825575af48015610d04576123f4966000928392612849575b5061236161213b61221461189d565b936080612220866117fd565b510161222a611995565b905260806122378661180f565b5101612241611a76565b905260c061224e8661180f565b5101612258611aa1565b905260a06122658661180f565b510161226f611d5e565b905261235c61227c611916565b94612286866117fd565b5161228f611d8e565b90526122a7606061229f886117fd565b510160039052565b6122e77f0000000000000000000000008faa1aab9da8c75917c43fb24fddb513eddc324560206122d6896117fd565b516001600160a01b03909216910152565b6122f08661180f565b516122f9611dbd565b905261231160606123098861180f565b510160019052565b6123407f000000000000000000000000bd11994aabb55da86dc246ebb17c1be0af5b769960206122d68961180f565b608061234b8761181f565b5101612355611dec565b90526131ac565b611e6d565b60c061236c8361181f565b51015260a061237a8261181f565b5101612384611eff565b905260806123918261182f565b510161239b611dec565b90526123a5612a05565b60c06123b08361182f565b51015260a06123be8261182f565b51016123c8611eff565b90526123d2611f38565b918252602082015260405180978192635b872e9760e01b835260048301612064565b03817f000000000000000000000000d7587f110e08f4d120a231ba97d3b577a81df0226001600160a01b03165afa948515610d0457600095612824575b5061243b826131ac565b95612445906131ac565b9661244f906131ac565b91612459906131ac565b90612463906131ac565b6040517519185d184e985c1c1b1a58d85d1a5bdb8bda9cdbdb8b60521b6020820152978897919391603689017f2537422532326e616d652532322533412532325371756967676c65253230466181526b726577656c6c25323025323360a01b6020820152602c016124d391611407565b7f2532322532432532302532326465736372697074696f6e25323225334125323281527f41253230746f6b656e253230726570726573656e74696e67253230796f75722560208201527f3230696e736372697074696f6e2532306f6e25323074686525323052656c696360408201527f253230636f6e74726163742532307468617425323070726f647563657325323060608201527f6125323066756c6c792532306f6e2d636861696e2532305371756967676c652560808201526e32302532333939393825323225324360881b60a082015260af017512991930ba3a3934b13aba32b99299191299a0929aa160511b81526016017f25374225323274726169745f747970652532322533412532324875652532305281527f656c696325323225324325323276616c756525323225334125323200000000006020820152603b0161261d91611407565b61262690612099565b7f25324325374225323274726169745f747970652532322533412532324875652581527f32304661726577656c6c25323225324325323276616c756525323225334125326020820152601960f91b604082015260410161268591611407565b61268e90612099565b7f25324325374225323274726169745f747970652532322533412532324f72646581527f7225323052656c696325323225324325323276616c756525323225334125323260208201526040016126e391611407565b6126ec90612099565b7f25324325374225323274726169745f747970652532322533412532324f72646581527f722532304661726577656c6c25323225324325323276616c756525323225334160208201526212991960e91b604082015260430161274d91611407565b61275690612099565b7f25324325374225323274726169745f747970652532322533412532324d61746381527f6865642532304f7264657225323225324325323276616c756525323225334125602082015261191960f11b60408201526042016127b691611407565b6127bf90612099565b62094d5160ea1b81526003016225324360e81b81526003016127e091611407565b6225324360e81b81526003017f253232616e696d6174696f6e5f75726c25323225334125323200000000000000815260190161281b91611407565b6115e790612099565b6128429195503d806000833e61283a8183610888565b81019061183f565b9338612431565b61285e9192503d8085833e61283a8183610888565b9038612205565b61288191503d8085833e6128798183610888565b81019061176e565b386121b1565b600a5490949085906128a1906001600160a01b031661216c565b6040516309c6aaad60e21b815260006004820152908290829060249082905afa918215610d04576121d892600092826128e193926128e7575b50506117fd565b516121b9565b6128fb92503d8091833e6128798183610888565b38806128da565b61214561214061213b61298f9761293497610c4e61295b6129bc61295b61292d61292d858d06613190565b9d8e612fe2565b61297360405193849261295560208501600490630d0e6d8560e31b81520190565b90611407565b6b2c20313030252c203530252960a01b8152600c0190565b0391612987601f1993848101835282610888565b948d06613190565b6129b060405194859261295560208501600490630d0e6d8560e31b81520190565b03908101835282610888565b90611461565b9291906129d0828286611254565b803b6129dd575b50505050565b6129e693613200565b156129f457388080806129d7565b6368d2bf6b60e11b60005260046000fd5b600a54604051638c3c9cdd60e01b81526000600482018190526024820181905292918390829060449082906001600160a01b03165afa908115610d04578391612bc7575b50604051612a5681610851565b601881527f6c6574206261636b67726f756e64496e646578203d20303b0000000000000000602082015260405191612a8d83610851565b601983527f6c6574206261636b67726f756e64496e646578203d2031303b000000000000006020840152612ac182826134b1565b91612ace868412156132b7565b519083519282612af0612aeb86612ae6848751611672565b61168f565b612ef0565b95885b838110612b9f5750885b868110612b6c575050612b0f9161168f565b8151811015612b5d5780612b36612b2860019385612f49565b516001600160f81b03191690565b612b56612b4c86612b47858a61168f565b611672565b918a1a9188612f49565b5301612b0f565b505050506103439192506133c5565b819250612b7e612b2882600194612f49565b612b95612b8b838761168f565b918c1a918a612f49565b5301908491612afd565b6001919250612bb1612b288287612f49565b8a1a612bbd828a612f49565b5301908491612af3565b612bdb91503d8085833e61283a8183610888565b38612a49565b600a546040516331a9108f60e11b815261270e60048201526001600160a01b03916020908290602490829086165afa60009181612c2b575b50612c25575050600090565b16151590565b612c4591925060203d602011610cfd57610cee8183610888565b9038612c19565b600a546040516331a9108f60e11b815260048101929092526001600160a01b0391906020908290602490829086165afa60009181612c2b5750612c25575050600090565b801561165e576000190190565b600090600080600054612cae575050565b9192505b8082526004602052604082205480612cd75750612cd0604091612c90565b9050612cb2565b600160e01b161592915050565b90600091600081612d245780548210612cfb575050565b9192505b8082526004602052604082205480612cd75750612d1d604091612c90565b9050612cff565b90815260046020526040902054600160e01b81166001600160a01b03909116119150565b632ce44b5f60e11b60005260046000fd5b62a1148160e81b60005260046000fd5b633a954ecd60e21b60005260046000fd5b636f96cda160e11b60005260046000fd5b612d9f816000526004602052604060002090565b549080612dfd578115612dbb5750600160e01b8116612d7a5790565b9050600054811015612df8575b60001901600081815260046020526040902054908115612df15750600160e01b8116612d7a5790565b9050612dc8565b612d7a565b50600160e01b81166001600160a01b0382161115612d7a5790565b6001600160a01b0316151580612e85575b612e2f57565b60405162461bcd60e51b815260206004820152602860248201527f536f756c626f756e6420746f6b656e3a207472616e73666572206973206e6f7460448201526708185b1b1bddd95960c21b6064820152608490fd5b506000612e29565b6001600160a01b0390811615159182612ea9575b5050612e2f57565b16151590503880612ea1565b6009546001600160a01b03163303612ec957565b60405163118cdaa760e01b8152336004820152602490fd5b600019811461165e5760010190565b90612efa826108a9565b612f076040519182610888565b8281528092612f18601f19916108a9565b0190602036910137565b90600a820291808304600a149015171561165e57565b60ff166030019060ff821161165e57565b90815181101561180a570160200190565b60008061138880805b612fce575080612f7284612ef0565b93905b612f7f5750505090565b612f8890611663565b90600a810490612f9782612f22565b810390811161165e576001600160f81b031990612fb69060ff16612f38565b60f81b16831a612fc68386612f49565b539081612f75565b92612fda600a91612ee1565b930480612f63565b801561307957806000826000935b613065575081612fff84612ef0565b93905b61300c5750505090565b61301590611663565b9161305161304161303c613036600a85049461303086612f22565b90611672565b60ff1690565b612f38565b60f81b6001600160f81b03191690565b821a61305d8486612f49565b539182613002565b92613071600a91612ee1565b930480612ff0565b5060405161308681610851565b60018152600360fc1b602082015290565b8115613163576130b1826000526004602052604060002090565b546001600160a01b039190600160e01b811690831611613152576001600160a01b0381164260a01b17600160e11b176130f4846000526004602052604060002090565b556001600160a01b038116600090815260056020526040902068010000000000000001815401905516801561314257600060008051602061357c8339815191528180a4600160085401600855565b622e076360e81b60005260046000fd5b63c991cbb160e01b60005260046000fd5b63149284b360e21b60005260046000fd5b6109c49081810291818304149015171561165e57610c4c900490565b6101689081810291818304149015171561165e57610c4d900490565b90604051608081019260a0820160405260008452925b6000190192600a9060308282060185530492836131c257809350608091030191601f1901918252565b9081602091031261024e57516103438161023c565b9260209161324993600060018060a01b0360405180978196829584630a85bd0160e11b9c8d8652336004870152166024850152604484015260806064840152608483019061030d565b0393165af160009181613286575b50613278576132646113d7565b80511561327357805190602001fd5b6129f4565b6001600160e01b0319161490565b6132a991925060203d6020116132b0575b6132a18183610888565b8101906131eb565b9038613257565b503d613297565b156132be57565b60405162461bcd60e51b815260206004820152601260248201527113db19081b1a5b99481b9bdd08199bdd5b9960721b6044820152606490fd5b60008054907c020000000000000000f3860788d1597cecf938424baabe976fac87dc264260a01b17613334836000526004602052604060002090565b5573f3860788d1597cecf938424baabe976fac87dc26918282526005602052604082206801000000000000000181540190556001926001820193826133b6576001815b613383575b5050505055565b156133a5575b838184848760008051602061357c8339815191528180a4613377565b80920191848303613389578061337c565b6340b23f1d60e11b8452600484fd5b906060918051806133d4575050565b9092506003926002906003600284010460021b92604051957f4142434445464748494a4b4c4d4e4f505152535455565758595a616263646566601f52603f936106707f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392d5f18603f5260208801918689019560048260208901975b0194855183808260121c16519160009283538181600c1c1651600153818160061c165188531651855351815201938685101561348d57600490839061344d565b5050505091506040600093016040526003613d3d60f01b9106600204820352528252565b9080518015908115613570575b50613568576000905b6134d48351825190611672565b821161355f5760019260005b8251811015613555576134ff612b286134f9838761168f565b84612f49565b61351c61350f612b288487612f49565b6001600160f81b03191690565b6001600160f81b031990911603613535576001016134e0565b5092509060005b61354f5761354990612ee1565b906134c7565b91505090565b509291909161353c565b50505060001990565b505060001990565b9050825110386134be56feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220491059256050df62545fcd451b13032f96cc181fc8347de6d416b8f579f7607964736f6c63430008180033

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.