ETH Price: $2,903.08 (-0.76%)

Token

AscendTheEnd (ATE)

Overview

Max Total Supply

203 ATE

Holders

0

Transfers

-
0

Market

Price

$0.00 @ 0.000000 ETH

Onchain Market Cap

-

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 0 Decimals)

Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
AscendTheEnd

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

/**
 *
 *     ___   _____ _____________   ______     ________  ________   _______   ______
 *    /   | / ___// ____/ ____/ | / / __ \   /_  __/ / / / ____/  / ____/ | / / __ \
 *   / /| | \__ \/ /   / __/ /  |/ / / / /    / / / /_/ / __/    / __/ /  |/ / / / /
 *  / ___ |___/ / /___/ /___/ /|  / /_/ /    / / / __  / /___   / /___/ /|  / /_/ /
 * /_/  |_/____/\____/_____/_/ |_/_____/    /_/ /_/ /_/_____/  /_____/_/ |_/_____/
 *
 */

import {ERC721A} from "erc721a/contracts/ERC721A.sol";
import {Ownable2Step, Ownable} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";

/**
 * @title  AscendTheEnd
 * @author vani(@vaniiiii)
 * @notice AscendTheEnd is a multi-stage-mint NFT smart contract
 *         Inspired by ERC721SeaDrop and GasliteNFT
 */
