ETH Price: $3,867.72 (-3.56%)

Token

X-Pod (X-POD)
 

Overview

Max Total Supply

1,967 X-POD

Holders

176

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Filtered by Token Holder
mothership-lexi.eth
Balance
17 X-POD
0x7000d45abdee5c23eb4184e7e9c510e8bced9efd
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

A collection of 10,000 X-Pods each containing an unrevealed X-Droid, a digital collectible with exclusive benefits.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
XPods

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 24 : XPodAuctions.sol
/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@      @@@,    @@@@@(     @@@    @/   &#       @        .@@@@@@  *@@@@@@@@@@* %@@@
@@        V.    @@@@@      @@@     /    @       @         %@@@        @@,        @@
@@   @>   @.    @@@@@       @@          @    @@@@@@,    @@@@@@@    @@@     /@*  *@@
@@        ^.    @@@@        (@          @      /@@@,    @&     #&       %@@@@@@@@@@
@@       (@,    @@@@    %   (@          @      /@@@,    @      @&      .@@@@@@@@@@@
@@   ,@@@@@,    @@@#         @          @    @@@@@@,    @@@@@@@*    @      @@@  @@@
@@   ,@@@@@,       #   #%    @    @     @       @@@,    @@@@@@      /@@&         @@
@@   ,@@@@@,       #   #@,   @    @/    @       @@@,    @@@@@@@     @@@@@@@(    *@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Planet-X X-Pods
playplanetx.com
Planet-X Ltd © 2023 | All rights reserved
cfec19b223b57f38d96f52994b515d455b5dd1bb3741b8791ada32f862e95879
*/

// Layout of Contract:
// version
// imports
// errors
// interfaces, libraries, contracts
// Type declarations
// State variables
// Events
// Modifiers
// Functions

// Layout of Functions:
// constructor
// receive function (if exists)
// fallback function (if exists)
// external
// public
// internal
// private
// view & pure functions

// SPDX-License-Identifier: UNLICENCED

// #region ERRORS

error RefundToNullAddress();
error NoClaimsDuringBiddingStage();
error StageMustBeClaimsAndRefunds(AuctionStage currentStage);
error MinBidMustBeGreaterThanZero(uint256 minBidInput);

error FinalPriceMustMatchSetPrice();
error NoClaimsAllowedInCurrentStage(AuctionStage currentStage);

error InvalidStageForThisChange(AuctionStage currentStage);

error XDroidAddressChange();

error AlreadyRefunded(uint8 auctionId, address recipient);
error AlreadyClaimed(address claimaint);
error RevealsNotOpenYet();
error TokenNotMinted(uint16 tokenId);
error MustBeTokenOwner(address wallet, uint256 tokenId);

error ExceedsMaxTeamMint(uint256 requestedPods, uint256 maxPods);

error EmptyBaseURI();
error XDroidContractNotSet();

// #endregion

pragma solidity 0.8.20;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "../x-droids/Interfaces.sol";
import "../base/XNFTRoyaltyBase.sol";
import "../base/Withdrawer.sol";
import "../auctions/IXAuction.sol";
import "../auctions/AuctionStructs.sol";

contract XPods is XNFTRoyaltyBase, ReentrancyGuard, Withdrawer, IXAuction {
    using Math for uint256;
    using SafeCast for uint256;

    // the maximum pods that can be minted by this contract
    uint16 private constant TOTAL_SUPPLY = 10000;

    // The maximum pods that can be minted for the team and marketing purposes
    // set to 5% of the total supply
    // This is just an upper limit, any unspent pods from these will be available to be
    // distrubuted in auctions.
    uint16 public constant MAX_RESERVED_PODS = 500;

    // counter for the pods minted to the team
    uint16 public mintedReservedPods;

    // this is the total supply reserved in created auctions
    uint16 public auctionsReservedSupply;

    // the address of the XDroids contract
    address public xDroidsContractAddress;

    // an ID counter for auctions
    uint8 public auctionId;

    // the auctions data
    mapping(uint8 auctionId => Auction) public auctions;

    // users bids and refunds
    // auctionId -> userAddress -> User
    mapping(uint8 auctionId => mapping(address => Bidder)) public bidders;

    // a record of which auction each pod came from
    mapping(uint16 podId => uint8 auctionId) public podAuctionId;

    // when a pod is exchanged for an XDroid
    event XDroidRevealed(address owner, uint256 droidTokenId, uint256 burnedPodTokenId);
    event XDroidContractSet(address contractAddress);
    event RevealsOpen(uint8 auctionId);
    event MintedReserved(address recipient, uint256 podsCount);

    constructor() payable XNFTRoyaltyBase("X-Pod", "X-POD", 750, msg.sender) {}

    /**
     * @notice Modifier to ensure that the function is called from an external account
     */
    modifier onlyExternalAccounts() {
        _onlyExternalCallers();
        _;
    }

    // #region external functions
    function createAuction(
        uint16 _supply,
        uint8 _maxWinPerWallet,
        uint64 _minimumBid
    ) external onlyOwner {
        // validate auction params
        if (
            _supply == 0 ||
            _minimumBid == 0 ||
            _maxWinPerWallet == 0 ||
            _supply < _maxWinPerWallet
        ) {
            revert InvalidCreateAuctionParams();
        }

        // the supply requested must not exceed the total supply
        if (_supply + auctionsReservedSupply + mintedReservedPods > TOTAL_SUPPLY) {
            revert MaxSupplyExceeded();
        }

        // ensure any previous auction is active
        if (auctionId > 0) {
            Auction memory auction = currentAuction();

            if (auction.stage == AuctionStage.None) {
                revert MultipleAuctionsViolation();
            }
        }

        uint8 newAuctionId = auctionId + 1;

        auctions[newAuctionId] = Auction({
            id: newAuctionId,
            maxWinPerWallet: _maxWinPerWallet,
            supply: _supply,
            remainingSupply: _supply,
            minimumBid: _minimumBid,
            price: 0,
            stage: AuctionStage.None
        });

        // update the reserved supply
        // this is used to ensure the total supply is not exceeded
        // += consumes more gas
        auctionsReservedSupply = auctionsReservedSupply + _supply;

        emit AuctionCreated(newAuctionId, _supply, _maxWinPerWallet, _minimumBid);
    }

    /**
     * @notice begin a created auction
     */
    function startAuction() external onlyOwner {
        // the XDroid contract must be known and set before an auction starts
        if (xDroidsContractAddress == address(0)) {
            revert XDroidContractNotSet();
        }

        uint8 nextAuctionId = auctionId + 1;

        // ensure the auction exists
        Auction memory nextAuction = auctions[nextAuctionId];
        if (nextAuction.supply == 0) {
            revert AuctionDoesNotExist(nextAuctionId);
        }

        // ensure the current auction is closed
        if (auctionId > 0) {
            if (auctions[auctionId].stage < AuctionStage.Closed) {
                revert MultipleAuctionsViolation();
            }
        }

        // set the auction id
        auctionId = nextAuctionId;

        // ensure the auction is not already started
        if (nextAuction.stage != AuctionStage.None) {
            revert AuctionMustNotBeStarted();
        }

        // set the auction stage to active
        auctions[nextAuctionId].stage = AuctionStage.Active;

        emit AuctionStarted(nextAuctionId);
    }

    /**
     * @notice Starts the claims and refund stage for an auction.
     * if the price in Wei was not set correctly, there's a chance the claims and refunds
     * will start with the wrong price and then the will be no way of rectifying this mistake
     * therefore the price @param finalPrice must be sent again here to confirm the price
     */
    function startClaims(uint8 _auctionId, uint256 finalPrice) external onlyOwner {
        // read auction to memory
        Auction memory auction = auctions[_auctionId];

        // revert if the auction does not exist
        if (auction.supply == 0) {
            revert AuctionDoesNotExist(_auctionId);
        }

        // revert if the stage is not "bidding closed"
        if (auction.stage != AuctionStage.Closed) {
            revert StageMustBeBiddingClosed(auction.stage);
        }

        if (auction.price == 0) {
            revert PriceMustBeSet();
        }

        if (finalPrice != auction.price) {
            revert FinalPriceMustMatchSetPrice();
        }

        // write back to storage
        auctions[_auctionId].stage = AuctionStage.Claims;

        emit ClaimsAndRefundsStarted(_auctionId);
    }

    /**
     * @notice Start the reveals for an auction
     */
    function startReveals(uint8 _auctionId) external onlyOwner {
        // read auction to memory
        Auction memory auction = auctions[_auctionId];

        if (auction.supply == 0) {
            revert AuctionDoesNotExist(_auctionId);
        }

        if (auction.stage != AuctionStage.Claims) {
            revert StageMustBeClaimsAndRefunds(auction.stage);
        }

        auction.stage = AuctionStage.Reveals;

        // write back to storage
        auctions[_auctionId] = auction;

        emit RevealsOpen(_auctionId);
    }

    /**
     * @notice end the current auction
     * @dev a new auction cannot be started before the previous one is ended
     * hence there is no need to enable ending of a specific auction
     */
    function endAuction() external onlyOwner {
        if (auctions[auctionId].stage != AuctionStage.Active) {
            revert AuctionMustBeActive();
        }

        // write back to storage
        auctions[auctionId].stage = AuctionStage.Closed;
        emit AuctionEnded(auctionId);
    }

    function sendRefund(uint8 _auctionId, address payable _receiver) external onlyOwner {
        _sendRefund(_auctionId, _receiver);
    }

    /**
     * @notice send refunds to a batch of addresses.
     * @param _auctionId the auction id
     * @param addresses array of addresses to refund.
     */
    function sendRefundBatch(
        uint8 _auctionId,
        address[] calldata addresses
    ) external onlyOwner {
        uint256 length = addresses.length;
        uint8 i;
        do {
            _sendRefund(_auctionId, payable(addresses[i]));
            unchecked {
                ++i;
            }
        } while (i < length);
    }

    /**
     * @notice Place a bid or increase your existing bid.
     *  All bids placed are final and cannot be reversed.
     *
     * @dev there can only ever be one active auction at a time, so we don't
     *   need to pass the auction id as a parameter. A bid is always made on the current auction
     */
    function bid() external payable onlyExternalAccounts {
        // read auction to memory
        Auction memory auction = currentAuction();

        /**
        @dev the current auction remains current until the next auction is started, hence it can be 
        in stages other than active, e.g. bidding closed, claims and refunds, reveals open
         */
        if (auction.stage != AuctionStage.Active) {
            revert AuctionMustBeActive();
        }

        // @todo consider bidder caching
        // Bidder storage bidder = bidders[auction.id][msg.sender];
        uint256 userBid = bidders[auction.id][msg.sender].totalBid;

        uint64 minBid = auction.minimumBid; // storage to memory

        // increment the bid of the user
        userBid += msg.value;

        // if their new total bid is less than the current minimum bid
        // revert with an error
        // @dev we don't validate the current incoming bid increment against
        // the minimum bid, the requirement is bid (0 iniitally) + increment < minimim bid
        // rather than increment < minimum bid
        if (userBid < minBid) {
            revert BidLowerThanMinimum(userBid, minBid);
        }

        emit Bid(auction.id, msg.sender, msg.value, userBid);

        // reassign
        bidders[auction.id][msg.sender].totalBid = SafeCast.toUint120(userBid);
    }

    /**
     * @notice set the minimum contribution required to place a bid
     * @dev set this price in wei, not eth!
     * @param newMinimumBid new minimium bid in Wei
     */
    function setMinimumBid(uint64 newMinimumBid) external payable onlyOwner {
        // read auction to memory
        Auction memory auction = currentAuction();

        if (auction.stage > AuctionStage.Active) {
            revert InvalidStageForThisChange(auction.stage);
        }

        if (newMinimumBid == 0) {
            revert MinBidMustBeGreaterThanZero(newMinimumBid);
        }

        auctions[auction.id].minimumBid = newMinimumBid;

        emit MinimumBidChanged(auction.id, newMinimumBid);
    }

    function minimumBid() external view returns (uint64) {
        return auctions[auctionId].minimumBid;
    }

    function price(uint8 _auctionId) external view returns (uint64) {
        return auctions[_auctionId].price;
    }

    /**
     * @notice Claim pods and refunds for the current auction.
     */
    function claim() external nonReentrant {
        _internalClaim(msg.sender, auctionId);
    }

    /**
     * @notice Claim tokens and refund for a specific auction.
     */
    function claimForAuction(uint8 forAuctionId) external nonReentrant {
        _internalClaim(msg.sender, forAuctionId);
    }

    /**
     * @notice claim tokens and refund for an address.
     * @dev it is needed, since the withdraw function only allows to withdraw
     * funds for claimed pods
     * @param receiver the address to claim tokens for.
     */
    function claimOnBehalfOf(
        address receiver,
        uint8 forAuctionId
    ) external payable onlyOwner {
        _internalClaim(receiver, forAuctionId);
    }

    function claimOnBehalfOfBatch(
        address[] calldata addresses,
        uint8 forAuctionId
    ) external payable onlyOwner {
        uint16 i;
        uint16 length = uint16(addresses.length);

        do {
            _internalClaim(addresses[i], forAuctionId);
            unchecked {
                ++i;
            }
        } while (i < length);
    }

    /**
     * @notice reveal a pod to mint an XDroid
     * @param tokenId the token ID of the pod to reveal
     */
    function revealPod(uint16 tokenId) external nonReentrant returns (uint256) {
        // revert if the token does not exist
        if (!_exists(tokenId)) {
            revert TokenNotMinted(tokenId);
        }

        // revert if the sender is not the owner of the token
        if (ownerOf(tokenId) != msg.sender) {
            revert MustBeTokenOwner(msg.sender, tokenId);
        }

        // get the auction ID from the token ID
        uint8 _auctionId = podAuctionId[tokenId];

        // early revert if the auction is not in the right stage
        AuctionStage stage = auctions[_auctionId].stage;
        if (stage != AuctionStage.Reveals) {
            revert RevealsNotOpenYet();
        }

        // burning the pod for the minted droid
        _burn(tokenId, false);

        // droids contract interface set
        XDroidsInterface xdroidsContract = XDroidsInterface(xDroidsContractAddress);

        // get a droid in exchange
        uint256 droidId = xdroidsContract.mintFromXPod(msg.sender);

        // emit reveal event
        emit XDroidRevealed(msg.sender, droidId, tokenId);

        // Return the minted X-Droid token id
        return droidId;
    }

    /**
     * @notice Read the bid of the user for the current auction
     * @param bidder address of the bidder
     */
    function bidOf(address bidder) external view returns (uint216) {
        Bidder memory user = bidders[auctionId][bidder];
        return user.totalBid;
    }

    /**
     * @notice Read the bid of the user for an auction
     * @param bidder address of the bidder
     * @param _auctionId auction ID to read the bid for
     */
    function bidOfForAuction(
        address bidder,
        uint8 _auctionId
    ) external view returns (uint216) {
        Bidder memory user = bidders[_auctionId][bidder];
        return user.totalBid;
    }

    /**
     * @notice mint reserved tokens for the team
     * @param numberOfPods number of tokens to mint
     * @param receiver address to mint to
     */
    function mintReservedPods(uint8 numberOfPods, address receiver) external onlyOwner {
        uint16 newTotal = mintedReservedPods + numberOfPods;
        if (newTotal > MAX_RESERVED_PODS) {
            revert ExceedsMaxTeamMint(newTotal, MAX_RESERVED_PODS);
        }
        if (_totalMinted() + numberOfPods > TOTAL_SUPPLY) {
            revert MaxSupplyExceeded();
        }
        mintedReservedPods = newTotal;

        emit MintedReserved(receiver, numberOfPods);
        // mint the tokens
        _mint(receiver, numberOfPods);
    }

    /**
     * @dev sets the contract address of the X Droids contract,
     */
    function setXDroidsContract(address xDroidsAddressParam) external onlyOwner {
        if (xDroidsAddressParam == address(0)) {
            revert NullAddressParameter();
        }
        if (xDroidsContractAddress != address(0)) {
            revert XDroidAddressChange();
        }

        xDroidsContractAddress = xDroidsAddressParam;

        emit XDroidContractSet(xDroidsAddressParam);
    }

    /**
     * @notice set the clearing price after all bids have been placed.
     * @dev set this price in wei, not eth!
     * @param newPrice new price in Wei
     */
    function setPrice(uint8 _auctionId, uint64 newPrice) external payable onlyOwner {
        // read auction to memory
        Auction memory auction = auctions[_auctionId];

        if (auction.supply == 0) {
            revert AuctionDoesNotExist(_auctionId);
        }

        if (auction.stage != AuctionStage.Closed) {
            revert StageMustBeBiddingClosed(auction.stage);
        }

        uint64 minBid = auction.minimumBid; // storage to memory
        if (newPrice < minBid) {
            revert PriceIsLowerThanTheMinBid(newPrice, minBid);
        }
        auctions[_auctionId].price = newPrice;
        emit PriceSet(_auctionId, newPrice);
    }

    /**
     * @notice Withdraw function for the owner
     * @dev since only NFT sales funds can be withdrawn at any time
     * and users' funds need to be protected, this is marked as nonReentrant
     */
    function withdraw(address payable receiver) external onlyOwner nonReentrant {
        _withdraw(receiver);
    }

    // #endregion

    // #region public functions
    function currentAuction() public view returns (Auction memory) {
        if (auctionId == 0) {
            revert NoActiveAuction();
        }
        return auctions[auctionId];
    }

    // #endregion

    // #region internal functions
    function _onlyExternalCallers() internal view {
        if (msg.sender != tx.origin) {
            revert ContractCallersNotAllowed();
        }
    }

    /**
     * @notice send refund to an address. Refunds are unsuccessful bids or
     * an address's remaining eth after all their tokens have been paid for.
     * @dev can only be called after the price has been set
     * @param _auctionId the id of the auction for which the refund is sent
     * @param _receiver the address to refund to
     */
    function _sendRefund(uint8 _auctionId, address _receiver) internal {
        if (_receiver == address(0)) {
            revert RefundToNullAddress();
        }

        Auction memory auction = auctions[_auctionId]; // storage to memory

        if (auction.price == 0) {
            revert PriceMustBeSet();
        }

        Bidder memory bidder = bidders[_auctionId][_receiver]; // get user data in memory

        if (bidder.refundedFunds > 0) {
            revert AlreadyRefunded(_auctionId, _receiver);
        }

        uint256 refundValue = _refundAmount(
            bidder.totalBid,
            auction.price,
            auction.maxWinPerWallet
        );

        if (refundValue > 0) {
            bidders[_auctionId][_receiver].refundedFunds = SafeCast.toUint120(
                refundValue
            );

            // send the refund
            (bool success, ) = _receiver.call{value: refundValue}("");
            if (!success) {
                revert RefundFailed(_receiver, refundValue);
            }
            emit RefundSent(_receiver, refundValue);
        }
    }

    /**
     * @dev calculate the reufund for a bid and a price
     * @param userBid total bid
     * @param _price final price
     */
    function _refundAmount(
        uint256 userBid,
        uint256 _price,
        uint8 _maxPodsPerWallet
    ) internal pure returns (uint256) {
        // @dev taking the whole part only from the division and limiting to
        // the max pods number that can be won
        uint256 podsWon = Math.min(userBid / _price, _maxPodsPerWallet);

        // the refund is the difference between the bid and the price
        // to pay for the pods
        return userBid - (podsWon * _price);
    }

    /**
     * @notice claim function to be used both by the user and by the owner
     * @dev used by claim() and claimOnBehalfOf()
     * @param claimant the address to claim tokens for.
     */
    function _internalClaim(address claimant, uint8 _auctionId) internal {
        if (claimant == address(0)) {
            revert NullAddressParameter();
        }

        // early revert if the auction is not in the right stage
        Auction memory auction = auctions[_auctionId];

        if (auction.supply == 0) {
            revert AuctionDoesNotExist(_auctionId);
        }

        if (auction.stage < AuctionStage.Claims) {
            revert InvalidStageForOperation(auction.stage, AuctionStage.Claims);
        }

        // read user in memory
        // @todo consider caching: mapping(address => Bidder) storage _bidders = bidders[_auctionId];
        Bidder memory user = bidders[_auctionId][claimant];

        // revert if the user has already claimed
        if (user.claimed) {
            revert AlreadyClaimed(claimant);
        }

        // set the claim flag to true early (CEI)
        bidders[_auctionId][claimant].claimed = true;

        uint120 userTotalBid = user.totalBid;

        if (userTotalBid == 0) {
            revert ZeroBids(claimant);
        }

        // determine the split between tokens and refund
        // limit to the maximum tokens a wallet can win in the auction
        uint mintAmount = Math.min(
            // @dev no precision loss in division below, we only need the whole part
            Math.min(userTotalBid / auction.price, auction.maxWinPerWallet),
            auction.remainingSupply
        );

        uint128 podsMintCost = uint128(mintAmount) * auction.price;

        // if any pods are won
        // the mintAmount is adjusted for supply above,
        // hence it can be 0, if no supply has been left even if the bid is greater than the price
        if (mintAmount > 0) {
            unchecked {
                // does not overflow, mintAmount is limited to the supply left
                auctions[_auctionId].remainingSupply = uint16(
                    auction.remainingSupply - mintAmount
                );

                // increase the withdrawable amount
                withdrawableFunds = withdrawableFunds + podsMintCost;
            }

            uint16 nextTokenId = SafeCast.toUint16(_totalMinted() + 1);

            // update the pod id to auction id mapping
            uint8 i;
            do {
                podAuctionId[nextTokenId + i] = _auctionId;

                unchecked {
                    ++i;
                }
            } while (i < mintAmount);

            // mint the tokens
            _mint(claimant, mintAmount);
        }

        // send the refund to the user
        // if a previous refund has been sent, it will be substracted.
        // This can occur if the user has already been refunded by the owner
        // and they are due an extra refund, because the remaining supply is lower than
        uint128 refund = (userTotalBid - podsMintCost) - user.refundedFunds;
        if (refund > 0) {
            emit RefundSent(claimant, refund);

            // write the refund to state
            bidders[_auctionId][claimant].refundedFunds = SafeCast.toUint120(refund);

            (bool success, ) = claimant.call{value: refund}("");
            if (!success) {
                revert RefundFailed(claimant, refund);
            }
        }

        emit Claimed(claimant, userTotalBid, mintAmount, refund);
    }

    // #endregion
}

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

pragma solidity ^0.8.4;

import './IERC721A.sol';

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _tokenApprovals[tokenId].value;
    }

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfers(from, to, tokenId, 1);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        address from = address(uint160(prevOwnershipPacked));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.4;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.4;

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

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

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

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

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

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

pragma solidity ^0.8.4;

import '../IERC721A.sol';

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 8 of 24 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

        return (royalty.receiver, royaltyAmount);
    }

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

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

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 14 of 24 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 15 of 24 : DefaultOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {OperatorFilterer} from "./OperatorFilterer.sol";
import {CANONICAL_CORI_SUBSCRIPTION} from "./lib/Constants.sol";
/**
 * @title  DefaultOperatorFilterer
 * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription.
 * @dev    Please note that if your token contract does not provide an owner with EIP-173, it must provide
 *         administration methods on the contract itself to interact with the registry otherwise the subscription
 *         will be locked to the options set during construction.
 */

abstract contract DefaultOperatorFilterer is OperatorFilterer {
    /// @dev The constructor that is called when the contract is being deployed.
    constructor() OperatorFilterer(CANONICAL_CORI_SUBSCRIPTION, true) {}
}

File 16 of 24 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface IOperatorFilterRegistry {
    /**
     * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns
     *         true if supplied registrant address is not registered.
     */
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);

    /**
     * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.
     */
    function register(address registrant) external;

    /**
     * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes.
     */
    function registerAndSubscribe(address registrant, address subscription) external;

    /**
     * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another
     *         address without subscribing.
     */
    function registerAndCopyEntries(address registrant, address registrantToCopy) external;

    /**
     * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.
     *         Note that this does not remove any filtered addresses or codeHashes.
     *         Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.
     */
    function unregister(address addr) external;

    /**
     * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered.
     */
    function updateOperator(address registrant, address operator, bool filtered) external;

    /**
     * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.
     */
    function updateOperators(address registrant, address[] calldata operators, bool filtered) external;

    /**
     * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.
     */
    function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;

    /**
     * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.
     */
    function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;

    /**
     * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous
     *         subscription if present.
     *         Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,
     *         subscriptions will not be forwarded. Instead the former subscription's existing entries will still be
     *         used.
     */
    function subscribe(address registrant, address registrantToSubscribe) external;

    /**
     * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.
     */
    function unsubscribe(address registrant, bool copyExistingEntries) external;

    /**
     * @notice Get the subscription address of a given registrant, if any.
     */
    function subscriptionOf(address addr) external returns (address registrant);

    /**
     * @notice Get the set of addresses subscribed to a given registrant.
     *         Note that order is not guaranteed as updates are made.
     */
    function subscribers(address registrant) external returns (address[] memory);

    /**
     * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.
     *         Note that order is not guaranteed as updates are made.
     */
    function subscriberAt(address registrant, uint256 index) external returns (address);

    /**
     * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.
     */
    function copyEntriesOf(address registrant, address registrantToCopy) external;

    /**
     * @notice Returns true if operator is filtered by a given address or its subscription.
     */
    function isOperatorFiltered(address registrant, address operator) external returns (bool);

    /**
     * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription.
     */
    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);

    /**
     * @notice Returns true if a codeHash is filtered by a given address or its subscription.
     */
    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);

    /**
     * @notice Returns a list of filtered operators for a given address or its subscription.
     */
    function filteredOperators(address addr) external returns (address[] memory);

    /**
     * @notice Returns the set of filtered codeHashes for a given address or its subscription.
     *         Note that order is not guaranteed as updates are made.
     */
    function filteredCodeHashes(address addr) external returns (bytes32[] memory);

    /**
     * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or
     *         its subscription.
     *         Note that order is not guaranteed as updates are made.
     */
    function filteredOperatorAt(address registrant, uint256 index) external returns (address);

    /**
     * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or
     *         its subscription.
     *         Note that order is not guaranteed as updates are made.
     */
    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);

    /**
     * @notice Returns true if an address has registered
     */
    function isRegistered(address addr) external returns (bool);

    /**
     * @dev Convenience method to compute the code hash of an arbitrary contract
     */
    function codeHashOf(address addr) external returns (bytes32);
}