contract AscendTheEnd is ERC721A, Ownable2Step, ERC2981 {
    /**
     * @notice A struct defining the configuration of a stage
     *
     * @param mintPrice The price to mint a token
     * @param maxMintableByWallet The maximum number of tokens that can be minted by a wallet
     * @param startTime The start time of the stage
     * @param endTime The end time of the stage
     * @param maxTokenSupplyForStage The maximum number of tokens that can be minted in the stage
     * @param merkleRoot The merkle root for the stage. If 0, the stage is public
     */
    struct StageConfig {
        uint80 mintPrice;
        uint16 maxMintableByWallet;
        uint48 startTime;
        uint48 endTime;
        uint32 maxTokenSupplyForStage;
        bytes32 merkleRoot;
    }

    uint256 public constant MAX_SUPPLY = 3_000;
    uint256 public constant MAX_NUMBER_OF_STAGES = 4;
    uint8 public constant ROYALTY_PERCENTAGE = 5;

    string private s_baseURI;

    StageConfig[] public stages;

    event ATE__StageConfigured(
        uint256 indexed stageIndex,
        StageConfig stageConfig
    );
    event ATE__StageCreated(
        uint256 indexed stageIndex,
        StageConfig stageConfig
    );
    event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); // ERC4906

    error ATE__StageIsNotActive();
    error ATE__IncorrectPayment();
    error ATE__MintQuantityCannotBeZero();
    error ATE__MintQuantityExceedsMaxMintedPerWallet();
    error ATE__MintQuantityExceedsMaxTokenSupplyForStage();
    error ATE__MintQuantityExceedsMaxSupply();
    error ATE__MintUnauthorized();
    error ATE__MaxStagesExceeded();
    error ATE__InvalidStageIndex();
    error ATE__StageEnded();
    error ATE__StageStarted();
    error ATE__InvalidConfigTimestamp();
    error ATE__InvalidConfigMaxTokenSupplyForStage();
    error ATE__InvalidLength();

    constructor(
        string memory baseURI
    ) ERC721A("AscendTheEnd", "ATE") Ownable(msg.sender) {
        s_baseURI = baseURI;
        _setDefaultRoyalty(msg.sender, _feeDenominator() * ROYALTY_PERCENTAGE / 100);
    }

    /**
     * @notice Mint NFTs for specified stage
     *
     * @param stageIndex The index of the stage to mint from
     * @param quantity The number of tokens to mint
     * @param proof The merkle proof for the wallet
     */
    function mint(
        uint256 stageIndex,
        uint256 quantity,
        bytes32[] calldata proof
    ) external payable {
        StageConfig memory stage = stages[stageIndex];

        // Validate the stage is active
        if (!_checkStageActivity(stage.startTime, stage.endTime)) {
            revert ATE__StageIsNotActive();
        }

        // Validate payment is correct for number minted
        _checkCorrectPayment(quantity, stage.mintPrice);

        // Validate the quantity is within the limit
        _checkMintQuantity(
            quantity,
            stage.maxMintableByWallet,
            stage.maxTokenSupplyForStage
        );

        // If the stage has a merkle root, validate the proof for allowlist
        if (stage.merkleRoot != 0) {
            if (
                !MerkleProof.verifyCalldata(
                    proof,
                    stage.merkleRoot,
                    keccak256(abi.encodePacked(msg.sender))
                )
            ) {
                revert ATE__MintUnauthorized();
            }
            _mint(msg.sender, quantity);
        } else {
            // If the stage has no merkle root it means it's public
            _mint(msg.sender, quantity);
        }
    }

    /**
     * @notice Creates a stage
     *
     * @dev Only the owner can call this function
     *      Stages start and end times shouldn't overlap
     *
     * @param stageConfig The configuration of the stage
     */
    function createStage(StageConfig calldata stageConfig) external onlyOwner {
        _createStage(stageConfig);
    }

    /**
     * @notice Creates multiple stages at time
     *
     * @dev Only the owner can call this function
     *
     * @param stageConfigs The configurations of the stages
     */
    function createStages(
        StageConfig[] calldata stageConfigs
    ) external onlyOwner {
        for (uint256 i = 0; i < stageConfigs.length; i++) {
            // Create each stage
            _createStage(stageConfigs[i]);
        }
    }

    /**
     * @notice Configure a stage
     *
     * @dev Only the owner can call this function
     *
     * @param stageIndex The index of the stage to configure
     * @param stageConfig The configuration of the stage
     */
    function configureStage(
        uint256 stageIndex,
        StageConfig calldata stageConfig
    ) external onlyOwner {
        // Configure the stage
        _configureStage(stageIndex, stageConfig);
    }

    /**
     * @notice Configure multiple stages at time
     *
     * @dev Only the owner can call this function
     *
     * @param stageIndexes The indexes of the stages to configure
     * @param stageConfigs The configurations of the stages
     */
    function configureStages(
        uint256[] calldata stageIndexes,
        StageConfig[] calldata stageConfigs
    ) external onlyOwner {
        // Ensure the lengths of the arrays are the same
        if (stageIndexes.length != stageConfigs.length) {
            revert ATE__InvalidLength();
        }
        for (uint256 i = 0; i < stageIndexes.length; i++) {
            // Configure each stage
            _configureStage(stageIndexes[i], stageConfigs[i]);
        }
    }

    /**
     * @notice Set the base URI
     *
     * @dev Only the owner can call this function
     *
     * @param baseURI Base URI of the NFT
     */
    function setBaseURI(string calldata baseURI) external onlyOwner {
        s_baseURI = baseURI;
        emit BatchMetadataUpdate(1, type(uint256).max);
    }

    /**
     * @notice Withdraw the contract balance
     *
     * @dev Only the owner can call this function
     */
    function withdraw() external onlyOwner {
        (bool success, ) = payable(msg.sender).call{
            value: address(this).balance
        }("");
        require(success);
    }

    /**
     * @notice Returns the total number of stages
     *
     * @return uint256 The total number of stages
     */
    function totalStages() external view returns (uint256) {
        return stages.length;
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     *      token will be the concatenation of the `baseURI` and the `tokenId`.
     *
     * @return string The base URI
     */
    function _baseURI() internal view override returns (string memory) {
        return s_baseURI;
    }

    /**
     * @notice Revert if the payment is not the quantity times the mint price
     *
     * @param quantity  The number of tokens to mint
     * @param mintPrice The mint price per token
     */
    function _checkCorrectPayment(
        uint256 quantity,
        uint256 mintPrice
    ) internal view {
        // Revert if the tx's value doesn't match the total cost
        if (msg.value != quantity * mintPrice) {
            revert ATE__IncorrectPayment();
        }
    }

    /**
     * @notice Check that the wallet is allowed to mint the desired quantity
     *
     * @param quantity                 The number of tokens to mint
     * @param maxMintableByWallet      The max allowed mints per wallet
     * @param maxTokenSupplyForStage   The max token supply for the drop stage
     */
    function _checkMintQuantity(
        uint256 quantity,
        uint256 maxMintableByWallet,
        uint256 maxTokenSupplyForStage
    ) internal view {
        // Mint quantity of zero is not valid
        if (quantity == 0) {
            revert ATE__MintQuantityCannotBeZero();
        }

        // Ensure mint quantity doesn't exceed maxMintableByWallet
        if (quantity + _numberMinted(msg.sender) > maxMintableByWallet) {
            revert ATE__MintQuantityExceedsMaxMintedPerWallet();
        }
        // Ensure mint quantity doesn't exceed maxTokenSupplyForStage
        if (quantity + _totalMinted() > maxTokenSupplyForStage) {
            revert ATE__MintQuantityExceedsMaxTokenSupplyForStage();
        }

        // Ensure mint quantity doesn't exceed maxSupply
        if (quantity + _totalMinted() > MAX_SUPPLY) {
            revert ATE__MintQuantityExceedsMaxSupply();
        }
    }

    /**
     * @notice Internal function called in external creation functions
     *
     * @param stageConfig The configuration of the stage
     */
    function _createStage(StageConfig calldata stageConfig) internal {
        uint256 stageIndex = stages.length;

        // Validate the configuration
        _checkConfig(stageIndex, stageConfig);

        stages.push(stageConfig);
        emit ATE__StageCreated(stageIndex, stageConfig);
        emit ATE__StageConfigured(stageIndex, stageConfig);
    }

    /**
     * @notice Internal function called in external configuration functions
     *
     * @param stageIndex The index of the stage to configure
     * @param stageConfig The configuration of the stage
     */
    function _configureStage(
        uint256 stageIndex,
        StageConfig calldata stageConfig
    ) internal {
        // Validate the configuration
        _checkConfig(stageIndex, stageConfig);

        stages[stageIndex] = stageConfig;
        emit ATE__StageConfigured(stageIndex, stageConfig);
    }

    /**
     * @notice Returns if the stage is active or not
     *
     * @param startTime The start time of the stage
     * @param endTime The end time of the stage
     *
     * @return bool True if the stage is active, false otherwise
     */
    function _checkStageActivity(
        uint48 startTime,
        uint48 endTime
    ) internal view returns (bool) {
        // Return false if the stage is not active
        if (block.timestamp < startTime || block.timestamp > endTime) {
            return false;
        }
        return true;
    }

    /**
     * @notice Check if the configuration of the stage is valid
     *
     * @param stageConfig The configuration of the stage
     */
    function _checkConfig(
        uint256 stageIndex,
        StageConfig calldata stageConfig
    ) internal view {
        // Ensure the stage index is valid
        if (stageIndex >= MAX_NUMBER_OF_STAGES) {
            revert ATE__InvalidStageIndex();
        }

        // If stage already exists, ensure it's not started or ended
        if (stageIndex < stages.length) {
            StageConfig memory currentStageConfig = stages[stageIndex];
            // Ensure the stage didn't start
            if (
                (
                    _checkStageActivity(
                        currentStageConfig.startTime,
                        currentStageConfig.endTime
                    )
                )
            ) {
                revert ATE__StageStarted();
            }

            // Ensure the stage didn't end
            if (
                currentStageConfig.endTime != 0 &&
                block.timestamp > currentStageConfig.endTime
            ) {
                revert ATE__StageEnded();
            }
        }

        // Ensure the start time is before the end time and in the future
        if (
            stageConfig.startTime > stageConfig.endTime ||
            stageConfig.startTime < block.timestamp
        ) {
            revert ATE__InvalidConfigTimestamp();
        }

        // Ensure the maxTokenSupplyForStage is less than the max supply
        if (stageConfig.maxTokenSupplyForStage > MAX_SUPPLY) {
            revert ATE__InvalidConfigMaxTokenSupplyForStage();
        }
    }

    /**
     * @dev Overrides the `_startTokenId` function from ERC721A
     *      to start at token id `1`.
     *
     *      This is to avoid future possible problems since `0` is usually
     *      used to signal values that have not been set or have been removed
     */
    function _startTokenId() internal view virtual override returns (uint256) {
        return 1;
    }

    /**
     * @dev Returns the URI for a given token ID.
     * @param tokenId The ID of the token to retrieve the URI for.
     * @return A string representing the URI for the given token ID.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        return string(abi.encodePacked(super.tokenURI(tokenId), ".json"));
    }

    /**
     * @dev Checks if the contract supports a given interface.
     * This function overrides the supportsInterface function from ERC721A and ERC2981 contracts.
     * @param interfaceId The interface identifier.
     * @return A boolean value indicating whether the contract supports the given interface.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, ERC2981) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * This extension of the {Ownable} contract includes a two-step mechanism to transfer
 * ownership, where the new owner must call {acceptOwnership} in order to replace the
 * old one. This can help prevent common mistakes, such as transfers of ownership to
 * incorrect accounts, or to contracts that are unable to interact with the
 * permission system.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.20;

import {IERC2981} from "../../interfaces/IERC2981.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";

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

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

    /**
     * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);

    /**
     * @dev The default royalty receiver is invalid.
     */
    error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);

    /**
     * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);

    /**
     * @dev The royalty receiver for `tokenId` is invalid.
     */
    error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) {
        RoyaltyInfo storage _royaltyInfo = _tokenRoyaltyInfo[tokenId];
        address royaltyReceiver = _royaltyInfo.receiver;
        uint96 royaltyFraction = _royaltyInfo.royaltyFraction;

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

        uint256 royaltyAmount = (salePrice * royaltyFraction) / _feeDenominator();

        return (royaltyReceiver, royaltyAmount);
    }

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

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
        }

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
        }

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

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

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

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library of standard hash functions.
 */