File 17 of 24 : OperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol";
import {CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol";
/**
 * @title  OperatorFilterer
 * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
 *         registrant's entries in the OperatorFilterRegistry.
 * @dev    This smart contract is meant to be inherited by token contracts so they can use the following:
 *         - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
 *         - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
 *         Please note that if your token contract does not provide an owner with EIP-173, it must provide
 *         administration methods on the contract itself to interact with the registry otherwise the subscription
 *         will be locked to the options set during construction.
 */

abstract contract OperatorFilterer {
    /// @dev Emitted when an operator is not allowed.
    error OperatorNotAllowed(address operator);

    IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY =
        IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS);

    /// @dev The constructor that is called when the contract is being deployed.
    constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
        // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
        // will not revert, but the contract will need to be registered with the registry once it is deployed in
        // order for the modifier to filter addresses.
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            if (subscribe) {
                OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
                } else {
                    OPERATOR_FILTER_REGISTRY.register(address(this));
                }
            }
        }
    }

    /**
     * @dev A helper function to check if an operator is allowed.
     */
    modifier onlyAllowedOperator(address from) virtual {
        // Allow spending tokens from addresses with balance
        // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
        // from an EOA.
        if (from != msg.sender) {
            _checkFilterOperator(msg.sender);
        }
        _;
    }

    /**
     * @dev A helper function to check if an operator approval is allowed.
     */
    modifier onlyAllowedOperatorApproval(address operator) virtual {
        _checkFilterOperator(operator);
        _;
    }

    /**
     * @dev A helper function to check if an operator is allowed.
     */
    function _checkFilterOperator(address operator) internal view virtual {
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            // under normal circumstances, this function will revert rather than return false, but inheriting contracts
            // may specify their own OperatorFilterRegistry implementations, which may behave differently
            if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
                revert OperatorNotAllowed(operator);
            }
        }
    }
}

File 18 of 24 : Constants.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E;
address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;

File 19 of 24 : AuctionEnums.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.20;

/* 
Stages of the auction

None - initial stage, before bidding is allowed
Active - bids are allowed, the auction is active
Closed - bids are closed, the price needs to be set
Claims - bidders can claim their winnings and receive any refunds
Reveals - claims and refunds are still active, additionally
               owners of pods are now able to reveal their pod
 */
enum AuctionStage {
    None,
    Active,
    Closed,
    Claims,
    Reveals
}

File 20 of 24 : AuctionStructs.sol
// SPDX-License-Identifier: UNLICENCED

pragma solidity 0.8.20;

import "./AuctionEnums.sol";

// uint120 is 15 bytes, therefore the whole struct is 31 bytes
// this improves gas perfomance of claim and bid by quite a large margin
struct Bidder {
    // the sum of the user's bids
    uint120 totalBid;
    // total funds refunded to the user
    uint120 refundedFunds;
    // whether or not the user has claimed already
    bool claimed; // 1 byte
}