library Hashes {
    /**
     * @dev Commutative Keccak256 hash of a sorted pair of bytes32. Frequently used when working with merkle proofs.
     *
     * NOTE: Equivalent to the `standardNodeHash` in our https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
     */
    function commutativeKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32) {
        return a < b ? _efficientKeccak256(a, b) : _efficientKeccak256(b, a);
    }

    /**
     * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
     */
    function _efficientKeccak256(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.20;

import {Hashes} from "./Hashes.sol";

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the Merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates Merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProof {
    /**
     *@dev The multiproof provided is not valid.
     */
    error MerkleProofInvalidMultiproof();

    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     */
    function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proofLen != totalHashes + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = Hashes.commutativeKeccak256(a, b);
        }

        if (totalHashes > 0) {
            if (proofPos != proofLen) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proofLen != totalHashes + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = Hashes.commutativeKeccak256(a, b);
        }

        if (totalHashes > 0) {
            if (proofPos != proofLen) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

File 11 of 12 : 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)
        }
    }
}

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

Settings
{
  "evmVersion": "london",
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ATE__IncorrectPayment","type":"error"},{"inputs":[],"name":"ATE__InvalidConfigMaxTokenSupplyForStage","type":"error"},{"inputs":[],"name":"ATE__InvalidConfigTimestamp","type":"error"},{"inputs":[],"name":"ATE__InvalidLength","type":"error"},{"inputs":[],"name":"ATE__InvalidStageIndex","type":"error"},{"inputs":[],"name":"ATE__MaxStagesExceeded","type":"error"},{"inputs":[],"name":"ATE__MintQuantityCannotBeZero","type":"error"},{"inputs":[],"name":"ATE__MintQuantityExceedsMaxMintedPerWallet","type":"error"},{"inputs":[],"name":"ATE__MintQuantityExceedsMaxSupply","type":"error"},{"inputs":[],"name":"ATE__MintQuantityExceedsMaxTokenSupplyForStage","type":"error"},{"inputs":[],"name":"ATE__MintUnauthorized","type":"error"},{"inputs":[],"name":"ATE__StageEnded","type":"error"},{"inputs":[],"name":"ATE__StageIsNotActive","type":"error"},{"inputs":[],"name":"ATE__StageStarted","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","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":"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":"uint256","name":"stageIndex","type":"uint256"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint16","name":"maxMintableByWallet","type":"uint16"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint32","name":"maxTokenSupplyForStage","type":"uint32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"indexed":false,"internalType":"struct AscendTheEnd.StageConfig","name":"stageConfig","type":"tuple"}],"name":"ATE__StageConfigured","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"stageIndex","type":"uint256"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint16","name":"maxMintableByWallet","type":"uint16"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint32","name":"maxTokenSupplyForStage","type":"uint32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"indexed":false,"internalType":"struct AscendTheEnd.StageConfig","name":"stageConfig","type":"tuple"}],"name":"ATE__StageCreated","type":"event"},{"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":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","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_NUMBER_OF_STAGES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROYALTY_PERCENTAGE","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","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":"stageIndex","type":"uint256"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint16","name":"maxMintableByWallet","type":"uint16"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint32","name":"maxTokenSupplyForStage","type":"uint32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct AscendTheEnd.StageConfig","name":"stageConfig","type":"tuple"}],"name":"configureStage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"stageIndexes","type":"uint256[]"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint16","name":"maxMintableByWallet","type":"uint16"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint32","name":"maxTokenSupplyForStage","type":"uint32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct AscendTheEnd.StageConfig[]","name":"stageConfigs","type":"tuple[]"}],"name":"configureStages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint16","name":"maxMintableByWallet","type":"uint16"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint32","name":"maxTokenSupplyForStage","type":"uint32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct AscendTheEnd.StageConfig","name":"stageConfig","type":"tuple"}],"name":"createStage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint16","name":"maxMintableByWallet","type":"uint16"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint32","name":"maxTokenSupplyForStage","type":"uint32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct AscendTheEnd.StageConfig[]","name":"stageConfigs","type":"tuple[]"}],"name":"createStages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"stageIndex","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","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":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stages","outputs":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint16","name":"maxMintableByWallet","type":"uint16"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint32","name":"maxTokenSupplyForStage","type":"uint32"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"stateMutability":"view","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":"totalStages","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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"}]