// @dev the uint limits are intentional
struct Auction {
    // the auction id
    uint8 id; // 1 byte
    // the auction stage
    AuctionStage stage; // 1 byte
    // the maximum number of pods that can be won by a single wallet
    uint8 maxWinPerWallet; // 1 byte
    //
    // the maximum number of pods that can be minted in this auction
    uint16 supply; // 2 bytes
    //
    // the number of minted NFTs for this auction
    uint16 remainingSupply; // 2 bytes
    //
    // minimum bid
    uint64 minimumBid; // 8 bytes
    // the price as computed by the binary search algorithm
    // it get set after the bidding is closed
    uint64 price; // 8 bytes
}

File 21 of 24 : IXAuction.sol
// SPDX-License-Identifier: UNLICENCED
pragma solidity 0.8.20;

import "./AuctionEnums.sol";

interface IXAuction {
    /**
     * EVENTS
     */
    event Bid(
        uint8 indexed auctionId,
        address indexed bidder,
        uint256 bidAmount,
        uint256 bidderTotal
    );

    // when a bidder is refunded
    event RefundSent(address indexed recipient, uint256 value);

    event AuctionCreated(
        uint8 indexed auctionId,
        uint16 supply,
        uint8 maxWinPerWallet,
        uint64 minimumBid
    );

    event AuctionStarted(uint8 indexed auctionId);
    event MinimumBidChanged(uint8 indexed auctionId, uint256 newMinBid);
    event AuctionEnded(uint8 indexed auctionId);
    event PriceSet(uint8 indexed auctionId, uint256 newPrice);
    event ClaimsAndRefundsStarted(uint8 indexed auctionId);

    // when a user claims their NFTs and/or refunds
    event Claimed(address recipient, uint256 totalBid, uint256 podsWon, uint256 refund);

    /**
     * ERRORS
     */
    error InvalidCreateAuctionParams();
    error NullAddressParameter();
    error AuctionMustNotBeStarted();
    error InvalidStageForOperation(AuctionStage currentStage, AuctionStage requiredStage);
    error AuctionMustBeActive();
    error BidLowerThanMinimum(uint256 bid, uint256 minBid);
    error StageMustBeBiddingClosed(AuctionStage currentStage);
    error PriceMustBeSet();
    error PriceIsLowerThanTheMinBid(uint256 priceInput, uint256 minBid);
    error MultipleAuctionsViolation();
    error ZeroBids(address user);
    error NoActiveAuction();
    error AuctionDoesNotExist(uint8 auctionId);
    error MaxSupplyExceeded();

    error RefundFailed(address recipient, uint256 amount);
    error ContractCallersNotAllowed();

    // function bid() external payable;
}

File 22 of 24 : Withdrawer.sol
// SPDX-License-Identifier: UNLICENCED

pragma solidity 0.8.20;

import "@openzeppelin/contracts/utils/math/SafeCast.sol";

// Errors
error NoFundsToWithdraw();
error WithdrawFailed(address recipient, uint256 amount);
error WithdrawToNullAddress();

contract Withdrawer {
    using SafeCast for uint256;

    // Events
    event FundsWithdrawn(address recipient, uint256 amount);

    // the total funds that can be withdrawn by the owner
    uint128 internal withdrawableFunds;

    /**
     * @notice Withdraw function for the owner
     * @dev since only pod sales funds can be withdrawn at any time
     * and users' funds need to be protected, this is marked as nonReentrant
     */
    function _withdraw(address payable receiver) internal {
        // allow the owner to withdraw the balance for any minted pods
        // allow the owner to withdraw the balance
        if (receiver == address(0)) {
            revert WithdrawToNullAddress();
        }

        uint128 funds = withdrawableFunds;
        if (funds == 0) {
            revert NoFundsToWithdraw();
        }

        // reset the withdrawable funds
        withdrawableFunds = 0;

        // emit the withdraw event
        emit FundsWithdrawn(receiver, funds);

        // send the funds to the receiver
        (bool success, ) = receiver.call{value: funds}("");
        if (!success) {
            revert WithdrawFailed(receiver, funds);
        }
    }

    /**
    @dev fallback function to receive ether
     */
    receive() external payable {
        // increase the withdrawable funds by the ETH received
        // += is less gas efficient
        withdrawableFunds = withdrawableFunds + SafeCast.toUint128(msg.value);
    }
}

File 23 of 24 : XNFTRoyaltyBase.sol
// SPDX-License-Identifier: UNLICENCED

pragma solidity 0.8.20;

import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "operator-filter-registry/src/DefaultOperatorFilterer.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "erc721a/contracts/extensions/ERC721AQueryable.sol";

/**
This base contract provides a combination of common base inheritance for PlanetX NFTs.
It includes: Royalties (ERC2981), OperatorFiltering (OperatorFilterRegistry)
and overries for basic ERC721A functionality - start token id and base uri.
 */
contract XNFTRoyaltyBase is DefaultOperatorFilterer, ERC721AQueryable, ERC2981, Ownable {
    // the base URI for the metadata
    string public baseURI;

    // the URI for the contract level metadata
    // @dev see https://docs.opensea.io/docs/contract-level-metadata
    string private contractMetadataURI;

    event RoyaltyChanged(address indexed receiver, uint96 feeNumerator);
    event BaseURISet(string baseURI);
    error EmptyBaseURI();

    constructor(
        string memory name,
        string memory symbol,
        uint96 royalty,
        address receiver
    ) ERC721A(name, symbol) {
        // set the default royalty
        _setDefaultRoyalty(receiver, royalty);
    }

    /**
     * @dev override from ERC721A
     */
    function _baseURI() internal view override returns (string memory) {
        return baseURI;
    }

    /**
     * @dev overriding from ERC721: start at the 1st token instead of 0
     */
    function _startTokenId() internal pure override returns (uint256) {
        return 1;
    }

    /**
     * @dev sets the base uri for {_baseURI}
     */
    function setBaseURI(string calldata newBaseURI) external onlyOwner {
        if (bytes(newBaseURI).length == 0) {
            revert EmptyBaseURI();
        }

        baseURI = newBaseURI;
        emit BaseURISet(newBaseURI);
    }

    // contract level metadata
    function contractURI() external view returns (string memory) {
        return contractMetadataURI;
    }

    function setContractURI(string calldata newURI) external payable onlyOwner {
        contractMetadataURI = newURI;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(ERC2981, IERC721A, ERC721A) returns (bool) {
        return ERC721A.supportsInterface(interfaceId);
    }

    ////////////////
    // ERC2981 royalty standard
    ////////////////
    /**
     * @dev See {ERC2981-_setDefaultRoyalty}.
     */
    function setDefaultRoyalty(
        address receiver,
        uint96 feeNumerator
    ) external payable onlyOwner {
        _setDefaultRoyalty(receiver, feeNumerator);

        emit RoyaltyChanged(receiver, feeNumerator);
    }

    /**
     * @dev See {ERC2981-_deleteDefaultRoyalty}.
     */
    function deleteDefaultRoyalty() external payable onlyOwner {
        _deleteDefaultRoyalty();
    }

    ////////////////
    // overrides for using OpenSea's OperatorFilter to filter out platforms which are know to not enforce
    // creator earnings
    ////////////////
    function setApprovalForAll(
        address operator,
        bool approved
    ) public override(ERC721A, IERC721A) onlyAllowedOperatorApproval(operator) {
        super.setApprovalForAll(operator, approved);
    }

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

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

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

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

    //////////
    // end of OpenSea DefaultOperatorFilter overrides
}

File 24 of 24 : Interfaces.sol
// SPDX-License-Identifier: UNLICENCED

pragma solidity 0.8.20;

interface XDroidsInterface {
    function mintFromXPod(address to) external returns (uint256);
}

Settings
{
  "remappings": [
    "@chainlink/=lib/chainlink/contracts/src/v0.8/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "CramBit/=lib/foundry-random/lib/CramBit/",
    "ERC721A/=lib/ERC721A/contracts/",
    "chainlink/=lib/chainlink/",
    "delegate-registry/=lib/delegate-registry/",
    "delegate.cash/=lib/delegate-registry/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/operator-filter-registry/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "erc721a/=lib/ERC721A/",
    "forge-std/=lib/forge-std/src/",
    "foundry-random/=lib/foundry-random/src/",
    "openzeppelin-contracts-upgradeable/=lib/operator-filter-registry/lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "operator-filter-registry/=lib/operator-filter-registry/",
    "prb-test/=lib/foundry-random/lib/prb-test/src/",
    "solidity-bytes-utils/=lib/foundry-random/lib/solidity-bytes-utils/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"payable","type":"constructor"},{"inputs":[{"internalType":"address","name":"claimaint","type":"address"}],"name":"AlreadyClaimed","type":"error"},{"inputs":[{"internalType":"uint8","name":"auctionId","type":"uint8"},{"internalType":"address","name":"recipient","type":"address"}],"name":"AlreadyRefunded","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[{"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"AuctionDoesNotExist","type":"error"},{"inputs":[],"name":"AuctionMustBeActive","type":"error"},{"inputs":[],"name":"AuctionMustNotBeStarted","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"bid","type":"uint256"},{"internalType":"uint256","name":"minBid","type":"uint256"}],"name":"BidLowerThanMinimum","type":"error"},{"inputs":[],"name":"ContractCallersNotAllowed","type":"error"},{"inputs":[],"name":"EmptyBaseURI","type":"error"},{"inputs":[{"internalType":"uint256","name":"requestedPods","type":"uint256"},{"internalType":"uint256","name":"maxPods","type":"uint256"}],"name":"ExceedsMaxTeamMint","type":"error"},{"inputs":[],"name":"FinalPriceMustMatchSetPrice","type":"error"},{"inputs":[],"name":"InvalidCreateAuctionParams","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[{"internalType":"enum AuctionStage","name":"currentStage","type":"uint8"},{"internalType":"enum AuctionStage","name":"requiredStage","type":"uint8"}],"name":"InvalidStageForOperation","type":"error"},{"inputs":[{"internalType":"enum AuctionStage","name":"currentStage","type":"uint8"}],"name":"InvalidStageForThisChange","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[{"internalType":"uint256","name":"minBidInput","type":"uint256"}],"name":"MinBidMustBeGreaterThanZero","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"MultipleAuctionsViolation","type":"error"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"MustBeTokenOwner","type":"error"},{"inputs":[],"name":"NoActiveAuction","type":"error"},{"inputs":[],"name":"NoFundsToWithdraw","type":"error"},{"inputs":[],"name":"NullAddressParameter","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[{"internalType":"uint256","name":"priceInput","type":"uint256"},{"internalType":"uint256","name":"minBid","type":"uint256"}],"name":"PriceIsLowerThanTheMinBid","type":"error"},{"inputs":[],"name":"PriceMustBeSet","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RefundFailed","type":"error"},{"inputs":[],"name":"RefundToNullAddress","type":"error"},{"inputs":[],"name":"RevealsNotOpenYet","type":"error"},{"inputs":[{"internalType":"enum AuctionStage","name":"currentStage","type":"uint8"}],"name":"StageMustBeBiddingClosed","type":"error"},{"inputs":[{"internalType":"enum AuctionStage","name":"currentStage","type":"uint8"}],"name":"StageMustBeClaimsAndRefunds","type":"error"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"}],"name":"TokenNotMinted","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"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawFailed","type":"error"},{"inputs":[],"name":"WithdrawToNullAddress","type":"error"},{"inputs":[],"name":"XDroidAddressChange","type":"error"},{"inputs":[],"name":"XDroidContractNotSet","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"ZeroBids","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"},{"indexed":false,"internalType":"uint16","name":"supply","type":"uint16"},{"indexed":false,"internalType":"uint8","name":"maxWinPerWallet","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"minimumBid","type":"uint64"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"AuctionEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"AuctionStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"BaseURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"},{"indexed":true,"internalType":"address","name":"bidder","type":"address"},{"indexed":false,"internalType":"uint256","name":"bidAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bidderTotal","type":"uint256"}],"name":"Bid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalBid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"podsWon","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refund","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"ClaimsAndRefundsStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"auctionId","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"newMinBid","type":"uint256"}],"name":"MinimumBidChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"podsCount","type":"uint256"}],"name":"MintedReserved","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":"uint8","name":"auctionId","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"PriceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"RefundSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"RevealsOpen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"RoyaltyChanged","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"contractAddress","type":"address"}],"name":"XDroidContractSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"droidTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"burnedPodTokenId","type":"uint256"}],"name":"XDroidRevealed","type":"event"},{"inputs":[],"name":"MAX_RESERVED_PODS","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"auctionId","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"auctionId","type":"uint8"}],"name":"auctions","outputs":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"enum AuctionStage","name":"stage","type":"uint8"},{"internalType":"uint8","name":"maxWinPerWallet","type":"uint8"},{"internalType":"uint16","name":"supply","type":"uint16"},{"internalType":"uint16","name":"remainingSupply","type":"uint16"},{"internalType":"uint64","name":"minimumBid","type":"uint64"},{"internalType":"uint64","name":"price","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"auctionsReservedSupply","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"bidder","type":"address"}],"name":"bidOf","outputs":[{"internalType":"uint216","name":"","type":"uint216"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint8","name":"_auctionId","type":"uint8"}],"name":"bidOfForAuction","outputs":[{"internalType":"uint216","name":"","type":"uint216"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"auctionId","type":"uint8"},{"internalType":"address","name":"","type":"address"}],"name":"bidders","outputs":[{"internalType":"uint120","name":"totalBid","type":"uint120"},{"internalType":"uint120","name":"refundedFunds","type":"uint120"},{"internalType":"bool","name":"claimed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"forAuctionId","type":"uint8"}],"name":"claimForAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint8","name":"forAuctionId","type":"uint8"}],"name":"claimOnBehalfOf","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"uint8","name":"forAuctionId","type":"uint8"}],"name":"claimOnBehalfOfBatch","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_supply","type":"uint16"},{"internalType":"uint8","name":"_maxWinPerWallet","type":"uint8"},{"internalType":"uint64","name":"_minimumBid","type":"uint64"}],"name":"createAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentAuction","outputs":[{"components":[{"internalType":"uint8","name":"id","type":"uint8"},{"internalType":"enum AuctionStage","name":"stage","type":"uint8"},{"internalType":"uint8","name":"maxWinPerWallet","type":"uint8"},{"internalType":"uint16","name":"supply","type":"uint16"},{"internalType":"uint16","name":"remainingSupply","type":"uint16"},{"internalType":"uint64","name":"minimumBid","type":"uint64"},{"internalType":"uint64","name":"price","type":"uint64"}],"internalType":"struct Auction","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deleteDefaultRoyalty","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"endAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumBid","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"numberOfPods","type":"uint8"},{"internalType":"address","name":"receiver","type":"address"}],"name":"mintReservedPods","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintedReservedPods","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","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":[{"internalType":"uint16","name":"podId","type":"uint16"}],"name":"podAuctionId","outputs":[{"internalType":"uint8","name":"auctionId","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_auctionId","type":"uint8"}],"name":"price","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"}],"name":"revealPod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint8","name":"_auctionId","type":"uint8"},{"internalType":"address payable","name":"_receiver","type":"address"}],"name":"sendRefund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_auctionId","type":"uint8"},{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"sendRefundBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"newMinimumBid","type":"uint64"}],"name":"setMinimumBid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_auctionId","type":"uint8"},{"internalType":"uint64","name":"newPrice","type":"uint64"}],"name":"setPrice","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"xDroidsAddressParam","type":"address"}],"name":"setXDroidsContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_auctionId","type":"uint8"},{"internalType":"uint256","name":"finalPrice","type":"uint256"}],"name":"startClaims","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_auctionId","type":"uint8"}],"name":"startReveals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xDroidsContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6005608081815264160b541bd960da1b60a05261010060405260c091825264160b5413d160da1b60e052906102ee338383733cc6cdda760b79bafa08df41ecfa224f810dceb660016daaeb6d7670e522a718067333cd4e3b156200018c578015620000da57604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b158015620000bb57600080fd5b505af1158015620000d0573d6000803e3d6000fd5b505050506200018c565b6001600160a01b038216156200012b5760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401620000a0565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b1580156200017257600080fd5b505af115801562000187573d6000803e3d6000fd5b505050505b50600290506200019d8382620003d7565b506003620001ac8282620003d7565b5050600160005550620001bf33620001db565b620001cb81836200022d565b50506001600d5550620004a39050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b0382161115620002a15760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b038216620002f95760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640162000298565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600855565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200035d57607f821691505b6020821081036200037e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003d257600081815260208120601f850160051c81016020861015620003ad5750805b601f850160051c820191505b81811015620003ce57828155600101620003b9565b5050505b505050565b81516001600160401b03811115620003f357620003f362000332565b6200040b8162000404845462000348565b8462000384565b602080601f8311600181146200044357600084156200042a5750858301515b600019600386901b1c1916600185901b178555620003ce565b600085815260208120601f198616915b82811015620004745788860151825594840194600190910190840162000453565b5085821015620004935787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b614c2d80620004b36000396000f3fe60806040526004361061039b5760003560e01c80637c115c4d116101dc578063b7fafcd711610102578063e8a3d485116100a0578063f7d1bb8a1161006f578063f7d1bb8a14610cd9578063fabe178414610cf9578063fcfbc30a14610d19578063fe67a54b14610d2c57600080fd5b8063e8a3d48514610c45578063e985e9c514610c5a578063eba13e4214610ca3578063f2fde38b14610cb957600080fd5b8063c87b56dd116100dc578063c87b56dd14610b36578063d00f2bf814610b56578063d3a8638614610b86578063e85d8da714610bc457600080fd5b8063b7fafcd714610a9e578063b88d4fde14610af6578063c23dc68f14610b0957600080fd5b8063938e3d7b1161017a578063a22cb46511610149578063a22cb465146109cc578063a80a783c146109ec578063aa1b103f14610a74578063b2a8dba114610a7c57600080fd5b8063938e3d7b1461096457806395d89b411461097757806399a2557a1461098c5780639da62c0f146109ac57600080fd5b80638462151c116101b65780638462151c1461087a5780638da5cb5b146108a75780638dc30b70146108c557806392fc99901461095157600080fd5b80637c115c4d146107ac5780637f179dcd146108475780637f766c611461085a57600080fd5b806341a6d37d116102c15780635adfcce21161025f5780636c0360eb1161022e5780636c0360eb1461074257806370a0823114610757578063715018a6146107775780637343d3521461078c57600080fd5b80635adfcce2146106c05780635bbb2177146106e05780636352211e1461070d5780636b64c7691461072d57600080fd5b8063496a698d1161029b578063496a698d146106495780634e71d92d1461066b57806351cff8d91461068057806355f804b3146106a057600080fd5b806341a6d37d146105f457806341f434341461061457806342842e0e1461063657600080fd5b806310782f8f116103395780632a0bbf24116103085780632a0bbf24146105625780632a55205a146105755780633d16e56b146105b4578063413542b5146105d457600080fd5b806310782f8f146104ed57806318160ddd146105205780631998aeef1461054757806323b872dd1461054f57600080fd5b8063081812fc11610375578063081812fc1461044d57806308c79ba814610485578063092305d5146104a5578063095ea7b3146104da57600080fd5b806301ffc9a7146103e157806304634d8d1461041657806306fdde031461042b57600080fd5b366103dc576103a934610d41565b600e546103bf91906001600160801b0316614012565b600e80546001600160801b0319166001600160801b038316179055005b600080fd5b3480156103ed57600080fd5b506104016103fc36600461404f565b610db3565b60405190151581526020015b60405180910390f35b610429610424366004614081565b610dc4565b005b34801561043757600080fd5b50610440610e22565b60405161040d9190614116565b34801561045957600080fd5b5061046d610468366004614129565b610eb4565b6040516001600160a01b03909116815260200161040d565b34801561049157600080fd5b506104296104a0366004614153565b610ef8565b3480156104b157600080fd5b50600e546104c790600160901b900461ffff1681565b60405161ffff909116815260200161040d565b6104296104e836600461417f565b610f0e565b3480156104f957600080fd5b50600f5461050e90600160a01b900460ff1681565b60405160ff909116815260200161040d565b34801561052c57600080fd5b5060015460005403600019015b60405190815260200161040d565b610429610f27565b61042961055d3660046141ab565b61107b565b610429610570366004614203565b6110a6565b34801561058157600080fd5b50610595610590366004614236565b611288565b604080516001600160a01b03909316835260208301919091520161040d565b3480156105c057600080fd5b50600f5461046d906001600160a01b031681565b3480156105e057600080fd5b506104296105ef366004614258565b611336565b34801561060057600080fd5b5061042961060f366004614273565b611355565b34801561062057600080fd5b5061046d6daaeb6d7670e522a718067333cd4e81565b6104296106443660046141ab565b611402565b34801561065557600080fd5b5061065e611427565b60405161040d91906142c8565b34801561067757600080fd5b50610429611548565b34801561068c57600080fd5b5061042961069b366004614273565b611574565b3480156106ac57600080fd5b506104296106bb36600461433b565b61158d565b3480156106cc57600080fd5b506104296106db3660046143be565b611602565b3480156106ec57600080fd5b506107006106fb366004614445565b6118e2565b60405161040d91906144c2565b34801561071957600080fd5b5061046d610728366004614129565b6119ad565b34801561073957600080fd5b506104296119b8565b34801561074e57600080fd5b50610440611be8565b34801561076357600080fd5b50610539610772366004614273565b611c76565b34801561078357600080fd5b50610429611cc4565b34801561079857600080fd5b506104296107a7366004614258565b611cd6565b3480156107b857600080fd5b5061082f6107c7366004614504565b60ff90811660009081526011602090815260408083206001600160a01b0395909516835293815290839020835160608101855290546001600160781b03808216808452600160781b830490911693830193909352600160f01b90049092161515919092015290565b6040516001600160d81b03909116815260200161040d565b610429610855366004614530565b611f33565b34801561086657600080fd5b5061042961087536600461457a565b611f8f565b34801561088657600080fd5b5061089a610895366004614273565b611fe2565b60405161040d91906145cc565b3480156108b357600080fd5b50600a546001600160a01b031661046d565b3480156108d157600080fd5b5061082f6108e0366004614273565b600f5460ff600160a01b909104811660009081526011602090815260408083206001600160a01b03909516835293815290839020835160608101855290546001600160781b03808216808452600160781b830490911693830193909352600160f01b90049092161515919092015290565b61042961095f366004614604565b6120ea565b61042961097236600461433b565b6121e6565b34801561098357600080fd5b506104406121fb565b34801561099857600080fd5b5061089a6109a736600461461f565b61220a565b3480156109b857600080fd5b506104296109c7366004614153565b612391565b3480156109d857600080fd5b506104296109e7366004614662565b612497565b3480156109f857600080fd5b50610a61610a07366004614258565b60106020526000908152604090205460ff808216916101008104821691620100008204169061ffff63010000008204811691600160281b8104909116906001600160401b03600160381b8204811691600160781b90041687565b60405161040d9796959493929190614690565b6104296124ab565b348015610a8857600080fd5b50600e546104c790600160801b900461ffff1681565b348015610aaa57600080fd5b50610ade610ab9366004614258565b60ff16600090815260106020526040902054600160781b90046001600160401b031690565b6040516001600160401b03909116815260200161040d565b610429610b043660046146fb565b6124bd565b348015610b1557600080fd5b50610b29610b24366004614129565b6124ea565b60405161040d91906147da565b348015610b4257600080fd5b50610440610b51366004614129565b612572565b348015610b6257600080fd5b5061050e610b713660046147e8565b60126020526000908152604090205460ff1681565b348015610b9257600080fd5b50600f54600160a01b900460ff16600090815260106020526040902054600160381b90046001600160401b0316610ade565b348015610bd057600080fd5b50610c1d610bdf366004614153565b60116020908152600092835260408084209091529082529020546001600160781b0380821691600160781b810490911690600160f01b900460ff1683565b604080516001600160781b03948516815293909216602084015215159082015260600161040d565b348015610c5157600080fd5b506104406125f5565b348015610c6657600080fd5b50610401610c75366004614803565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610caf57600080fd5b506104c76101f481565b348015610cc557600080fd5b50610429610cd4366004614273565b612604565b348015610ce557600080fd5b50610429610cf4366004614821565b61267a565b348015610d0557600080fd5b50610539610d143660046147e8565b612846565b610429610d27366004614504565b612a00565b348015610d3857600080fd5b50610429612a12565b60006001600160801b03821115610daf5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084015b60405180910390fd5b5090565b6000610dbe82612acc565b92915050565b610dcc612b1a565b610dd68282612b74565b6040516001600160601b03821681526001600160a01b038316907f37523b98c1c6df523d38b204c981070f443e5d875f794f9e45c1cc8ab7b2cd4e906020015b60405180910390a25050565b606060028054610e319061483d565b80601f0160208091040260200160405190810160405280929190818152602001828054610e5d9061483d565b8015610eaa5780601f10610e7f57610100808354040283529160200191610eaa565b820191906000526020600020905b815481529060010190602001808311610e8d57829003601f168201915b5050505050905090565b6000610ebf82612c71565b610edc576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b610f00612b1a565b610f0a8282612ca6565b5050565b81610f1881612f89565b610f228383613042565b505050565b610f2f6130e2565b6000610f39611427565b9050600181602001516004811115610f5357610f53614290565b14610f71576040516386e0ca7f60e01b815260040160405180910390fd5b805160ff16600090815260116020908152604080832033845290915290205460a08201516001600160781b0390911690610fab3483614877565b9150806001600160401b0316821015610fe9576040516330f9447360e11b8152600481018390526001600160401b0382166024820152604401610da6565b82516040805134815260208101859052339260ff16917fa7482bf206d390208a853677d417d96e604b5a4e8f5e2e84fde01c580062ae01910160405180910390a361103382613102565b925160ff166000908152601160209081526040808320338452909152902080546effffffffffffffffffffffffffffff19166001600160781b03909416939093179092555050565b826001600160a01b03811633146110955761109533612f89565b6110a084848461316b565b50505050565b6110ae612b1a565b60ff8083166000908152601060209081526040808320815160e08101909252805480861683529394919390928401916101009091041660048111156110f5576110f5614290565b600481111561110657611106614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a0909301929092528201519192501660000361119157604051630f88cdf960e11b815260ff84166004820152602401610da6565b6002816020015160048111156111a9576111a9614290565b146111cd5780602001516040516302bb7f1160e51b8152600401610da6919061488a565b60a08101516001600160401b03808216908416101561121257604051635d3144b360e01b81526001600160401b03808516600483015282166024820152604401610da6565b60ff8416600081815260106020908152604091829020805467ffffffffffffffff60781b1916600160781b6001600160401b0389169081029190911790915591519182527f9968e5953e3a2743f99ce40212438cfd1f1c35e05af7149c1459d4c2b50ba32991015b60405180910390a250505050565b60008281526009602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916112fd5750604080518082019091526008546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061131c906001600160601b031687614898565b61132691906148c5565b91519350909150505b9250929050565b61133e6132fc565b6113483382613355565b6113526001600d55565b50565b61135d612b1a565b6001600160a01b03811661138457604051630667ee6560e21b815260040160405180910390fd5b600f546001600160a01b0316156113ae57604051633c6b761160e21b815260040160405180910390fd5b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f151a958bf02236a45078aa305187815ed0d0a1648b8196d5ffdc07b1ed85e0cc9060200160405180910390a150565b826001600160a01b038116331461141c5761141c33612f89565b6110a08484846138a0565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810191909152600f54600160a01b900460ff1660000361148d5760405163568ca25760e01b815260040160405180910390fd5b600f5460ff600160a01b9091048116600090815260106020908152604091829020825160e0810190935280548085168452929390929184019161010090041660048111156114dd576114dd614290565b60048111156114ee576114ee614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b9091041660a090910152919050565b6115506132fc565b600f54611568903390600160a01b900460ff16613355565b6115726001600d55565b565b61157c612b1a565b6115846132fc565b611348816138bb565b611595612b1a565b60008190036115b7576040516305442caf60e41b815260040160405180910390fd5b600b6115c482848361491f565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f682826040516115f69291906149de565b60405180910390a15050565b61160a612b1a565b61ffff8316158061162257506001600160401b038116155b8061162e575060ff8216155b8061163f57508160ff168361ffff16105b1561165d57604051631d0b451360e01b815260040160405180910390fd5b600e546127109061ffff600160801b820481169161168491600160901b9091041686614a0d565b61168e9190614a0d565b61ffff1611156116b157604051638a164f6360e01b815260040160405180910390fd5b600f54600160a01b900460ff16156117075760006116cd611427565b90506000816020015160048111156116e7576116e7614290565b0361170557604051637a5071c360e01b815260040160405180910390fd5b505b600f5460009061172290600160a01b900460ff166001614a28565b6040805160e08101825260ff838116808352600060208085018281528a85168688015261ffff8c166060870181905260808701526001600160401b038a1660a087015260c08601839052928252601090529390932082518154921660ff19831681178255935194955091939192839161ffff1916176101008360048111156117ac576117ac614290565b0217905550604082015181546060840151608085015160a086015160c09096015164ffffff0000199093166201000060ff9095169490940264ffff000000191693909317630100000061ffff92831602176effffffffffffffffffff00000000001916600160281b9382169390930267ffffffffffffffff60381b191692909217600160381b6001600160401b03958616021767ffffffffffffffff60781b1916600160781b9490911693909302929092179055600e54611876918691600160901b900416614a0d565b600e805461ffff60901b1916600160901b61ffff9384160217905560408051918616825260ff85811660208401526001600160401b038516918301919091528216907f5a95bbb1e3343dc606cca217733c02ae8f07a9729f050fa28163666f74591a169060600161127a565b6060816000816001600160401b038111156118ff576118ff6146e5565b60405190808252806020026020018201604052801561195157816020015b60408051608081018252600080825260208083018290529282018190526060820152825260001990920191018161191d5790505b50905060005b8281146119a45761197f86868381811061197357611973614a41565b905060200201356124ea565b82828151811061199157611991614a41565b6020908102919091010152600101611957565b50949350505050565b6000610dbe826139db565b6119c0612b1a565b600f546001600160a01b03166119e957604051630427851560e11b815260040160405180910390fd5b600f54600090611a0490600160a01b900460ff166001614a28565b60ff8082166000908152601060209081526040808320815160e08101909252805480861683529596509294909391840191610100909104166004811115611a4d57611a4d614290565b6004811115611a5e57611a5e614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a09093019290925282015191925016600003611ae957604051630f88cdf960e11b815260ff83166004820152602401610da6565b600f54600160a01b900460ff1615611b51576002600f5460ff600160a01b90910481166000908152601060205260409020546101009004166004811115611b3257611b32614290565b1015611b5157604051637a5071c360e01b815260040160405180910390fd5b600f805460ff60a01b1916600160a01b60ff851602179055600081602001516004811115611b8157611b81614290565b14611b9f5760405163bf2176c560e01b815260040160405180910390fd5b60ff8216600081815260106020526040808220805461ff001916610100179055517f0a237b7489ab9c5d93a843b86f3936ab88b43c2cee7a9cced35fc31c22c0bfc49190a25050565b600b8054611bf59061483d565b80601f0160208091040260200160405190810160405280929190818152602001828054611c219061483d565b8015611c6e5780601f10611c4357610100808354040283529160200191611c6e565b820191906000526020600020905b815481529060010190602001808311611c5157829003601f168201915b505050505081565b60006001600160a01b038216611c9f576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b611ccc612b1a565b6115726000613a4a565b611cde612b1a565b60ff8082166000908152601060209081526040808320815160e0810190925280548086168352939491939092840191610100909104166004811115611d2557611d25614290565b6004811115611d3657611d36614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a09093019290925282015191925016600003611dc157604051630f88cdf960e11b815260ff83166004820152602401610da6565b600381602001516004811115611dd957611dd9614290565b14611dfd5780602001516040516355c3543b60e01b8152600401610da6919061488a565b6004602082018190525060ff808316600090815260106020908152604090912083518154931660ff1984168117825591840151849391929091839161ffff1990911617610100836004811115611e5557611e55614290565b021790555060408281015182546060850151608086015160a087015160c09097015164ffffff0000199093166201000060ff9586160264ffff000000191617630100000061ffff93841602176effffffffffffffffffff00000000001916600160281b929091169190910267ffffffffffffffff60381b191617600160381b6001600160401b03968716021767ffffffffffffffff60781b1916600160781b9590911694909402939093179091555190831681527fb599d581a96932e4ef07cc1bcb7bcd81c5b13cfefd3aeb52d55f45592e5d2bc7906020016115f6565b611f3b612b1a565b6000825b611f7385858461ffff16818110611f5857611f58614a41565b9050602002016020810190611f6d9190614273565b84613355565b8160010191508061ffff168261ffff1610611f3f575050505050565b611f97612b1a565b8060005b611fce8585858460ff16818110611fb457611fb4614a41565b9050602002016020810190611fc99190614273565b612ca6565b60010160ff81168211611f9b575050505050565b60606000806000611ff285611c76565b90506000816001600160401b0381111561200e5761200e6146e5565b604051908082528060200260200182016040528015612037578160200160208202803683370190505b50905061206460408051608081018252600080825260208201819052918101829052606081019190915290565b60015b8386146120de5761207781613a9c565b915081604001516120d65781516001600160a01b03161561209757815194505b876001600160a01b0316856001600160a01b0316036120d657808387806001019850815181106120c9576120c9614a41565b6020026020010181815250505b600101612067565b50909695505050505050565b6120f2612b1a565b60006120fc611427565b905060018160200151600481111561211657612116614290565b111561213b5780602001516040516327eea1cf60e01b8152600401610da6919061488a565b816001600160401b03166000036121705760405163045ae4e560e51b81526001600160401b0383166004820152602401610da6565b805160ff908116600090815260106020908152604091829020805467ffffffffffffffff60381b1916600160381b6001600160401b038816908102919091179091558451925190815291909216917f1d86dd66b2affff705c4d7589166f91a3f3a4ab1f6bbd9e48365d43520a5f66c9101610e16565b6121ee612b1a565b600c610f2282848361491f565b606060038054610e319061483d565b606081831061222c57604051631960ccad60e11b815260040160405180910390fd5b60008061223860005490565b9050600185101561224857600194505b80841115612254578093505b600061225f87611c76565b90508486101561227e5785850381811015612278578091505b50612282565b5060005b6000816001600160401b0381111561229c5761229c6146e5565b6040519080825280602002602001820160405280156122c5578160200160208202803683370190505b509050816000036122db57935061238a92505050565b60006122e6886124ea565b9050600081604001516122f7575080515b885b8881141580156123095750848714155b1561237e5761231781613a9c565b925082604001516123765782516001600160a01b03161561233757825191505b8a6001600160a01b0316826001600160a01b031603612376578084888060010199508151811061236957612369614a41565b6020026020010181815250505b6001016122f9565b50505092835250909150505b9392505050565b612399612b1a565b600e546000906123b89060ff851690600160801b900461ffff16614a0d565b90506101f461ffff821611156123ef57604051630a8aa1bd60e11b815261ffff821660048201526101f46024820152604401610da6565b61271060ff84166124036000546000190190565b61240d9190614877565b111561242c57604051638a164f6360e01b815260040160405180910390fd5b600e805461ffff60801b1916600160801b61ffff841602179055604080516001600160a01b038416815260ff851660208201527f99dadef9a2d51e6aded57010cfa92387eb027f842185e7ea95b65c55b6058c68910160405180910390a1610f22828460ff16613ad8565b816124a181612f89565b610f228383613bb2565b6124b3612b1a565b6115726000600855565b836001600160a01b03811633146124d7576124d733612f89565b6124e385858585613c1e565b5050505050565b604080516080810182526000808252602082018190529181018290526060810191909152604080516080810182526000808252602082018190529181018290526060810191909152600183108061254357506000548310155b1561254e5792915050565b61255783613a9c565b90508060400151156125695792915050565b61238a83613c62565b606061257d82612c71565b61259a57604051630a14c4b560e41b815260040160405180910390fd5b60006125a4613c97565b905080516000036125c4576040518060200160405280600081525061238a565b806125ce84613ca6565b6040516020016125df929190614a57565b6040516020818303038152906040529392505050565b6060600c8054610e319061483d565b61260c612b1a565b6001600160a01b0381166126715760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610da6565b61135281613a4a565b612682612b1a565b60ff8083166000908152601060209081526040808320815160e08101909252805480861683529394919390928401916101009091041660048111156126c9576126c9614290565b60048111156126da576126da614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a0909301929092528201519192501660000361276557604051630f88cdf960e11b815260ff84166004820152602401610da6565b60028160200151600481111561277d5761277d614290565b146127a15780602001516040516302bb7f1160e51b8152600401610da6919061488a565b8060c001516001600160401b03166000036127cf5760405163c0758c9b60e01b815260040160405180910390fd5b8060c001516001600160401b031682146127fc57604051632fad637960e21b815260040160405180910390fd5b60ff8316600081815260106020526040808220805461ff001916610300179055517f6a5530a778c16d9236227755ff6776c2e05c79130ccf99fd5203b3898bfd76fe9190a2505050565b60006128506132fc565b61285d8261ffff16612c71565b61288057604051639881108f60e01b815261ffff83166004820152602401610da6565b3361288e61ffff84166119ad565b6001600160a01b0316146128c157604051632489e9fd60e21b815233600482015261ffff83166024820152604401610da6565b61ffff821660009081526012602090815260408083205460ff9081168085526010909352922054909161010090910416600481600481111561290557612905614290565b146129235760405163decab34360e01b815260040160405180910390fd5b6129328461ffff166000613cea565b600f54604051630cc7bd4760e21b81523360048201526001600160a01b0390911690600090829063331ef51c906024016020604051808303816000875af1158015612981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a59190614a86565b604080513381526020810183905261ffff89168183015290519192507f29974912e7d9057e5170b2879573dadfc0d91c35f15c73785ee366490ee386f6919081900360600190a193505050506129fb6001600d55565b919050565b612a08612b1a565b610f0a8282613355565b612a1a612b1a565b6001600f5460ff600160a01b90910481166000908152601060205260409020546101009004166004811115612a5157612a51614290565b14612a6f576040516386e0ca7f60e01b815260040160405180910390fd5b600f8054600160a01b9081900460ff908116600090815260106020526040808220805461ff001916610200179055935493519290930416917f788af3986a665e7e8ae7723656fb1c55205619ac0026e1540108d1ede59548fe91a2565b60006301ffc9a760e01b6001600160e01b031983161480612afd57506380ac58cd60e01b6001600160e01b03198316145b80610dbe5750506001600160e01b031916635b5e139f60e01b1490565b600a546001600160a01b031633146115725760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610da6565b6127106001600160601b0382161115612be25760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610da6565b6001600160a01b038216612c385760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610da6565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600855565b600081600111158015612c85575060005482105b8015610dbe575050600090815260046020526040902054600160e01b161590565b6001600160a01b038116612ccd5760405163d9b87c0f60e01b815260040160405180910390fd5b60ff8083166000908152601060209081526040808320815160e0810190925280548086168352939491939092840191610100909104166004811115612d1457612d14614290565b6004811115612d2557612d25614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b909104811660a09092019190915260c082015191925016600003612da75760405163c0758c9b60e01b815260040160405180910390fd5b60ff80841660009081526011602090815260408083206001600160a01b0387168452825291829020825160608101845290546001600160781b038082168352600160781b820416928201839052600160f01b900490931615159183019190915215612e3957604051630dc21eb360e41b815260ff851660048201526001600160a01b0384166024820152604401610da6565b6000612e6482600001516001600160781b03168460c001516001600160401b03168560400151613e19565b905080156124e357612e7581613102565b60ff861660009081526011602090815260408083206001600160a01b038916808552925280832080546001600160781b0395909516600160781b02600160781b600160f01b031990951694909417909355915190919083908381818185875af1925050503d8060008114612f05576040519150601f19603f3d011682016040523d82523d6000602084013e612f0a565b606091505b5050905080612f3e576040516357b9d85960e11b81526001600160a01b038616600482015260248101839052604401610da6565b846001600160a01b03167fe309aa15fd2f6bd8a58603632508694071e7d35e967bdbb827926e429b7ef34d83604051612f7991815260200190565b60405180910390a2505050505050565b6daaeb6d7670e522a718067333cd4e3b1561135257604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301a9190614a9f565b61135257604051633b79c77360e21b81526001600160a01b0382166004820152602401610da6565b600061304d826119ad565b9050336001600160a01b03821614613086576130698133610c75565b613086576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b33321461157257604051633416a38560e01b815260040160405180910390fd5b60006001600160781b03821115610daf5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663230206269747360c81b6064820152608401610da6565b6000613176826139db565b9050836001600160a01b0316816001600160a01b0316146131a95760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546131d58187335b6001600160a01b039081169116811491141790565b613200576131e38633610c75565b61320057604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661322757604051633a954ecd60e21b815260040160405180910390fd5b801561323257600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036132c4576001840160008181526004602052604081205490036132c25760005481146132c25760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020614bd883398151915260405160405180910390a45b505050505050565b6002600d540361334e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610da6565b6002600d55565b6001600160a01b03821661337c57604051630667ee6560e21b815260040160405180910390fd5b60ff8082166000908152601060209081526040808320815160e08101909252805480861683529394919390928401916101009091041660048111156133c3576133c3614290565b60048111156133d4576133d4614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a0909301929092528201519192501660000361345f57604051630f88cdf960e11b815260ff83166004820152602401610da6565b60038160200151600481111561347757613477614290565b101561349f578060200151600360405163fafc2a6b60e01b8152600401610da6929190614abc565b60ff80831660009081526011602090815260408083206001600160a01b0388168452825291829020825160608101845290546001600160781b038082168352600160781b82041692820192909252600160f01b9091049092161580159183019190915261352a57604051632058b6db60e01b81526001600160a01b0385166004820152602401610da6565b60ff831660009081526011602090815260408083206001600160a01b03881684529091528120805460ff60f01b1916600160f01b1790558151906001600160781b038216900361359857604051636a6ae80d60e01b81526001600160a01b0386166004820152602401610da6565b60006135dd6135cf8560c001516001600160401b0316846135b99190614ad7565b6001600160781b0316866040015160ff16613e51565b856080015161ffff16613e51565b905060008460c001516001600160401b0316826135fa9190614afd565b905081156136d657608085015160ff87166000908152601060205260408120805461ffff938416869003909316600160281b0266ffff00000000001990931692909217909155600e80546001600160801b038082168501166001600160801b03199091161790556136816136716000546000190190565b61367c906001614877565b613e67565b905060005b876012600061369860ff851686614a0d565b61ffff1681526020810191909152604001600020805460ff191660ff9283161790556001919091019081168411613686576136d38985613ad8565b50505b600084602001516001600160781b031682856001600160781b03166136fb9190614b28565b6137059190614b28565b90506001600160801b03811615613835576040516001600160801b03821681526001600160a01b038916907fe309aa15fd2f6bd8a58603632508694071e7d35e967bdbb827926e429b7ef34d9060200160405180910390a261376f816001600160801b0316613102565b60ff881660009081526011602090815260408083206001600160a01b038d16808552925280832080546001600160781b0395909516600160781b02600160781b600160f01b03199095169490941790935591519091906001600160801b038416908381818185875af1925050503d8060008114613808576040519150601f19603f3d011682016040523d82523d6000602084013e61380d565b606091505b50509050806138335788826040516357b9d85960e11b8152600401610da6929190614b48565b505b604080516001600160a01b038a1681526001600160781b03861660208201529081018490526001600160801b03821660608201527f9cdcf2f7714cca3508c7f0110b04a90a80a3a8dd0e35de99689db74d28c5383e9060800160405180910390a15050505050505050565b610f22838383604051806020016040528060008152506124bd565b6001600160a01b0381166138e25760405163160f651560e01b815260040160405180910390fd5b600e546001600160801b03166000819003613910576040516367e3990d60e01b815260040160405180910390fd5b600e80546001600160801b03191690556040517feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d906139529084908490614b48565b60405180910390a16000826001600160a01b0316826001600160801b031660405160006040518083038185875af1925050503d80600081146139b0576040519150601f19603f3d011682016040523d82523d6000602084013e6139b5565b606091505b5050905080610f225782826040516351134c8960e11b8152600401610da6929190614b48565b60008180600111613a3157600054811015613a315760008181526004602052604081205490600160e01b82169003613a2f575b8060000361238a575060001901600081815260046020526040902054613a0e565b505b604051636f96cda160e11b815260040160405180910390fd5b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610dbe90613eca565b6000805490829003613afd5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b17831790558284019083908390600080516020614bd88339815191528180a4600183015b818114613b885780836000600080516020614bd8833981519152600080a4600101613b62565b5081600003613ba957604051622e076360e81b815260040160405180910390fd5b60005550505050565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b613c2984848461107b565b6001600160a01b0383163b156110a057613c4584848484613f11565b6110a0576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610dbe613c92836139db565b613eca565b6060600b8054610e319061483d565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480613cc05750819003601f19909101908152919050565b6000613cf5836139db565b905080600080613d1386600090815260066020526040902080549091565b915091508415613d5357613d288184336131c0565b613d5357613d368333610c75565b613d5357604051632ce44b5f60e11b815260040160405180910390fd5b8015613d5e57600082555b6001600160a01b038316600081815260056020526040902080546001600160801b030190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b85169003613de357600186016000818152600460205260408120549003613de1576000548114613de15760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020614bd8833981519152908390a45050600180548101905550505050565b600080613e32613e2985876148c5565b8460ff16613e51565b9050613e3e8482614898565b613e489086614b6a565b95945050505050565b6000818310613e60578161238a565b5090919050565b600061ffff821115610daf5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201526536206269747360d01b6064820152608401610da6565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613f46903390899088908890600401614b7d565b6020604051808303816000875af1925050508015613f81575060408051601f3d908101601f19168201909252613f7e91810190614bba565b60015b613fdf573d808015613faf576040519150601f19603f3d011682016040523d82523d6000602084013e613fb4565b606091505b508051600003613fd7576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b634e487b7160e01b600052601160045260246000fd5b6001600160801b0381811683821601908082111561403257614032613ffc565b5092915050565b6001600160e01b03198116811461135257600080fd5b60006020828403121561406157600080fd5b813561238a81614039565b6001600160a01b038116811461135257600080fd5b6000806040838503121561409457600080fd5b823561409f8161406c565b915060208301356001600160601b03811681146140bb57600080fd5b809150509250929050565b60005b838110156140e15781810151838201526020016140c9565b50506000910152565b600081518084526141028160208601602086016140c6565b601f01601f19169290920160200192915050565b60208152600061238a60208301846140ea565b60006020828403121561413b57600080fd5b5035919050565b803560ff811681146129fb57600080fd5b6000806040838503121561416657600080fd5b61416f83614142565b915060208301356140bb8161406c565b6000806040838503121561419257600080fd5b823561419d8161406c565b946020939093013593505050565b6000806000606084860312156141c057600080fd5b83356141cb8161406c565b925060208401356141db8161406c565b929592945050506040919091013590565b80356001600160401b03811681146129fb57600080fd5b6000806040838503121561421657600080fd5b61421f83614142565b915061422d602084016141ec565b90509250929050565b6000806040838503121561424957600080fd5b50508035926020909101359150565b60006020828403121561426a57600080fd5b61238a82614142565b60006020828403121561428557600080fd5b813561238a8161406c565b634e487b7160e01b600052602160045260246000fd5b600581106142c457634e487b7160e01b600052602160045260246000fd5b9052565b815160ff16815260208083015160e08301916142e6908401826142a6565b5060ff6040840151166040830152606083015161ffff8082166060850152806080860151166080850152505060a08301516001600160401b0380821660a08501528060c08601511660c0850152505092915050565b6000806020838503121561434e57600080fd5b82356001600160401b038082111561436557600080fd5b818501915085601f83011261437957600080fd5b81358181111561438857600080fd5b86602082850101111561439a57600080fd5b60209290920196919550909350505050565b803561ffff811681146129fb57600080fd5b6000806000606084860312156143d357600080fd5b6143dc846143ac565b92506143ea60208501614142565b91506143f8604085016141ec565b90509250925092565b60008083601f84011261441357600080fd5b5081356001600160401b0381111561442a57600080fd5b6020830191508360208260051b850101111561132f57600080fd5b6000806020838503121561445857600080fd5b82356001600160401b0381111561446e57600080fd5b61447a85828601614401565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b818110156120de576144f1838551614486565b92840192608092909201916001016144de565b6000806040838503121561451757600080fd5b82356145228161406c565b915061422d60208401614142565b60008060006040848603121561454557600080fd5b83356001600160401b0381111561455b57600080fd5b61456786828701614401565b90945092506143f8905060208501614142565b60008060006040848603121561458f57600080fd5b61459884614142565b925060208401356001600160401b038111156145b357600080fd5b6145bf86828701614401565b9497909650939450505050565b6020808252825182820181905260009190848201906040850190845b818110156120de578351835292840192918401916001016145e8565b60006020828403121561461657600080fd5b61238a826141ec565b60008060006060848603121561463457600080fd5b833561463f8161406c565b95602085013595506040909401359392505050565b801515811461135257600080fd5b6000806040838503121561467557600080fd5b82356146808161406c565b915060208301356140bb81614654565b60ff8816815260e081016146a760208301896142a6565b60ff96909616604082015261ffff94851660608201529290931660808301526001600160401b0390811660a083015290911660c09091015292915050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561471157600080fd5b843561471c8161406c565b9350602085013561472c8161406c565b92506040850135915060608501356001600160401b038082111561474f57600080fd5b818701915087601f83011261476357600080fd5b813581811115614775576147756146e5565b604051601f8201601f19908116603f0116810190838211818310171561479d5761479d6146e5565b816040528281528a60208487010111156147b657600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60808101610dbe8284614486565b6000602082840312156147fa57600080fd5b61238a826143ac565b6000806040838503121561481657600080fd5b823561416f8161406c565b6000806040838503121561483457600080fd5b61419d83614142565b600181811c9082168061485157607f821691505b60208210810361487157634e487b7160e01b600052602260045260246000fd5b50919050565b80820180821115610dbe57610dbe613ffc565b60208101610dbe82846142a6565b8082028115828204841417610dbe57610dbe613ffc565b634e487b7160e01b600052601260045260246000fd5b6000826148d4576148d46148af565b500490565b601f821115610f2257600081815260208120601f850160051c810160208610156149005750805b601f850160051c820191505b818110156132f45782815560010161490c565b6001600160401b03831115614936576149366146e5565b61494a83614944835461483d565b836148d9565b6000601f84116001811461497e57600085156149665750838201355b600019600387901b1c1916600186901b1783556124e3565b600083815260209020601f19861690835b828110156149af578685013582556020948501946001909201910161498f565b50868210156149cc5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b61ffff81811683821601908082111561403257614032613ffc565b60ff8181168382160190811115610dbe57610dbe613ffc565b634e487b7160e01b600052603260045260246000fd5b60008351614a698184602088016140c6565b835190830190614a7d8183602088016140c6565b01949350505050565b600060208284031215614a9857600080fd5b5051919050565b600060208284031215614ab157600080fd5b815161238a81614654565b60408101614aca82856142a6565b61238a60208301846142a6565b60006001600160781b0380841680614af157614af16148af565b92169190910492915050565b6001600160801b03818116838216028082169190828114614b2057614b20613ffc565b505092915050565b6001600160801b0382811682821603908082111561403257614032613ffc565b6001600160a01b039290921682526001600160801b0316602082015260400190565b81810381811115610dbe57610dbe613ffc565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614bb0908301846140ea565b9695505050505050565b600060208284031215614bcc57600080fd5b815161238a8161403956feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212201df92ada0957653d3dea83c3197b354407d485fe154fea7ace6f434da4642c2b64736f6c63430008140033