60806040523480156200001157600080fd5b506040516200276338038062002763833981016040819052620000349162000245565b336040518060400160405280600c81526020016b105cd8d95b99151a19515b9960a21b8152506040518060400160405280600381526020016241544560e81b8152508160029081620000879190620003ab565b506003620000968282620003ab565b50600160005550506001600160a01b038116620000ce57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b620000d98162000118565b50600d620000e88282620003ab565b5062000111336064620000ff600561271062000477565b6200010b9190620004b1565b62000136565b50620004e6565b600a80546001600160a01b03191690556200013381620001dd565b50565b6127106001600160601b0382168110156200017757604051636f483d0960e01b81526001600160601b038316600482015260248101829052604401620000c5565b6001600160a01b038316620001a357604051635b6cc80560e11b815260006004820152602401620000c5565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600b55565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156200025957600080fd5b82516001600160401b03808211156200027157600080fd5b818501915085601f8301126200028657600080fd5b8151818111156200029b576200029b6200022f565b604051601f8201601f19908116603f01168101908382118183101715620002c657620002c66200022f565b816040528281528886848701011115620002df57600080fd5b600093505b82841015620003035784840186015181850187015292850192620002e4565b600086848301015280965050505050505092915050565b600181811c908216806200032f57607f821691505b6020821081036200035057634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003a6576000816000526020600020601f850160051c81016020861015620003815750805b601f850160051c820191505b81811015620003a2578281556001016200038d565b5050505b505050565b81516001600160401b03811115620003c757620003c76200022f565b620003df81620003d884546200031a565b8462000356565b602080601f831160018114620004175760008415620003fe5750858301515b600019600386901b1c1916600185901b178555620003a2565b600085815260208120601f198616915b82811015620004485788860151825594840194600190910190840162000427565b5085821015620004675787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160601b03818116838216028082169190828114620004a957634e487b7160e01b600052601160045260246000fd5b505092915050565b60006001600160601b0383811680620004da57634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b61226d80620004f66000396000f3fe6080604052600436106101e35760003560e01c80636bcc77b711610102578063b88d4fde11610095578063e985e9c511610064578063e985e9c514610593578063f2fde38b146105b3578063f86a3529146105d3578063fcedd3e9146105e857600080fd5b8063b88d4fde1461052f578063c87b56dd14610542578063e30c397814610562578063e6d37b881461058057600080fd5b8063845ddcb2116100d1578063845ddcb2146104705780638da5cb5b146104dc57806395d89b41146104fa578063a22cb4651461050f57600080fd5b80636bcc77b71461040657806370a0823114610426578063715018a61461044657806379ba50971461045b57600080fd5b806332cb6b0c1161017a57806355f804b31161014957806355f804b3146103865780636352211e146103a657806363845f60146103c657806365371eea146103e657600080fd5b806332cb6b0c146103215780633ccfd60b1461033757806342842e0e1461034c578063463b08db1461035f57600080fd5b8063095ea7b3116101b6578063095ea7b31461029957806318160ddd146102ac57806323b872dd146102cf5780632a55205a146102e257600080fd5b806301ffc9a7146101e857806306fdde031461021d578063081812fc1461023f578063089ec2f014610277575b600080fd5b3480156101f457600080fd5b50610208610203366004611879565b6105fd565b60405190151581526020015b60405180910390f35b34801561022957600080fd5b5061023261060e565b60405161021491906118e6565b34801561024b57600080fd5b5061025f61025a3660046118f9565b6106a0565b6040516001600160a01b039091168152602001610214565b34801561028357600080fd5b50610297610292366004611957565b6106db565b005b6102976102a73660046119b0565b61071b565b3480156102b857600080fd5b506102c161072b565b604051908152602001610214565b6102976102dd3660046119da565b61074a565b3480156102ee57600080fd5b506103026102fd366004611a16565b6108af565b604080516001600160a01b039093168352602083019190915201610214565b34801561032d57600080fd5b506102c1610bb881565b34801561034357600080fd5b50610297610936565b61029761035a3660046119da565b610996565b34801561036b57600080fd5b50610374600581565b60405160ff9091168152602001610214565b34801561039257600080fd5b506102976103a1366004611a38565b6109b1565b3480156103b257600080fd5b5061025f6103c13660046118f9565b610a06565b3480156103d257600080fd5b506102976103e1366004611aef565b610a11565b3480156103f257600080fd5b50610297610401366004611b73565b610a8b565b34801561041257600080fd5b50610297610421366004611b8f565b610a9c565b34801561043257600080fd5b506102c1610441366004611bbc565b610aae565b34801561045257600080fd5b50610297610af4565b34801561046757600080fd5b50610297610b08565b34801561047c57600080fd5b5061049061048b3660046118f9565b610b4e565b604080516001600160501b03909716875261ffff909516602087015265ffffffffffff938416948601949094529116606084015263ffffffff16608083015260a082015260c001610214565b3480156104e857600080fd5b506009546001600160a01b031661025f565b34801561050657600080fd5b50610232610bbc565b34801561051b57600080fd5b5061029761052a366004611bd7565b610bcb565b61029761053d366004611c29565b610c37565b34801561054e57600080fd5b5061023261055d3660046118f9565b610c78565b34801561056e57600080fd5b50600a546001600160a01b031661025f565b61029761058e366004611d05565b610ca9565b34801561059f57600080fd5b506102086105ae366004611d4c565b610e22565b3480156105bf57600080fd5b506102976105ce366004611bbc565b610e50565b3480156105df57600080fd5b50600e546102c1565b3480156105f457600080fd5b506102c1600481565b600061060882610ec1565b92915050565b60606002805461061d90611d76565b80601f016020809104026020016040519081016040528092919081815260200182805461064990611d76565b80156106965780601f1061066b57610100808354040283529160200191610696565b820191906000526020600020905b81548152906001019060200180831161067957829003601f168201915b5050505050905090565b60006106ab82610ef6565b6106bf576106bf6333d1c03960e21b610f44565b506000908152600660205260409020546001600160a01b031690565b6106e3610f4e565b60005b818110156107165761070e83838381811061070357610703611daa565b905060c00201610f7b565b6001016106e6565b505050565b6107278282600161103f565b5050565b60006001805460005403039050600019805b1461074757600854015b90565b6000610755826110e2565b6001600160a01b03948516949091508116841461077b5761077b62a1148160e81b610f44565b60008281526006602052604090208054338082146001600160a01b038816909114176107bf576107ab8633610e22565b6107bf576107bf632ce44b5f60e11b610f44565b80156107ca57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b8416900361085c5760018401600081815260046020526040812054900361085a57600054811461085a5760008181526004602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4806000036108a6576108a6633a954ecd60e21b610f44565b50505050505050565b6000828152600c6020526040812080548291906001600160a01b03811690600160a01b90046001600160601b031681610903575050600b546001600160a01b03811690600160a01b90046001600160601b03165b600061271061091b6001600160601b03841689611dd6565b6109259190611ded565b9295509193505050505b9250929050565b61093e610f4e565b604051600090339047908381818185875af1925050503d8060008114610980576040519150601f19603f3d011682016040523d82523d6000602084013e610985565b606091505b505090508061099357600080fd5b50565b61071683838360405180602001604052806000815250610c37565b6109b9610f4e565b600d6109c6828483611e5f565b50604080516001815260001960208201527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c910160405180910390a15050565b6000610608826110e2565b610a19610f4e565b828114610a385760405162c1749f60e81b815260040160405180910390fd5b60005b83811015610a8457610a7c858583818110610a5857610a58611daa565b90506020020135848484818110610a7157610a71611daa565b905060c00201611183565b600101610a3b565b5050505050565b610a93610f4e565b61099381610f7b565b610aa4610f4e565b6107278282611183565b60006001600160a01b038216610ace57610ace6323d3ad8160e21b610f44565b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b610afc610f4e565b610b0660006111ee565b565b600a5433906001600160a01b03168114610b455760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610993816111ee565b600e8181548110610b5e57600080fd5b6000918252602090912060029091020180546001909101546001600160501b038216925061ffff600160501b8304169165ffffffffffff600160601b8204811692600160901b83049091169163ffffffff600160c01b909104169086565b60606003805461061d90611d76565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610c4284848461074a565b6001600160a01b0383163b15610c7257610c5e84848484611207565b610c7257610c726368d2bf6b60e11b610f44565b50505050565b6060610c83826112e9565b604051602001610c939190611f1f565b6040516020818303038152906040529050919050565b6000600e8581548110610cbe57610cbe611daa565b60009182526020918290206040805160c08101825260029390930290910180546001600160501b0381168452600160501b810461ffff1694840194909452600160601b840465ffffffffffff908116928401839052600160901b85041660608401819052600160c01b90940463ffffffff1660808401526001015460a0830152909250610d4a91611364565b610d67576040516305c3a82960e41b815260040160405180910390fd5b610d7e8482600001516001600160501b0316611399565b610d9b84826020015161ffff16836080015163ffffffff166113c2565b60a081015115610e185760a08101516040516bffffffffffffffffffffffff193360601b166020820152610dec91859185919060340160405160208183030381529060405280519060200120611491565b610e095760405163d56ce23760e01b815260040160405180910390fd5b610e1333856114a9565b610a84565b610a8433856114a9565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b610e58610f4e565b600a80546001600160a01b0383166001600160a01b03199091168117909155610e896009546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60006001600160e01b0319821663152a902d60e11b148061060857506301ffc9a760e01b6001600160e01b0319831614610608565b600081600111610f3f57600054821015610f3f5760005b5060008281526004602052604081205490819003610f3557610f2e83611f48565b9250610f0d565b600160e01b161590505b919050565b8060005260046000fd5b6009546001600160a01b03163314610b065760405163118cdaa760e01b8152336004820152602401610b3c565b600e54610f888183611568565b600e805460018101825560009190915282906002027fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd01610fc98282611fc4565b5050807fd1407adbf518300e8502034349912221c4c8dbca48ef36be1198018b5a52be7e83604051610ffb91906120d3565b60405180910390a2807fb67312df9524333a339c8f3cba6a6c7c5d6a5a40c712a2fa056a2ed5b26d74bf8360405161103391906120d3565b60405180910390a25050565b600061104a83610a06565b90508180156110625750336001600160a01b03821614155b15611085576110718133610e22565b611085576110856367d9dca160e11b610f44565b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b60008160011161117357506000818152600460205260409020548060000361116057600054821061111d5761111d636f96cda160e11b610f44565b5b5060001901600081815260046020526040902054801561111e57600160e01b811660000361114b57919050565b61115b636f96cda160e11b610f44565b61111e565b600160e01b811660000361117357919050565b610f3f636f96cda160e11b610f44565b61118d8282611568565b80600e83815481106111a1576111a1611daa565b906000526020600020906002020181816111bb9190611fc4565b905050817fb67312df9524333a339c8f3cba6a6c7c5d6a5a40c712a2fa056a2ed5b26d74bf8260405161103391906120d3565b600a80546001600160a01b031916905561099381611740565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061123c903390899088908890600401612161565b6020604051808303816000875af1925050508015611277575060408051601f3d908101601f191682019092526112749181019061219e565b60015b6112cc573d8080156112a5576040519150601f19603f3d011682016040523d82523d6000602084013e6112aa565b606091505b5080516000036112c4576112c46368d2bf6b60e11b610f44565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60606112f482610ef6565b61130857611308630a14c4b560e41b610f44565b6000611312611792565b90508051600003611332576040518060200160405280600081525061135d565b8061133c846117a1565b60405160200161134d9291906121bb565b6040516020818303038152906040525b9392505050565b60008265ffffffffffff1642108061138357508165ffffffffffff1642115b1561139057506000610608565b50600192915050565b6113a38183611dd6565b341461072757604051631af6fbe160e21b815260040160405180910390fd5b826000036113e357604051637cace17f60e01b815260040160405180910390fd5b33600090815260056020526040908190205483911c67ffffffffffffffff1661140c90856121ea565b111561142b5760405163353e0be760e21b815260040160405180910390fd5b806114346117e5565b61143e90856121ea565b111561145d576040516320b6d6a960e01b815260040160405180910390fd5b610bb86114686117e5565b61147290856121ea565b1115610716576040516320ff9c1f60e01b815260040160405180910390fd5b60008261149f8686856117f5565b1495945050505050565b60008054908290036114c5576114c563b562e8dd60e01b610f44565b60008181526004602090815260408083206001600160a01b0387164260a01b6001881460e11b1781179091558084526005909252822080546801000000000000000186020190559081900361152357611523622e076360e81b610f44565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4818160010191508103611528575060005550505050565b600482106115895760405163c25aa74f60e01b815260040160405180910390fd5b600e54821015611698576000600e83815481106115a8576115a8611daa565b60009182526020918290206040805160c08101825260029390930290910180546001600160501b0381168452600160501b810461ffff1694840194909452600160601b840465ffffffffffff908116928401839052600160901b85041660608401819052600160c01b90940463ffffffff1660808401526001015460a083015290925061163491611364565b1561165257604051633ee4437360e21b815260040160405180910390fd5b606081015165ffffffffffff16158015906116785750806060015165ffffffffffff1642115b1561169657604051631fb2de1b60e01b815260040160405180910390fd5b505b6116a860808201606083016121fd565b65ffffffffffff166116c060608301604084016121fd565b65ffffffffffff1611806116ea5750426116e060608301604084016121fd565b65ffffffffffff16105b156117085760405163123708b560e01b815260040160405180910390fd5b610bb861171b60a083016080840161221a565b63ffffffff1611156107275760405163d05ffbf160e01b815260040160405180910390fd5b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060600d805461061d90611d76565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806117bb5750819003601f19909101908152919050565b600054600019908101908061073d565b600081815b8481101561182e576118248287878481811061181857611818611daa565b90506020020135611837565b91506001016117fa565b50949350505050565b600081831061185357600082815260208490526040902061135d565b5060009182526020526040902090565b6001600160e01b03198116811461099357600080fd5b60006020828403121561188b57600080fd5b813561135d81611863565b60005b838110156118b1578181015183820152602001611899565b50506000910152565b600081518084526118d2816020860160208601611896565b601f01601f19169290920160200192915050565b60208152600061135d60208301846118ba565b60006020828403121561190b57600080fd5b5035919050565b60008083601f84011261192457600080fd5b50813567ffffffffffffffff81111561193c57600080fd5b60208301915083602060c08302850101111561092f57600080fd5b6000806020838503121561196a57600080fd5b823567ffffffffffffffff81111561198157600080fd5b61198d85828601611912565b90969095509350505050565b80356001600160a01b0381168114610f3f57600080fd5b600080604083850312156119c357600080fd5b6119cc83611999565b946020939093013593505050565b6000806000606084860312156119ef57600080fd5b6119f884611999565b9250611a0660208501611999565b9150604084013590509250925092565b60008060408385031215611a2957600080fd5b50508035926020909101359150565b60008060208385031215611a4b57600080fd5b823567ffffffffffffffff80821115611a6357600080fd5b818501915085601f830112611a7757600080fd5b813581811115611a8657600080fd5b866020828501011115611a9857600080fd5b60209290920196919550909350505050565b60008083601f840112611abc57600080fd5b50813567ffffffffffffffff811115611ad457600080fd5b6020830191508360208260051b850101111561092f57600080fd5b60008060008060408587031215611b0557600080fd5b843567ffffffffffffffff80821115611b1d57600080fd5b611b2988838901611aaa565b90965094506020870135915080821115611b4257600080fd5b50611b4f87828801611912565b95989497509550505050565b600060c08284031215611b6d57600080fd5b50919050565b600060c08284031215611b8557600080fd5b61135d8383611b5b565b60008060e08385031215611ba257600080fd5b82359150611bb38460208501611b5b565b90509250929050565b600060208284031215611bce57600080fd5b61135d82611999565b60008060408385031215611bea57600080fd5b611bf383611999565b915060208301358015158114611c0857600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611c3f57600080fd5b611c4885611999565b9350611c5660208601611999565b925060408501359150606085013567ffffffffffffffff80821115611c7a57600080fd5b818701915087601f830112611c8e57600080fd5b813581811115611ca057611ca0611c13565b604051601f8201601f19908116603f01168101908382118183101715611cc857611cc8611c13565b816040528281528a6020848701011115611ce157600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060008060608587031215611d1b57600080fd5b8435935060208501359250604085013567ffffffffffffffff811115611d4057600080fd5b611b4f87828801611aaa565b60008060408385031215611d5f57600080fd5b611d6883611999565b9150611bb360208401611999565b600181811c90821680611d8a57607f821691505b602082108103611b6d57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761060857610608611dc0565b600082611e0a57634e487b7160e01b600052601260045260246000fd5b500490565b601f821115610716576000816000526020600020601f850160051c81016020861015611e385750805b601f850160051c820191505b81811015611e5757828155600101611e44565b505050505050565b67ffffffffffffffff831115611e7757611e77611c13565b611e8b83611e858354611d76565b83611e0f565b6000601f841160018114611ebf5760008515611ea75750838201355b600019600387901b1c1916600186901b178355610a84565b600083815260209020601f19861690835b82811015611ef05786850135825560209485019460019092019101611ed0565b5086821015611f0d5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60008251611f31818460208701611896565b64173539b7b760d91b920191825250600501919050565b600081611f5757611f57611dc0565b506000190190565b6001600160501b038116811461099357600080fd5b61ffff8116811461099357600080fd5b65ffffffffffff8116811461099357600080fd5b6000813561060881611f84565b63ffffffff8116811461099357600080fd5b6000813561060881611fa5565b8135611fcf81611f5f565b6001600160501b03811690508154816001600160501b031982161783556020840135611ffa81611f74565b61ffff60501b60509190911b166bffffffffffffffffffffffff198216831781178455604085013561202b81611f84565b65ffffffffffff60601b8160601b168471ffffffffffffffffffffffffffffffffffff1985161783171785555050505061209261206a60608401611f98565b82805465ffffffffffff60901b191660909290921b65ffffffffffff60901b16919091179055565b6120c56120a160808401611fb7565b82805463ffffffff60c01b191660c09290921b63ffffffff60c01b16919091179055565b60a082013560018201555050565b60c0810182356120e281611f5f565b6001600160501b0316825260208301356120fb81611f74565b61ffff166020830152604083013561211281611f84565b65ffffffffffff908116604084015260608401359061213082611f84565b166060830152608083013561214481611fa5565b63ffffffff811660808401525060a083013560a083015292915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612194908301846118ba565b9695505050505050565b6000602082840312156121b057600080fd5b815161135d81611863565b600083516121cd818460208801611896565b8351908301906121e1818360208801611896565b01949350505050565b8082018082111561060857610608611dc0565b60006020828403121561220f57600080fd5b813561135d81611f84565b60006020828403121561222c57600080fd5b813561135d81611fa556fea2646970667358221220968b9dedd2277be8d3a9580e00157330d23887217ee283bb0db3de44505d47c164736f6c634300081800330000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003d68747470733a2f2f6174652e667261312e63646e2e6469676974616c6f6365616e7370616365732e636f6d2f6d696e742d315f6d65746164617461322f000000