Deployed Bytecode

0x60806040526004361061039b5760003560e01c80637c115c4d116101dc578063b7fafcd711610102578063e8a3d485116100a0578063f7d1bb8a1161006f578063f7d1bb8a14610cd9578063fabe178414610cf9578063fcfbc30a14610d19578063fe67a54b14610d2c57600080fd5b8063e8a3d48514610c45578063e985e9c514610c5a578063eba13e4214610ca3578063f2fde38b14610cb957600080fd5b8063c87b56dd116100dc578063c87b56dd14610b36578063d00f2bf814610b56578063d3a8638614610b86578063e85d8da714610bc457600080fd5b8063b7fafcd714610a9e578063b88d4fde14610af6578063c23dc68f14610b0957600080fd5b8063938e3d7b1161017a578063a22cb46511610149578063a22cb465146109cc578063a80a783c146109ec578063aa1b103f14610a74578063b2a8dba114610a7c57600080fd5b8063938e3d7b1461096457806395d89b411461097757806399a2557a1461098c5780639da62c0f146109ac57600080fd5b80638462151c116101b65780638462151c1461087a5780638da5cb5b146108a75780638dc30b70146108c557806392fc99901461095157600080fd5b80637c115c4d146107ac5780637f179dcd146108475780637f766c611461085a57600080fd5b806341a6d37d116102c15780635adfcce21161025f5780636c0360eb1161022e5780636c0360eb1461074257806370a0823114610757578063715018a6146107775780637343d3521461078c57600080fd5b80635adfcce2146106c05780635bbb2177146106e05780636352211e1461070d5780636b64c7691461072d57600080fd5b8063496a698d1161029b578063496a698d146106495780634e71d92d1461066b57806351cff8d91461068057806355f804b3146106a057600080fd5b806341a6d37d146105f457806341f434341461061457806342842e0e1461063657600080fd5b806310782f8f116103395780632a0bbf24116103085780632a0bbf24146105625780632a55205a146105755780633d16e56b146105b4578063413542b5146105d457600080fd5b806310782f8f146104ed57806318160ddd146105205780631998aeef1461054757806323b872dd1461054f57600080fd5b8063081812fc11610375578063081812fc1461044d57806308c79ba814610485578063092305d5146104a5578063095ea7b3146104da57600080fd5b806301ffc9a7146103e157806304634d8d1461041657806306fdde031461042b57600080fd5b366103dc576103a934610d41565b600e546103bf91906001600160801b0316614012565b600e80546001600160801b0319166001600160801b038316179055005b600080fd5b3480156103ed57600080fd5b506104016103fc36600461404f565b610db3565b60405190151581526020015b60405180910390f35b610429610424366004614081565b610dc4565b005b34801561043757600080fd5b50610440610e22565b60405161040d9190614116565b34801561045957600080fd5b5061046d610468366004614129565b610eb4565b6040516001600160a01b03909116815260200161040d565b34801561049157600080fd5b506104296104a0366004614153565b610ef8565b3480156104b157600080fd5b50600e546104c790600160901b900461ffff1681565b60405161ffff909116815260200161040d565b6104296104e836600461417f565b610f0e565b3480156104f957600080fd5b50600f5461050e90600160a01b900460ff1681565b60405160ff909116815260200161040d565b34801561052c57600080fd5b5060015460005403600019015b60405190815260200161040d565b610429610f27565b61042961055d3660046141ab565b61107b565b610429610570366004614203565b6110a6565b34801561058157600080fd5b50610595610590366004614236565b611288565b604080516001600160a01b03909316835260208301919091520161040d565b3480156105c057600080fd5b50600f5461046d906001600160a01b031681565b3480156105e057600080fd5b506104296105ef366004614258565b611336565b34801561060057600080fd5b5061042961060f366004614273565b611355565b34801561062057600080fd5b5061046d6daaeb6d7670e522a718067333cd4e81565b6104296106443660046141ab565b611402565b34801561065557600080fd5b5061065e611427565b60405161040d91906142c8565b34801561067757600080fd5b50610429611548565b34801561068c57600080fd5b5061042961069b366004614273565b611574565b3480156106ac57600080fd5b506104296106bb36600461433b565b61158d565b3480156106cc57600080fd5b506104296106db3660046143be565b611602565b3480156106ec57600080fd5b506107006106fb366004614445565b6118e2565b60405161040d91906144c2565b34801561071957600080fd5b5061046d610728366004614129565b6119ad565b34801561073957600080fd5b506104296119b8565b34801561074e57600080fd5b50610440611be8565b34801561076357600080fd5b50610539610772366004614273565b611c76565b34801561078357600080fd5b50610429611cc4565b34801561079857600080fd5b506104296107a7366004614258565b611cd6565b3480156107b857600080fd5b5061082f6107c7366004614504565b60ff90811660009081526011602090815260408083206001600160a01b0395909516835293815290839020835160608101855290546001600160781b03808216808452600160781b830490911693830193909352600160f01b90049092161515919092015290565b6040516001600160d81b03909116815260200161040d565b610429610855366004614530565b611f33565b34801561086657600080fd5b5061042961087536600461457a565b611f8f565b34801561088657600080fd5b5061089a610895366004614273565b611fe2565b60405161040d91906145cc565b3480156108b357600080fd5b50600a546001600160a01b031661046d565b3480156108d157600080fd5b5061082f6108e0366004614273565b600f5460ff600160a01b909104811660009081526011602090815260408083206001600160a01b03909516835293815290839020835160608101855290546001600160781b03808216808452600160781b830490911693830193909352600160f01b90049092161515919092015290565b61042961095f366004614604565b6120ea565b61042961097236600461433b565b6121e6565b34801561098357600080fd5b506104406121fb565b34801561099857600080fd5b5061089a6109a736600461461f565b61220a565b3480156109b857600080fd5b506104296109c7366004614153565b612391565b3480156109d857600080fd5b506104296109e7366004614662565b612497565b3480156109f857600080fd5b50610a61610a07366004614258565b60106020526000908152604090205460ff808216916101008104821691620100008204169061ffff63010000008204811691600160281b8104909116906001600160401b03600160381b8204811691600160781b90041687565b60405161040d9796959493929190614690565b6104296124ab565b348015610a8857600080fd5b50600e546104c790600160801b900461ffff1681565b348015610aaa57600080fd5b50610ade610ab9366004614258565b60ff16600090815260106020526040902054600160781b90046001600160401b031690565b6040516001600160401b03909116815260200161040d565b610429610b043660046146fb565b6124bd565b348015610b1557600080fd5b50610b29610b24366004614129565b6124ea565b60405161040d91906147da565b348015610b4257600080fd5b50610440610b51366004614129565b612572565b348015610b6257600080fd5b5061050e610b713660046147e8565b60126020526000908152604090205460ff1681565b348015610b9257600080fd5b50600f54600160a01b900460ff16600090815260106020526040902054600160381b90046001600160401b0316610ade565b348015610bd057600080fd5b50610c1d610bdf366004614153565b60116020908152600092835260408084209091529082529020546001600160781b0380821691600160781b810490911690600160f01b900460ff1683565b604080516001600160781b03948516815293909216602084015215159082015260600161040d565b348015610c5157600080fd5b506104406125f5565b348015610c6657600080fd5b50610401610c75366004614803565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610caf57600080fd5b506104c76101f481565b348015610cc557600080fd5b50610429610cd4366004614273565b612604565b348015610ce557600080fd5b50610429610cf4366004614821565b61267a565b348015610d0557600080fd5b50610539610d143660046147e8565b612846565b610429610d27366004614504565b612a00565b348015610d3857600080fd5b50610429612a12565b60006001600160801b03821115610daf5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663238206269747360c81b60648201526084015b60405180910390fd5b5090565b6000610dbe82612acc565b92915050565b610dcc612b1a565b610dd68282612b74565b6040516001600160601b03821681526001600160a01b038316907f37523b98c1c6df523d38b204c981070f443e5d875f794f9e45c1cc8ab7b2cd4e906020015b60405180910390a25050565b606060028054610e319061483d565b80601f0160208091040260200160405190810160405280929190818152602001828054610e5d9061483d565b8015610eaa5780601f10610e7f57610100808354040283529160200191610eaa565b820191906000526020600020905b815481529060010190602001808311610e8d57829003601f168201915b5050505050905090565b6000610ebf82612c71565b610edc576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b610f00612b1a565b610f0a8282612ca6565b5050565b81610f1881612f89565b610f228383613042565b505050565b610f2f6130e2565b6000610f39611427565b9050600181602001516004811115610f5357610f53614290565b14610f71576040516386e0ca7f60e01b815260040160405180910390fd5b805160ff16600090815260116020908152604080832033845290915290205460a08201516001600160781b0390911690610fab3483614877565b9150806001600160401b0316821015610fe9576040516330f9447360e11b8152600481018390526001600160401b0382166024820152604401610da6565b82516040805134815260208101859052339260ff16917fa7482bf206d390208a853677d417d96e604b5a4e8f5e2e84fde01c580062ae01910160405180910390a361103382613102565b925160ff166000908152601160209081526040808320338452909152902080546effffffffffffffffffffffffffffff19166001600160781b03909416939093179092555050565b826001600160a01b03811633146110955761109533612f89565b6110a084848461316b565b50505050565b6110ae612b1a565b60ff8083166000908152601060209081526040808320815160e08101909252805480861683529394919390928401916101009091041660048111156110f5576110f5614290565b600481111561110657611106614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a0909301929092528201519192501660000361119157604051630f88cdf960e11b815260ff84166004820152602401610da6565b6002816020015160048111156111a9576111a9614290565b146111cd5780602001516040516302bb7f1160e51b8152600401610da6919061488a565b60a08101516001600160401b03808216908416101561121257604051635d3144b360e01b81526001600160401b03808516600483015282166024820152604401610da6565b60ff8416600081815260106020908152604091829020805467ffffffffffffffff60781b1916600160781b6001600160401b0389169081029190911790915591519182527f9968e5953e3a2743f99ce40212438cfd1f1c35e05af7149c1459d4c2b50ba32991015b60405180910390a250505050565b60008281526009602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916112fd5750604080518082019091526008546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061131c906001600160601b031687614898565b61132691906148c5565b91519350909150505b9250929050565b61133e6132fc565b6113483382613355565b6113526001600d55565b50565b61135d612b1a565b6001600160a01b03811661138457604051630667ee6560e21b815260040160405180910390fd5b600f546001600160a01b0316156113ae57604051633c6b761160e21b815260040160405180910390fd5b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f151a958bf02236a45078aa305187815ed0d0a1648b8196d5ffdc07b1ed85e0cc9060200160405180910390a150565b826001600160a01b038116331461141c5761141c33612f89565b6110a08484846138a0565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810191909152600f54600160a01b900460ff1660000361148d5760405163568ca25760e01b815260040160405180910390fd5b600f5460ff600160a01b9091048116600090815260106020908152604091829020825160e0810190935280548085168452929390929184019161010090041660048111156114dd576114dd614290565b60048111156114ee576114ee614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b9091041660a090910152919050565b6115506132fc565b600f54611568903390600160a01b900460ff16613355565b6115726001600d55565b565b61157c612b1a565b6115846132fc565b611348816138bb565b611595612b1a565b60008190036115b7576040516305442caf60e41b815260040160405180910390fd5b600b6115c482848361491f565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f682826040516115f69291906149de565b60405180910390a15050565b61160a612b1a565b61ffff8316158061162257506001600160401b038116155b8061162e575060ff8216155b8061163f57508160ff168361ffff16105b1561165d57604051631d0b451360e01b815260040160405180910390fd5b600e546127109061ffff600160801b820481169161168491600160901b9091041686614a0d565b61168e9190614a0d565b61ffff1611156116b157604051638a164f6360e01b815260040160405180910390fd5b600f54600160a01b900460ff16156117075760006116cd611427565b90506000816020015160048111156116e7576116e7614290565b0361170557604051637a5071c360e01b815260040160405180910390fd5b505b600f5460009061172290600160a01b900460ff166001614a28565b6040805160e08101825260ff838116808352600060208085018281528a85168688015261ffff8c166060870181905260808701526001600160401b038a1660a087015260c08601839052928252601090529390932082518154921660ff19831681178255935194955091939192839161ffff1916176101008360048111156117ac576117ac614290565b0217905550604082015181546060840151608085015160a086015160c09096015164ffffff0000199093166201000060ff9095169490940264ffff000000191693909317630100000061ffff92831602176effffffffffffffffffff00000000001916600160281b9382169390930267ffffffffffffffff60381b191692909217600160381b6001600160401b03958616021767ffffffffffffffff60781b1916600160781b9490911693909302929092179055600e54611876918691600160901b900416614a0d565b600e805461ffff60901b1916600160901b61ffff9384160217905560408051918616825260ff85811660208401526001600160401b038516918301919091528216907f5a95bbb1e3343dc606cca217733c02ae8f07a9729f050fa28163666f74591a169060600161127a565b6060816000816001600160401b038111156118ff576118ff6146e5565b60405190808252806020026020018201604052801561195157816020015b60408051608081018252600080825260208083018290529282018190526060820152825260001990920191018161191d5790505b50905060005b8281146119a45761197f86868381811061197357611973614a41565b905060200201356124ea565b82828151811061199157611991614a41565b6020908102919091010152600101611957565b50949350505050565b6000610dbe826139db565b6119c0612b1a565b600f546001600160a01b03166119e957604051630427851560e11b815260040160405180910390fd5b600f54600090611a0490600160a01b900460ff166001614a28565b60ff8082166000908152601060209081526040808320815160e08101909252805480861683529596509294909391840191610100909104166004811115611a4d57611a4d614290565b6004811115611a5e57611a5e614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a09093019290925282015191925016600003611ae957604051630f88cdf960e11b815260ff83166004820152602401610da6565b600f54600160a01b900460ff1615611b51576002600f5460ff600160a01b90910481166000908152601060205260409020546101009004166004811115611b3257611b32614290565b1015611b5157604051637a5071c360e01b815260040160405180910390fd5b600f805460ff60a01b1916600160a01b60ff851602179055600081602001516004811115611b8157611b81614290565b14611b9f5760405163bf2176c560e01b815260040160405180910390fd5b60ff8216600081815260106020526040808220805461ff001916610100179055517f0a237b7489ab9c5d93a843b86f3936ab88b43c2cee7a9cced35fc31c22c0bfc49190a25050565b600b8054611bf59061483d565b80601f0160208091040260200160405190810160405280929190818152602001828054611c219061483d565b8015611c6e5780601f10611c4357610100808354040283529160200191611c6e565b820191906000526020600020905b815481529060010190602001808311611c5157829003601f168201915b505050505081565b60006001600160a01b038216611c9f576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b611ccc612b1a565b6115726000613a4a565b611cde612b1a565b60ff8082166000908152601060209081526040808320815160e0810190925280548086168352939491939092840191610100909104166004811115611d2557611d25614290565b6004811115611d3657611d36614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a09093019290925282015191925016600003611dc157604051630f88cdf960e11b815260ff83166004820152602401610da6565b600381602001516004811115611dd957611dd9614290565b14611dfd5780602001516040516355c3543b60e01b8152600401610da6919061488a565b6004602082018190525060ff808316600090815260106020908152604090912083518154931660ff1984168117825591840151849391929091839161ffff1990911617610100836004811115611e5557611e55614290565b021790555060408281015182546060850151608086015160a087015160c09097015164ffffff0000199093166201000060ff9586160264ffff000000191617630100000061ffff93841602176effffffffffffffffffff00000000001916600160281b929091169190910267ffffffffffffffff60381b191617600160381b6001600160401b03968716021767ffffffffffffffff60781b1916600160781b9590911694909402939093179091555190831681527fb599d581a96932e4ef07cc1bcb7bcd81c5b13cfefd3aeb52d55f45592e5d2bc7906020016115f6565b611f3b612b1a565b6000825b611f7385858461ffff16818110611f5857611f58614a41565b9050602002016020810190611f6d9190614273565b84613355565b8160010191508061ffff168261ffff1610611f3f575050505050565b611f97612b1a565b8060005b611fce8585858460ff16818110611fb457611fb4614a41565b9050602002016020810190611fc99190614273565b612ca6565b60010160ff81168211611f9b575050505050565b60606000806000611ff285611c76565b90506000816001600160401b0381111561200e5761200e6146e5565b604051908082528060200260200182016040528015612037578160200160208202803683370190505b50905061206460408051608081018252600080825260208201819052918101829052606081019190915290565b60015b8386146120de5761207781613a9c565b915081604001516120d65781516001600160a01b03161561209757815194505b876001600160a01b0316856001600160a01b0316036120d657808387806001019850815181106120c9576120c9614a41565b6020026020010181815250505b600101612067565b50909695505050505050565b6120f2612b1a565b60006120fc611427565b905060018160200151600481111561211657612116614290565b111561213b5780602001516040516327eea1cf60e01b8152600401610da6919061488a565b816001600160401b03166000036121705760405163045ae4e560e51b81526001600160401b0383166004820152602401610da6565b805160ff908116600090815260106020908152604091829020805467ffffffffffffffff60381b1916600160381b6001600160401b038816908102919091179091558451925190815291909216917f1d86dd66b2affff705c4d7589166f91a3f3a4ab1f6bbd9e48365d43520a5f66c9101610e16565b6121ee612b1a565b600c610f2282848361491f565b606060038054610e319061483d565b606081831061222c57604051631960ccad60e11b815260040160405180910390fd5b60008061223860005490565b9050600185101561224857600194505b80841115612254578093505b600061225f87611c76565b90508486101561227e5785850381811015612278578091505b50612282565b5060005b6000816001600160401b0381111561229c5761229c6146e5565b6040519080825280602002602001820160405280156122c5578160200160208202803683370190505b509050816000036122db57935061238a92505050565b60006122e6886124ea565b9050600081604001516122f7575080515b885b8881141580156123095750848714155b1561237e5761231781613a9c565b925082604001516123765782516001600160a01b03161561233757825191505b8a6001600160a01b0316826001600160a01b031603612376578084888060010199508151811061236957612369614a41565b6020026020010181815250505b6001016122f9565b50505092835250909150505b9392505050565b612399612b1a565b600e546000906123b89060ff851690600160801b900461ffff16614a0d565b90506101f461ffff821611156123ef57604051630a8aa1bd60e11b815261ffff821660048201526101f46024820152604401610da6565b61271060ff84166124036000546000190190565b61240d9190614877565b111561242c57604051638a164f6360e01b815260040160405180910390fd5b600e805461ffff60801b1916600160801b61ffff841602179055604080516001600160a01b038416815260ff851660208201527f99dadef9a2d51e6aded57010cfa92387eb027f842185e7ea95b65c55b6058c68910160405180910390a1610f22828460ff16613ad8565b816124a181612f89565b610f228383613bb2565b6124b3612b1a565b6115726000600855565b836001600160a01b03811633146124d7576124d733612f89565b6124e385858585613c1e565b5050505050565b604080516080810182526000808252602082018190529181018290526060810191909152604080516080810182526000808252602082018190529181018290526060810191909152600183108061254357506000548310155b1561254e5792915050565b61255783613a9c565b90508060400151156125695792915050565b61238a83613c62565b606061257d82612c71565b61259a57604051630a14c4b560e41b815260040160405180910390fd5b60006125a4613c97565b905080516000036125c4576040518060200160405280600081525061238a565b806125ce84613ca6565b6040516020016125df929190614a57565b6040516020818303038152906040529392505050565b6060600c8054610e319061483d565b61260c612b1a565b6001600160a01b0381166126715760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610da6565b61135281613a4a565b612682612b1a565b60ff8083166000908152601060209081526040808320815160e08101909252805480861683529394919390928401916101009091041660048111156126c9576126c9614290565b60048111156126da576126da614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a0909301929092528201519192501660000361276557604051630f88cdf960e11b815260ff84166004820152602401610da6565b60028160200151600481111561277d5761277d614290565b146127a15780602001516040516302bb7f1160e51b8152600401610da6919061488a565b8060c001516001600160401b03166000036127cf5760405163c0758c9b60e01b815260040160405180910390fd5b8060c001516001600160401b031682146127fc57604051632fad637960e21b815260040160405180910390fd5b60ff8316600081815260106020526040808220805461ff001916610300179055517f6a5530a778c16d9236227755ff6776c2e05c79130ccf99fd5203b3898bfd76fe9190a2505050565b60006128506132fc565b61285d8261ffff16612c71565b61288057604051639881108f60e01b815261ffff83166004820152602401610da6565b3361288e61ffff84166119ad565b6001600160a01b0316146128c157604051632489e9fd60e21b815233600482015261ffff83166024820152604401610da6565b61ffff821660009081526012602090815260408083205460ff9081168085526010909352922054909161010090910416600481600481111561290557612905614290565b146129235760405163decab34360e01b815260040160405180910390fd5b6129328461ffff166000613cea565b600f54604051630cc7bd4760e21b81523360048201526001600160a01b0390911690600090829063331ef51c906024016020604051808303816000875af1158015612981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a59190614a86565b604080513381526020810183905261ffff89168183015290519192507f29974912e7d9057e5170b2879573dadfc0d91c35f15c73785ee366490ee386f6919081900360600190a193505050506129fb6001600d55565b919050565b612a08612b1a565b610f0a8282613355565b612a1a612b1a565b6001600f5460ff600160a01b90910481166000908152601060205260409020546101009004166004811115612a5157612a51614290565b14612a6f576040516386e0ca7f60e01b815260040160405180910390fd5b600f8054600160a01b9081900460ff908116600090815260106020526040808220805461ff001916610200179055935493519290930416917f788af3986a665e7e8ae7723656fb1c55205619ac0026e1540108d1ede59548fe91a2565b60006301ffc9a760e01b6001600160e01b031983161480612afd57506380ac58cd60e01b6001600160e01b03198316145b80610dbe5750506001600160e01b031916635b5e139f60e01b1490565b600a546001600160a01b031633146115725760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610da6565b6127106001600160601b0382161115612be25760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610da6565b6001600160a01b038216612c385760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610da6565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600855565b600081600111158015612c85575060005482105b8015610dbe575050600090815260046020526040902054600160e01b161590565b6001600160a01b038116612ccd5760405163d9b87c0f60e01b815260040160405180910390fd5b60ff8083166000908152601060209081526040808320815160e0810190925280548086168352939491939092840191610100909104166004811115612d1457612d14614290565b6004811115612d2557612d25614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b82041660608301526001600160401b03600160381b820481166080840152600160781b909104811660a09092019190915260c082015191925016600003612da75760405163c0758c9b60e01b815260040160405180910390fd5b60ff80841660009081526011602090815260408083206001600160a01b0387168452825291829020825160608101845290546001600160781b038082168352600160781b820416928201839052600160f01b900490931615159183019190915215612e3957604051630dc21eb360e41b815260ff851660048201526001600160a01b0384166024820152604401610da6565b6000612e6482600001516001600160781b03168460c001516001600160401b03168560400151613e19565b905080156124e357612e7581613102565b60ff861660009081526011602090815260408083206001600160a01b038916808552925280832080546001600160781b0395909516600160781b02600160781b600160f01b031990951694909417909355915190919083908381818185875af1925050503d8060008114612f05576040519150601f19603f3d011682016040523d82523d6000602084013e612f0a565b606091505b5050905080612f3e576040516357b9d85960e11b81526001600160a01b038616600482015260248101839052604401610da6565b846001600160a01b03167fe309aa15fd2f6bd8a58603632508694071e7d35e967bdbb827926e429b7ef34d83604051612f7991815260200190565b60405180910390a2505050505050565b6daaeb6d7670e522a718067333cd4e3b1561135257604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061301a9190614a9f565b61135257604051633b79c77360e21b81526001600160a01b0382166004820152602401610da6565b600061304d826119ad565b9050336001600160a01b03821614613086576130698133610c75565b613086576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b33321461157257604051633416a38560e01b815260040160405180910390fd5b60006001600160781b03821115610daf5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e20316044820152663230206269747360c81b6064820152608401610da6565b6000613176826139db565b9050836001600160a01b0316816001600160a01b0316146131a95760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546131d58187335b6001600160a01b039081169116811491141790565b613200576131e38633610c75565b61320057604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661322757604051633a954ecd60e21b815260040160405180910390fd5b801561323257600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036132c4576001840160008181526004602052604081205490036132c25760005481146132c25760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020614bd883398151915260405160405180910390a45b505050505050565b6002600d540361334e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610da6565b6002600d55565b6001600160a01b03821661337c57604051630667ee6560e21b815260040160405180910390fd5b60ff8082166000908152601060209081526040808320815160e08101909252805480861683529394919390928401916101009091041660048111156133c3576133c3614290565b60048111156133d4576133d4614290565b8152905460ff62010000820416602083015261ffff6301000000820481166040840152600160281b820481166060808501919091526001600160401b03600160381b840481166080860152600160781b90930490921660a0909301929092528201519192501660000361345f57604051630f88cdf960e11b815260ff83166004820152602401610da6565b60038160200151600481111561347757613477614290565b101561349f578060200151600360405163fafc2a6b60e01b8152600401610da6929190614abc565b60ff80831660009081526011602090815260408083206001600160a01b0388168452825291829020825160608101845290546001600160781b038082168352600160781b82041692820192909252600160f01b9091049092161580159183019190915261352a57604051632058b6db60e01b81526001600160a01b0385166004820152602401610da6565b60ff831660009081526011602090815260408083206001600160a01b03881684529091528120805460ff60f01b1916600160f01b1790558151906001600160781b038216900361359857604051636a6ae80d60e01b81526001600160a01b0386166004820152602401610da6565b60006135dd6135cf8560c001516001600160401b0316846135b99190614ad7565b6001600160781b0316866040015160ff16613e51565b856080015161ffff16613e51565b905060008460c001516001600160401b0316826135fa9190614afd565b905081156136d657608085015160ff87166000908152601060205260408120805461ffff938416869003909316600160281b0266ffff00000000001990931692909217909155600e80546001600160801b038082168501166001600160801b03199091161790556136816136716000546000190190565b61367c906001614877565b613e67565b905060005b876012600061369860ff851686614a0d565b61ffff1681526020810191909152604001600020805460ff191660ff9283161790556001919091019081168411613686576136d38985613ad8565b50505b600084602001516001600160781b031682856001600160781b03166136fb9190614b28565b6137059190614b28565b90506001600160801b03811615613835576040516001600160801b03821681526001600160a01b038916907fe309aa15fd2f6bd8a58603632508694071e7d35e967bdbb827926e429b7ef34d9060200160405180910390a261376f816001600160801b0316613102565b60ff881660009081526011602090815260408083206001600160a01b038d16808552925280832080546001600160781b0395909516600160781b02600160781b600160f01b03199095169490941790935591519091906001600160801b038416908381818185875af1925050503d8060008114613808576040519150601f19603f3d011682016040523d82523d6000602084013e61380d565b606091505b50509050806138335788826040516357b9d85960e11b8152600401610da6929190614b48565b505b604080516001600160a01b038a1681526001600160781b03861660208201529081018490526001600160801b03821660608201527f9cdcf2f7714cca3508c7f0110b04a90a80a3a8dd0e35de99689db74d28c5383e9060800160405180910390a15050505050505050565b610f22838383604051806020016040528060008152506124bd565b6001600160a01b0381166138e25760405163160f651560e01b815260040160405180910390fd5b600e546001600160801b03166000819003613910576040516367e3990d60e01b815260040160405180910390fd5b600e80546001600160801b03191690556040517feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d906139529084908490614b48565b60405180910390a16000826001600160a01b0316826001600160801b031660405160006040518083038185875af1925050503d80600081146139b0576040519150601f19603f3d011682016040523d82523d6000602084013e6139b5565b606091505b5050905080610f225782826040516351134c8960e11b8152600401610da6929190614b48565b60008180600111613a3157600054811015613a315760008181526004602052604081205490600160e01b82169003613a2f575b8060000361238a575060001901600081815260046020526040902054613a0e565b505b604051636f96cda160e11b815260040160405180910390fd5b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610dbe90613eca565b6000805490829003613afd5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b17831790558284019083908390600080516020614bd88339815191528180a4600183015b818114613b885780836000600080516020614bd8833981519152600080a4600101613b62565b5081600003613ba957604051622e076360e81b815260040160405180910390fd5b60005550505050565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b613c2984848461107b565b6001600160a01b0383163b156110a057613c4584848484613f11565b6110a0576040516368d2bf6b60e11b815260040160405180910390fd5b604080516080810182526000808252602082018190529181018290526060810191909152610dbe613c92836139db565b613eca565b6060600b8054610e319061483d565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480613cc05750819003601f19909101908152919050565b6000613cf5836139db565b905080600080613d1386600090815260066020526040902080549091565b915091508415613d5357613d288184336131c0565b613d5357613d368333610c75565b613d5357604051632ce44b5f60e11b815260040160405180910390fd5b8015613d5e57600082555b6001600160a01b038316600081815260056020526040902080546001600160801b030190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b85169003613de357600186016000818152600460205260408120549003613de1576000548114613de15760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020614bd8833981519152908390a45050600180548101905550505050565b600080613e32613e2985876148c5565b8460ff16613e51565b9050613e3e8482614898565b613e489086614b6a565b95945050505050565b6000818310613e60578161238a565b5090919050565b600061ffff821115610daf5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201526536206269747360d01b6064820152608401610da6565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613f46903390899088908890600401614b7d565b6020604051808303816000875af1925050508015613f81575060408051601f3d908101601f19168201909252613f7e91810190614bba565b60015b613fdf573d808015613faf576040519150601f19603f3d011682016040523d82523d6000602084013e613fb4565b606091505b508051600003613fd7576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b634e487b7160e01b600052601160045260246000fd5b6001600160801b0381811683821601908082111561403257614032613ffc565b5092915050565b6001600160e01b03198116811461135257600080fd5b60006020828403121561406157600080fd5b813561238a81614039565b6001600160a01b038116811461135257600080fd5b6000806040838503121561409457600080fd5b823561409f8161406c565b915060208301356001600160601b03811681146140bb57600080fd5b809150509250929050565b60005b838110156140e15781810151838201526020016140c9565b50506000910152565b600081518084526141028160208601602086016140c6565b601f01601f19169290920160200192915050565b60208152600061238a60208301846140ea565b60006020828403121561413b57600080fd5b5035919050565b803560ff811681146129fb57600080fd5b6000806040838503121561416657600080fd5b61416f83614142565b915060208301356140bb8161406c565b6000806040838503121561419257600080fd5b823561419d8161406c565b946020939093013593505050565b6000806000606084860312156141c057600080fd5b83356141cb8161406c565b925060208401356141db8161406c565b929592945050506040919091013590565b80356001600160401b03811681146129fb57600080fd5b6000806040838503121561421657600080fd5b61421f83614142565b915061422d602084016141ec565b90509250929050565b6000806040838503121561424957600080fd5b50508035926020909101359150565b60006020828403121561426a57600080fd5b61238a82614142565b60006020828403121561428557600080fd5b813561238a8161406c565b634e487b7160e01b600052602160045260246000fd5b600581106142c457634e487b7160e01b600052602160045260246000fd5b9052565b815160ff16815260208083015160e08301916142e6908401826142a6565b5060ff6040840151166040830152606083015161ffff8082166060850152806080860151166080850152505060a08301516001600160401b0380821660a08501528060c08601511660c0850152505092915050565b6000806020838503121561434e57600080fd5b82356001600160401b038082111561436557600080fd5b818501915085601f83011261437957600080fd5b81358181111561438857600080fd5b86602082850101111561439a57600080fd5b60209290920196919550909350505050565b803561ffff811681146129fb57600080fd5b6000806000606084860312156143d357600080fd5b6143dc846143ac565b92506143ea60208501614142565b91506143f8604085016141ec565b90509250925092565b60008083601f84011261441357600080fd5b5081356001600160401b0381111561442a57600080fd5b6020830191508360208260051b850101111561132f57600080fd5b6000806020838503121561445857600080fd5b82356001600160401b0381111561446e57600080fd5b61447a85828601614401565b90969095509350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b818110156120de576144f1838551614486565b92840192608092909201916001016144de565b6000806040838503121561451757600080fd5b82356145228161406c565b915061422d60208401614142565b60008060006040848603121561454557600080fd5b83356001600160401b0381111561455b57600080fd5b61456786828701614401565b90945092506143f8905060208501614142565b60008060006040848603121561458f57600080fd5b61459884614142565b925060208401356001600160401b038111156145b357600080fd5b6145bf86828701614401565b9497909650939450505050565b6020808252825182820181905260009190848201906040850190845b818110156120de578351835292840192918401916001016145e8565b60006020828403121561461657600080fd5b61238a826141ec565b60008060006060848603121561463457600080fd5b833561463f8161406c565b95602085013595506040909401359392505050565b801515811461135257600080fd5b6000806040838503121561467557600080fd5b82356146808161406c565b915060208301356140bb81614654565b60ff8816815260e081016146a760208301896142a6565b60ff96909616604082015261ffff94851660608201529290931660808301526001600160401b0390811660a083015290911660c09091015292915050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561471157600080fd5b843561471c8161406c565b9350602085013561472c8161406c565b92506040850135915060608501356001600160401b038082111561474f57600080fd5b818701915087601f83011261476357600080fd5b813581811115614775576147756146e5565b604051601f8201601f19908116603f0116810190838211818310171561479d5761479d6146e5565b816040528281528a60208487010111156147b657600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60808101610dbe8284614486565b6000602082840312156147fa57600080fd5b61238a826143ac565b6000806040838503121561481657600080fd5b823561416f8161406c565b6000806040838503121561483457600080fd5b61419d83614142565b600181811c9082168061485157607f821691505b60208210810361487157634e487b7160e01b600052602260045260246000fd5b50919050565b80820180821115610dbe57610dbe613ffc565b60208101610dbe82846142a6565b8082028115828204841417610dbe57610dbe613ffc565b634e487b7160e01b600052601260045260246000fd5b6000826148d4576148d46148af565b500490565b601f821115610f2257600081815260208120601f850160051c810160208610156149005750805b601f850160051c820191505b818110156132f45782815560010161490c565b6001600160401b03831115614936576149366146e5565b61494a83614944835461483d565b836148d9565b6000601f84116001811461497e57600085156149665750838201355b600019600387901b1c1916600186901b1783556124e3565b600083815260209020601f19861690835b828110156149af578685013582556020948501946001909201910161498f565b50868210156149cc5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b61ffff81811683821601908082111561403257614032613ffc565b60ff8181168382160190811115610dbe57610dbe613ffc565b634e487b7160e01b600052603260045260246000fd5b60008351614a698184602088016140c6565b835190830190614a7d8183602088016140c6565b01949350505050565b600060208284031215614a9857600080fd5b5051919050565b600060208284031215614ab157600080fd5b815161238a81614654565b60408101614aca82856142a6565b61238a60208301846142a6565b60006001600160781b0380841680614af157614af16148af565b92169190910492915050565b6001600160801b03818116838216028082169190828114614b2057614b20613ffc565b505092915050565b6001600160801b0382811682821603908082111561403257614032613ffc565b6001600160a01b039290921682526001600160801b0316602082015260400190565b81810381811115610dbe57610dbe613ffc565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614bb0908301846140ea565b9695505050505050565b600060208284031215614bcc57600080fd5b815161238a8161403956feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212201df92ada0957653d3dea83c3197b354407d485fe154fea7ace6f434da4642c2b64736f6c63430008140033

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

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