Deployed Bytecode

0x6080604052600436106101e35760003560e01c80636bcc77b711610102578063b88d4fde11610095578063e985e9c511610064578063e985e9c514610593578063f2fde38b146105b3578063f86a3529146105d3578063fcedd3e9146105e857600080fd5b8063b88d4fde1461052f578063c87b56dd14610542578063e30c397814610562578063e6d37b881461058057600080fd5b8063845ddcb2116100d1578063845ddcb2146104705780638da5cb5b146104dc57806395d89b41146104fa578063a22cb4651461050f57600080fd5b80636bcc77b71461040657806370a0823114610426578063715018a61461044657806379ba50971461045b57600080fd5b806332cb6b0c1161017a57806355f804b31161014957806355f804b3146103865780636352211e146103a657806363845f60146103c657806365371eea146103e657600080fd5b806332cb6b0c146103215780633ccfd60b1461033757806342842e0e1461034c578063463b08db1461035f57600080fd5b8063095ea7b3116101b6578063095ea7b31461029957806318160ddd146102ac57806323b872dd146102cf5780632a55205a146102e257600080fd5b806301ffc9a7146101e857806306fdde031461021d578063081812fc1461023f578063089ec2f014610277575b600080fd5b3480156101f457600080fd5b50610208610203366004611879565b6105fd565b60405190151581526020015b60405180910390f35b34801561022957600080fd5b5061023261060e565b60405161021491906118e6565b34801561024b57600080fd5b5061025f61025a3660046118f9565b6106a0565b6040516001600160a01b039091168152602001610214565b34801561028357600080fd5b50610297610292366004611957565b6106db565b005b6102976102a73660046119b0565b61071b565b3480156102b857600080fd5b506102c161072b565b604051908152602001610214565b6102976102dd3660046119da565b61074a565b3480156102ee57600080fd5b506103026102fd366004611a16565b6108af565b604080516001600160a01b039093168352602083019190915201610214565b34801561032d57600080fd5b506102c1610bb881565b34801561034357600080fd5b50610297610936565b61029761035a3660046119da565b610996565b34801561036b57600080fd5b50610374600581565b60405160ff9091168152602001610214565b34801561039257600080fd5b506102976103a1366004611a38565b6109b1565b3480156103b257600080fd5b5061025f6103c13660046118f9565b610a06565b3480156103d257600080fd5b506102976103e1366004611aef565b610a11565b3480156103f257600080fd5b50610297610401366004611b73565b610a8b565b34801561041257600080fd5b50610297610421366004611b8f565b610a9c565b34801561043257600080fd5b506102c1610441366004611bbc565b610aae565b34801561045257600080fd5b50610297610af4565b34801561046757600080fd5b50610297610b08565b34801561047c57600080fd5b5061049061048b3660046118f9565b610b4e565b604080516001600160501b03909716875261ffff909516602087015265ffffffffffff938416948601949094529116606084015263ffffffff16608083015260a082015260c001610214565b3480156104e857600080fd5b506009546001600160a01b031661025f565b34801561050657600080fd5b50610232610bbc565b34801561051b57600080fd5b5061029761052a366004611bd7565b610bcb565b61029761053d366004611c29565b610c37565b34801561054e57600080fd5b5061023261055d3660046118f9565b610c78565b34801561056e57600080fd5b50600a546001600160a01b031661025f565b61029761058e366004611d05565b610ca9565b34801561059f57600080fd5b506102086105ae366004611d4c565b610e22565b3480156105bf57600080fd5b506102976105ce366004611bbc565b610e50565b3480156105df57600080fd5b50600e546102c1565b3480156105f457600080fd5b506102c1600481565b600061060882610ec1565b92915050565b60606002805461061d90611d76565b80601f016020809104026020016040519081016040528092919081815260200182805461064990611d76565b80156106965780601f1061066b57610100808354040283529160200191610696565b820191906000526020600020905b81548152906001019060200180831161067957829003601f168201915b5050505050905090565b60006106ab82610ef6565b6106bf576106bf6333d1c03960e21b610f44565b506000908152600660205260409020546001600160a01b031690565b6106e3610f4e565b60005b818110156107165761070e83838381811061070357610703611daa565b905060c00201610f7b565b6001016106e6565b505050565b6107278282600161103f565b5050565b60006001805460005403039050600019805b1461074757600854015b90565b6000610755826110e2565b6001600160a01b03948516949091508116841461077b5761077b62a1148160e81b610f44565b60008281526006602052604090208054338082146001600160a01b038816909114176107bf576107ab8633610e22565b6107bf576107bf632ce44b5f60e11b610f44565b80156107ca57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b8416900361085c5760018401600081815260046020526040812054900361085a57600054811461085a5760008181526004602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4806000036108a6576108a6633a954ecd60e21b610f44565b50505050505050565b6000828152600c6020526040812080548291906001600160a01b03811690600160a01b90046001600160601b031681610903575050600b546001600160a01b03811690600160a01b90046001600160601b03165b600061271061091b6001600160601b03841689611dd6565b6109259190611ded565b9295509193505050505b9250929050565b61093e610f4e565b604051600090339047908381818185875af1925050503d8060008114610980576040519150601f19603f3d011682016040523d82523d6000602084013e610985565b606091505b505090508061099357600080fd5b50565b61071683838360405180602001604052806000815250610c37565b6109b9610f4e565b600d6109c6828483611e5f565b50604080516001815260001960208201527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c910160405180910390a15050565b6000610608826110e2565b610a19610f4e565b828114610a385760405162c1749f60e81b815260040160405180910390fd5b60005b83811015610a8457610a7c858583818110610a5857610a58611daa565b90506020020135848484818110610a7157610a71611daa565b905060c00201611183565b600101610a3b565b5050505050565b610a93610f4e565b61099381610f7b565b610aa4610f4e565b6107278282611183565b60006001600160a01b038216610ace57610ace6323d3ad8160e21b610f44565b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b610afc610f4e565b610b0660006111ee565b565b600a5433906001600160a01b03168114610b455760405163118cdaa760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b610993816111ee565b600e8181548110610b5e57600080fd5b6000918252602090912060029091020180546001909101546001600160501b038216925061ffff600160501b8304169165ffffffffffff600160601b8204811692600160901b83049091169163ffffffff600160c01b909104169086565b60606003805461061d90611d76565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610c4284848461074a565b6001600160a01b0383163b15610c7257610c5e84848484611207565b610c7257610c726368d2bf6b60e11b610f44565b50505050565b6060610c83826112e9565b604051602001610c939190611f1f565b6040516020818303038152906040529050919050565b6000600e8581548110610cbe57610cbe611daa565b60009182526020918290206040805160c08101825260029390930290910180546001600160501b0381168452600160501b810461ffff1694840194909452600160601b840465ffffffffffff908116928401839052600160901b85041660608401819052600160c01b90940463ffffffff1660808401526001015460a0830152909250610d4a91611364565b610d67576040516305c3a82960e41b815260040160405180910390fd5b610d7e8482600001516001600160501b0316611399565b610d9b84826020015161ffff16836080015163ffffffff166113c2565b60a081015115610e185760a08101516040516bffffffffffffffffffffffff193360601b166020820152610dec91859185919060340160405160208183030381529060405280519060200120611491565b610e095760405163d56ce23760e01b815260040160405180910390fd5b610e1333856114a9565b610a84565b610a8433856114a9565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b610e58610f4e565b600a80546001600160a01b0383166001600160a01b03199091168117909155610e896009546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60006001600160e01b0319821663152a902d60e11b148061060857506301ffc9a760e01b6001600160e01b0319831614610608565b600081600111610f3f57600054821015610f3f5760005b5060008281526004602052604081205490819003610f3557610f2e83611f48565b9250610f0d565b600160e01b161590505b919050565b8060005260046000fd5b6009546001600160a01b03163314610b065760405163118cdaa760e01b8152336004820152602401610b3c565b600e54610f888183611568565b600e805460018101825560009190915282906002027fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd01610fc98282611fc4565b5050807fd1407adbf518300e8502034349912221c4c8dbca48ef36be1198018b5a52be7e83604051610ffb91906120d3565b60405180910390a2807fb67312df9524333a339c8f3cba6a6c7c5d6a5a40c712a2fa056a2ed5b26d74bf8360405161103391906120d3565b60405180910390a25050565b600061104a83610a06565b90508180156110625750336001600160a01b03821614155b15611085576110718133610e22565b611085576110856367d9dca160e11b610f44565b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b60008160011161117357506000818152600460205260409020548060000361116057600054821061111d5761111d636f96cda160e11b610f44565b5b5060001901600081815260046020526040902054801561111e57600160e01b811660000361114b57919050565b61115b636f96cda160e11b610f44565b61111e565b600160e01b811660000361117357919050565b610f3f636f96cda160e11b610f44565b61118d8282611568565b80600e83815481106111a1576111a1611daa565b906000526020600020906002020181816111bb9190611fc4565b905050817fb67312df9524333a339c8f3cba6a6c7c5d6a5a40c712a2fa056a2ed5b26d74bf8260405161103391906120d3565b600a80546001600160a01b031916905561099381611740565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061123c903390899088908890600401612161565b6020604051808303816000875af1925050508015611277575060408051601f3d908101601f191682019092526112749181019061219e565b60015b6112cc573d8080156112a5576040519150601f19603f3d011682016040523d82523d6000602084013e6112aa565b606091505b5080516000036112c4576112c46368d2bf6b60e11b610f44565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60606112f482610ef6565b61130857611308630a14c4b560e41b610f44565b6000611312611792565b90508051600003611332576040518060200160405280600081525061135d565b8061133c846117a1565b60405160200161134d9291906121bb565b6040516020818303038152906040525b9392505050565b60008265ffffffffffff1642108061138357508165ffffffffffff1642115b1561139057506000610608565b50600192915050565b6113a38183611dd6565b341461072757604051631af6fbe160e21b815260040160405180910390fd5b826000036113e357604051637cace17f60e01b815260040160405180910390fd5b33600090815260056020526040908190205483911c67ffffffffffffffff1661140c90856121ea565b111561142b5760405163353e0be760e21b815260040160405180910390fd5b806114346117e5565b61143e90856121ea565b111561145d576040516320b6d6a960e01b815260040160405180910390fd5b610bb86114686117e5565b61147290856121ea565b1115610716576040516320ff9c1f60e01b815260040160405180910390fd5b60008261149f8686856117f5565b1495945050505050565b60008054908290036114c5576114c563b562e8dd60e01b610f44565b60008181526004602090815260408083206001600160a01b0387164260a01b6001881460e11b1781179091558084526005909252822080546801000000000000000186020190559081900361152357611523622e076360e81b610f44565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4818160010191508103611528575060005550505050565b600482106115895760405163c25aa74f60e01b815260040160405180910390fd5b600e54821015611698576000600e83815481106115a8576115a8611daa565b60009182526020918290206040805160c08101825260029390930290910180546001600160501b0381168452600160501b810461ffff1694840194909452600160601b840465ffffffffffff908116928401839052600160901b85041660608401819052600160c01b90940463ffffffff1660808401526001015460a083015290925061163491611364565b1561165257604051633ee4437360e21b815260040160405180910390fd5b606081015165ffffffffffff16158015906116785750806060015165ffffffffffff1642115b1561169657604051631fb2de1b60e01b815260040160405180910390fd5b505b6116a860808201606083016121fd565b65ffffffffffff166116c060608301604084016121fd565b65ffffffffffff1611806116ea5750426116e060608301604084016121fd565b65ffffffffffff16105b156117085760405163123708b560e01b815260040160405180910390fd5b610bb861171b60a083016080840161221a565b63ffffffff1611156107275760405163d05ffbf160e01b815260040160405180910390fd5b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060600d805461061d90611d76565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806117bb5750819003601f19909101908152919050565b600054600019908101908061073d565b600081815b8481101561182e576118248287878481811061181857611818611daa565b90506020020135611837565b91506001016117fa565b50949350505050565b600081831061185357600082815260208490526040902061135d565b5060009182526020526040902090565b6001600160e01b03198116811461099357600080fd5b60006020828403121561188b57600080fd5b813561135d81611863565b60005b838110156118b1578181015183820152602001611899565b50506000910152565b600081518084526118d2816020860160208601611896565b601f01601f19169290920160200192915050565b60208152600061135d60208301846118ba565b60006020828403121561190b57600080fd5b5035919050565b60008083601f84011261192457600080fd5b50813567ffffffffffffffff81111561193c57600080fd5b60208301915083602060c08302850101111561092f57600080fd5b6000806020838503121561196a57600080fd5b823567ffffffffffffffff81111561198157600080fd5b61198d85828601611912565b90969095509350505050565b80356001600160a01b0381168114610f3f57600080fd5b600080604083850312156119c357600080fd5b6119cc83611999565b946020939093013593505050565b6000806000606084860312156119ef57600080fd5b6119f884611999565b9250611a0660208501611999565b9150604084013590509250925092565b60008060408385031215611a2957600080fd5b50508035926020909101359150565b60008060208385031215611a4b57600080fd5b823567ffffffffffffffff80821115611a6357600080fd5b818501915085601f830112611a7757600080fd5b813581811115611a8657600080fd5b866020828501011115611a9857600080fd5b60209290920196919550909350505050565b60008083601f840112611abc57600080fd5b50813567ffffffffffffffff811115611ad457600080fd5b6020830191508360208260051b850101111561092f57600080fd5b60008060008060408587031215611b0557600080fd5b843567ffffffffffffffff80821115611b1d57600080fd5b611b2988838901611aaa565b90965094506020870135915080821115611b4257600080fd5b50611b4f87828801611912565b95989497509550505050565b600060c08284031215611b6d57600080fd5b50919050565b600060c08284031215611b8557600080fd5b61135d8383611b5b565b60008060e08385031215611ba257600080fd5b82359150611bb38460208501611b5b565b90509250929050565b600060208284031215611bce57600080fd5b61135d82611999565b60008060408385031215611bea57600080fd5b611bf383611999565b915060208301358015158114611c0857600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611c3f57600080fd5b611c4885611999565b9350611c5660208601611999565b925060408501359150606085013567ffffffffffffffff80821115611c7a57600080fd5b818701915087601f830112611c8e57600080fd5b813581811115611ca057611ca0611c13565b604051601f8201601f19908116603f01168101908382118183101715611cc857611cc8611c13565b816040528281528a6020848701011115611ce157600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060008060608587031215611d1b57600080fd5b8435935060208501359250604085013567ffffffffffffffff811115611d4057600080fd5b611b4f87828801611aaa565b60008060408385031215611d5f57600080fd5b611d6883611999565b9150611bb360208401611999565b600181811c90821680611d8a57607f821691505b602082108103611b6d57634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761060857610608611dc0565b600082611e0a57634e487b7160e01b600052601260045260246000fd5b500490565b601f821115610716576000816000526020600020601f850160051c81016020861015611e385750805b601f850160051c820191505b81811015611e5757828155600101611e44565b505050505050565b67ffffffffffffffff831115611e7757611e77611c13565b611e8b83611e858354611d76565b83611e0f565b6000601f841160018114611ebf5760008515611ea75750838201355b600019600387901b1c1916600186901b178355610a84565b600083815260209020601f19861690835b82811015611ef05786850135825560209485019460019092019101611ed0565b5086821015611f0d5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60008251611f31818460208701611896565b64173539b7b760d91b920191825250600501919050565b600081611f5757611f57611dc0565b506000190190565b6001600160501b038116811461099357600080fd5b61ffff8116811461099357600080fd5b65ffffffffffff8116811461099357600080fd5b6000813561060881611f84565b63ffffffff8116811461099357600080fd5b6000813561060881611fa5565b8135611fcf81611f5f565b6001600160501b03811690508154816001600160501b031982161783556020840135611ffa81611f74565b61ffff60501b60509190911b166bffffffffffffffffffffffff198216831781178455604085013561202b81611f84565b65ffffffffffff60601b8160601b168471ffffffffffffffffffffffffffffffffffff1985161783171785555050505061209261206a60608401611f98565b82805465ffffffffffff60901b191660909290921b65ffffffffffff60901b16919091179055565b6120c56120a160808401611fb7565b82805463ffffffff60c01b191660c09290921b63ffffffff60c01b16919091179055565b60a082013560018201555050565b60c0810182356120e281611f5f565b6001600160501b0316825260208301356120fb81611f74565b61ffff166020830152604083013561211281611f84565b65ffffffffffff908116604084015260608401359061213082611f84565b166060830152608083013561214481611fa5565b63ffffffff811660808401525060a083013560a083015292915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612194908301846118ba565b9695505050505050565b6000602082840312156121b057600080fd5b815161135d81611863565b600083516121cd818460208801611896565b8351908301906121e1818360208801611896565b01949350505050565b8082018082111561060857610608611dc0565b60006020828403121561220f57600080fd5b813561135d81611f84565b60006020828403121561222c57600080fd5b813561135d81611fa556fea2646970667358221220968b9dedd2277be8d3a9580e00157330d23887217ee283bb0db3de44505d47c164736f6c63430008180033

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

0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003d68747470733a2f2f6174652e667261312e63646e2e6469676974616c6f6365616e7370616365732e636f6d2f6d696e742d315f6d65746164617461322f000000

-----Decoded View---------------
Arg [0] : baseURI (string): https://ate.fra1.cdn.digitaloceanspaces.com/mint-1_metadata2/

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 000000000000000000000000000000000000000000000000000000000000003d
Arg [2] : 68747470733a2f2f6174652e667261312e63646e2e6469676974616c6f636561
Arg [3] : 6e7370616365732e636f6d2f6d696e742d315f6d65746164617461322f000000


Loading...
Loading
Loading...
Loading
[ 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.