ETH Price: $3,094.97 (+0.24%)

Token

Grumbies Genesis Battle (GGB)
 

Overview

Max Total Supply

1,500 GGB

Holders

704

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Balance
6 GGB
0xc2ab088560dd4084d6d0c97b51b0d5cad6a66552
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

Grumbies Genesis Battle is an interactive NFT game to earn ETH! Grumbies start off with a small subset of traits that are upgradeable in a survivor pool with an ever-growing pool of winnings. Visit [battle.grumbies.io](https://battle.grumbies.io) and read the docs to join us! ⚠️ Disclaimer: Any rarity displayed by OpenSea or any other platform is based on the frequency and distribution of traits. Once the game begins and Grumbies begin to get upgraded, rarities are subject to change based on dynamically changing traits. OpenSea rarity is largely irrelevant to the actual game. Metadata and image may be out of date, always use our [Token Lookup](https://battle.grumbies.io/lookup) tool on the web app before purchasing and be sure to hit Refresh Metadata on OpenSea!

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
GenesisBattle

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 17 : GenesisBattle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {DefaultOperatorFilterer} from "./filter/DefaultOperatorFilterer.sol";
import "./VRFCoordinatorV2Interface.sol";
import "./VRFConsumerBaseV2.sol";
import "./ERC721A.sol";

contract GenesisBattle is Ownable, ERC721A, ReentrancyGuard, VRFConsumerBaseV2, DefaultOperatorFilterer {
    
    //chainlink VRF
    event RequestSent(uint256 requestId);
    event RequestFulfilled(uint256 requestId, uint256[] randomWords);

    struct RequestStatus {
        bool fulfilled; // whether the request has been successfully fulfilled
        bool exists; // whether a requestId exists
        uint256[] randomWords;
    }
    mapping(uint256 => RequestStatus) public s_requests; /* requestId --> requestStatus */
    VRFCoordinatorV2Interface COORDINATOR;

    uint64 s_subscriptionId;
    uint256[] public requestIds;
    uint256 public lastRequestId;
    bytes32 keyHash =
        0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef;
    uint32 callbackGasLimit = 100000;
    uint16 requestConfirmations = 3;
    uint32 numWords = 2;

    constructor(
        string memory name,
        string memory symbol,
        uint64 subscriptionId
    )
        ERC721A(name, symbol)
        VRFConsumerBaseV2(0x271682DEB8C4E0901D1a1550aD2e64D568E69909)
    {
        COORDINATOR = VRFCoordinatorV2Interface(
            0x271682DEB8C4E0901D1a1550aD2e64D568E69909
        );
        // s_owner = msg.sender;
        s_subscriptionId = subscriptionId;
    }

    // Assumes the subscription is funded sufficiently.
    function requestRandomWords()
        external
        onlyOwner
        returns (uint256 requestId)
    {
        // Will revert if subscription is not set and funded.
        requestId = COORDINATOR.requestRandomWords(
            keyHash,
            s_subscriptionId,
            requestConfirmations,
            callbackGasLimit,
            numWords
        );
        s_requests[requestId] = RequestStatus({
            randomWords: new uint256[](0),
            exists: true,
            fulfilled: false
        });
        requestIds.push(requestId);
        lastRequestId = requestId;
        emit RequestSent(requestId);
        return requestId;
    }

    function fulfillRandomWords(
        uint256 _requestId,
        uint256[] memory _randomWords
    ) internal override {
        require(s_requests[_requestId].exists, "request not found");
        s_requests[_requestId].fulfilled = true;
        s_requests[_requestId].randomWords = _randomWords;
        emit RequestFulfilled(_requestId, _randomWords);
    }

    function getRands() external view returns (uint256[] memory randomWords) {
        RequestStatus memory request = s_requests[lastRequestId];
        return request.randomWords;
    }

    function getRequestStatus(uint256 _requestId)
        external
        view
        returns (bool fulfilled, uint256[] memory randomWords)
    {
        require(s_requests[_requestId].exists, "request not found");
        RequestStatus memory request = s_requests[_requestId];
        return (request.fulfilled, request.randomWords);
    }

    // main contract variables
    uint256 public MAX_SUPPLY = 1500;
    uint8 public totalTraitIds = 100;
    uint256 public traitPrice = 0.015 ether;
    uint256 public currentChosenTrait;
    uint256 public eliminationCount;
    uint256 public numWinners;
    bool public gameEnded;
    bool public gameHasStarted;

    uint256 public jackpot;
    uint256 public teamBalance;
    mapping(uint256 => bool) public tokenHasClaimedPrize;

    // tokenId => traitId
    mapping(uint256 => uint256) public headgearForToken;
    mapping(uint256 => uint256) public outfitForToken;
    mapping(uint256 => uint256) public upgradeCountPerToken;
    mapping(uint256 => bool) public traitIsEliminated;
    // quantity of outfit and headgear traits (traits get zeroed out with elimination in traitAmountCounter)
    // 0-4 are headgear base traits, 5-14 are outfit base traits
    uint256[] public traitAmountCounter = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20,20,20,20,30,30,40,20,30,30,20,20,30,20,20,30,30,30,30,30,30,30,30,30,30,30,20,16,30,16,30,16,30,16,30,30,30,30,40,20,30,30,20,20,40,16,40,40,20,40,40,30,30,20,40,20,30,30,16,30,30,20,40,40,30,20,16,20,40,20,40,40,20,16,20,30,16,30,40,40,30,16,40,20,40];
    uint256[] public purchaseTraitCounter = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20,20,20,20,30,30,40,20,30,30,20,20,30,20,20,30,30,30,30,30,30,30,30,30,30,30,20,16,30,16,30,16,30,16,30,30,30,30,40,20,30,30,20,20,40,16,40,40,20,40,40,30,30,20,40,20,30,30,16,30,30,20,40,40,30,20,16,20,40,20,40,40,20,16,20,30,16,30,40,40,30,16,40,20,40];
    // total across the two categories
    uint256 public totalTraits = 2350;

    receive() external payable {}

    modifier callerIsUser() {
        require(tx.origin == msg.sender, "The caller is another contract");
        _;
    }

    function setGameHasStarted(bool isActive) external onlyOwner {
        gameHasStarted = isActive;
    }

    function setGameEnded(uint256 totalWinners) external onlyOwner {
        // numWinners can be read from the contract, however it must be set manually here due to memory caps for functions
        numWinners = totalWinners;
        gameEnded = true;
    }

    function setSupply(uint256 _supply) external onlyOwner {
        MAX_SUPPLY = _supply;
    }

    function setTraitPrice(uint256 _price) external onlyOwner {
        traitPrice = _price;
    }

    function getTraitQuantities() public view returns (uint256[] memory) {
        return traitAmountCounter;
    }

    function getPurchaseTraitQuantities()
        public
        view
        returns (uint256[] memory)
    {
        return purchaseTraitCounter;
    }

    function getTraitsByTokenId(uint256 tokenId)
        public
        view
        returns (uint256[2] memory)
    {
        return [headgearForToken[tokenId], outfitForToken[tokenId]];
    }

    function getAllTokenInfo(uint256 tokenId)
        public
        view
        returns (string memory)
    {
        return
            string(
                abi.encodePacked(
                    "{'headgear':",
                    Strings.toString(headgearForToken[tokenId]),
                    ",'headgearElim':",
                    traitIsEliminated[headgearForToken[tokenId]]
                        ? "true"
                        : "false",
                    ",'outfit':",
                    Strings.toString(outfitForToken[tokenId]),
                    ",'outfitElim':",
                    traitIsEliminated[outfitForToken[tokenId]]
                        ? "true"
                        : "false",
                    ",'completelyElim':",
                    isEliminated(tokenId) ? "true" : "false",
                    ",'hasClaimedPrize':",
                    tokenHasClaimedPrize[tokenId] ? "true" : "false",
                    ",'upgradeCount':",
                    Strings.toString(upgradeCountPerToken[tokenId]),
                    "}"
                )
            );
    }

    // airdrop to holders
    function airdrop(address[] calldata to) external onlyOwner nonReentrant {
        require(
            totalSupply() + to.length <= MAX_SUPPLY,
            "would exceed max supply"
        );
        for (uint256 i = 0; i < to.length; i++) {
            // assign base traits to token at time of mint 
            uint256 headgear = totalSupply() % 5;
            // ensure headgear and outfit don't repeat often for pregeneration by creating offsets
            uint256 outfit = ((totalSupply() + totalSupply() / 10) + 1) % 10 + 5;
            outfitForToken[totalSupply()] = outfit;
            headgearForToken[totalSupply()] = headgear;
            traitAmountCounter[outfit] = traitAmountCounter[outfit] + 1;
            traitAmountCounter[headgear] = traitAmountCounter[headgear] + 1;
            totalTraits += 2;
            _safeMint(to[i], 1);
        }
    }

    // metadata URI
    string private _baseTokenURI;

    function setBaseURI(string calldata baseURI) external onlyOwner {
        _baseTokenURI = baseURI;
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return _baseTokenURI;
    }

    // manually add money to jackpot from team wallet
    function addToJackpot() external payable onlyOwner {
        require(msg.value > 0, "Must send more than 0 ETH");
        jackpot += msg.value;
    }

    // RPC only due to memory issue in looping (no internal calls)
    function totalEliminated() public view returns (uint256) {
        uint256 count;
        for (uint256 i = 0; i < totalSupply(); i++) {
            if (isEliminated(i)) {
                count++;
            }
        }
        return count;
    }

    function isEliminated(uint256 tokenId) public view returns (bool) {
        if (
            traitIsEliminated[headgearForToken[tokenId]] == false ||
            traitIsEliminated[outfitForToken[tokenId]] == false
        ) {
            return false;
        } else {
            return true;
        }
    }

    function eliminateTrait() external onlyOwner returns (uint256) {
        require(gameHasStarted == true, "game has not started yet");
        require(gameEnded == false, "game has ended");
        // pick a random index to start at, then loop through until we land on the random number counting as we go 
        uint256[] memory rands = this.getRands();
        uint256 randomIndex = rands[0] % traitAmountCounter.length;
        // get a random number between 0 and totalTraits
        uint256 randomNumber = rands[1] % totalTraits;

        uint256 currentIndex = randomIndex;
        uint256 sumCounter = traitAmountCounter[currentIndex];

        while (sumCounter < randomNumber) {
            if (currentIndex == traitAmountCounter.length - 1) {
                currentIndex = 0;
            } else {
                currentIndex++;
            }
            sumCounter = sumCounter + traitAmountCounter[currentIndex];
        }
        totalTraits = totalTraits - traitAmountCounter[currentIndex];
        traitAmountCounter[currentIndex] = 0;
        traitIsEliminated[currentIndex] = true;
        currentChosenTrait = currentIndex;
        eliminationCount++;
        return currentIndex;
    }

    // buy trait
    function buyTrait(uint256 traitId, uint256 tokenId)
        external
        payable
        nonReentrant
    {
        require(gameHasStarted == true, "game has not started");
        require(gameEnded == false, "game has endeed");
        require(msg.sender == ownerOf(tokenId), "Must be token owner");
        require(msg.value == traitPrice, "Incorrect amount sent");
        require(traitIsEliminated[traitId] == false, "Trait is eliminated");
        require(purchaseTraitCounter[traitId] > 0, "Trait is sold out");
        require(isEliminated(tokenId) == false, "Token is eliminated");
        require(traitId > 14, "Cannot buy base traits");

        purchaseTraitCounter[traitId]--;
        // separate headgear from outfit
        if (traitId < 54) {
            outfitForToken[tokenId] = traitId;
        } else {
            headgearForToken[tokenId] = traitId;
        }

        jackpot += (msg.value * 7) / 10;
        teamBalance += (msg.value * 3) / 10;
        upgradeCountPerToken[tokenId]++;
    }

    function claimPrize(uint256 tokenId) external nonReentrant {
        require(msg.sender == ownerOf(tokenId), "Must be token owner");
        require(isEliminated(tokenId) == false, "Token is eliminated");
        require(
            tokenHasClaimedPrize[tokenId] == false,
            "Token has claimed prize already"
        );
        require(gameEnded == true, "Game is still in action");
        require(numWinners != 0, "No winners");
        tokenHasClaimedPrize[tokenId] = true;
        uint256 prize = jackpot / numWinners;
        payable(msg.sender).transfer(prize);
    }

    // withdrawl team earnings
    function teamWithdraw() external onlyOwner {
        require(gameEnded == true, "Game is still in action");
        require(teamBalance > 0, "No funds to withdraw");
        payable(msg.sender).transfer(teamBalance);
        teamBalance = 0;
    }

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

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

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

File 2 of 17 : 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 3 of 17 : 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 4 of 17 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 5 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 6 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 7 of 17 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 8 of 17 : 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 9 of 17 : 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 10 of 17 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

File 11 of 17 : 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 12 of 17 : DefaultOperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

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

abstract contract DefaultOperatorFilterer is OperatorFilterer {
    address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);

    constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {}
}

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

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator)
        external
        view
        returns (bool);

    function register(address registrant) external;

    function registerAndSubscribe(address registrant, address subscription)
        external;

    function registerAndCopyEntries(
        address registrant,
        address registrantToCopy
    ) external;

    function updateOperator(
        address registrant,
        address operator,
        bool filtered
    ) external;

    function updateOperators(
        address registrant,
        address[] calldata operators,
        bool filtered
    ) external;

    function updateCodeHash(
        address registrant,
        bytes32 codehash,
        bool filtered
    ) external;

    function updateCodeHashes(
        address registrant,
        bytes32[] calldata codeHashes,
        bool filtered
    ) external;

    function subscribe(address registrant, address registrantToSubscribe)
        external;

    function unsubscribe(address registrant, bool copyExistingEntries) external;

    function subscriptionOf(address addr) external returns (address registrant);

    function subscribers(address registrant)
        external
        returns (address[] memory);

    function subscriberAt(address registrant, uint256 index)
        external
        returns (address);

    function copyEntriesOf(address registrant, address registrantToCopy)
        external;

    function isOperatorFiltered(address registrant, address operator)
        external
        returns (bool);

    function isCodeHashOfFiltered(address registrant, address operatorWithCode)
        external
        returns (bool);

    function isCodeHashFiltered(address registrant, bytes32 codeHash)
        external
        returns (bool);

    function filteredOperators(address addr)
        external
        returns (address[] memory);

    function filteredCodeHashes(address addr)
        external
        returns (bytes32[] memory);

    function filteredOperatorAt(address registrant, uint256 index)
        external
        returns (address);

    function filteredCodeHashAt(address registrant, uint256 index)
        external
        returns (bytes32);

    function isRegistered(address addr) external returns (bool);

    function codeHashOf(address addr) external returns (bytes32);
}

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

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

abstract contract OperatorFilterer {
    error OperatorNotAllowed(address operator);

    IOperatorFilterRegistry constant operatorFilterRegistry =
        IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);

    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(operatorFilterRegistry).code.length > 0) {
            if (subscribe) {
                operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
                } else {
                    operatorFilterRegistry.register(address(this));
                }
            }
        }
    }

    modifier onlyAllowedOperator(address from) virtual {
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(operatorFilterRegistry).code.length > 0) {
            // 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) {
                _;
                return;
            }
            if (
                !(
                    operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender)
                        && operatorFilterRegistry.isOperatorAllowed(address(this), from)
                )
            ) {
                revert OperatorNotAllowed(msg.sender);
            }
        }
        _;
    }
}

File 15 of 17 : 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 16 of 17 : VRFConsumerBaseV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness. It ensures 2 things:
 * @dev 1. The fulfillment came from the VRFCoordinator
 * @dev 2. The consumer contract implements fulfillRandomWords.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constructor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash). Create subscription, fund it
 * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface
 * @dev subscription management functions).
 * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations,
 * @dev callbackGasLimit, numWords),
 * @dev see (VRFCoordinatorInterface for a description of the arguments).
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomWords method.
 *
 * @dev The randomness argument to fulfillRandomWords is a set of random words
 * @dev generated from your requestId and the blockHash of the request.
 *
 * @dev If your contract could have concurrent requests open, you can use the
 * @dev requestId returned from requestRandomWords to track which response is associated
 * @dev with which randomness request.
 * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ.
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request. It is for this reason that
 * @dev that you can signal to an oracle you'd like them to wait longer before
 * @dev responding to the request (however this is not enforced in the contract
 * @dev and so remains effective only in the case of unmodified oracle software).
 */
abstract contract VRFConsumerBaseV2 {
  error OnlyCoordinatorCanFulfill(address have, address want);
  address private immutable vrfCoordinator;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   */
  constructor(address _vrfCoordinator) {
    vrfCoordinator = _vrfCoordinator;
  }

  /**
   * @notice fulfillRandomness handles the VRF response. Your contract must
   * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
   * @notice principles to keep in mind when implementing your fulfillRandomness
   * @notice method.
   *
   * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this
   * @dev signature, and will call it once it has verified the proof
   * @dev associated with the randomness. (It is triggered via a call to
   * @dev rawFulfillRandomness, below.)
   *
   * @param requestId The Id initially returned by requestRandomness
   * @param randomWords the VRF output expanded to the requested number of words
   */
  function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
    if (msg.sender != vrfCoordinator) {
      revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);
    }
    fulfillRandomWords(requestId, randomWords);
  }
}

File 17 of 17 : VRFCoordinatorV2Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface VRFCoordinatorV2Interface {
  /**
   * @notice Get configuration relevant for making requests
   * @return minimumRequestConfirmations global min for request confirmations
   * @return maxGasLimit global max for request gas limit
   * @return s_provingKeyHashes list of registered key hashes
   */
  function getRequestConfig()
    external
    view
    returns (
      uint16,
      uint32,
      bytes32[] memory
    );

  /**
   * @notice Request a set of random words.
   * @param keyHash - Corresponds to a particular oracle job which uses
   * that key for generating the VRF proof. Different keyHash's have different gas price
   * ceilings, so you can select a specific one to bound your maximum per request cost.
   * @param subId  - The ID of the VRF subscription. Must be funded
   * with the minimum subscription balance required for the selected keyHash.
   * @param minimumRequestConfirmations - How many blocks you'd like the
   * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS
   * for why you may want to request more. The acceptable range is
   * [minimumRequestBlockConfirmations, 200].
   * @param callbackGasLimit - How much gas you'd like to receive in your
   * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords
   * may be slightly less than this amount because of gas used calling the function
   * (argument decoding etc.), so you may need to request slightly more than you expect
   * to have inside fulfillRandomWords. The acceptable range is
   * [0, maxGasLimit]
   * @param numWords - The number of uint256 random values you'd like to receive
   * in your fulfillRandomWords callback. Note these numbers are expanded in a
   * secure way by the VRFCoordinator from a single random value supplied by the oracle.
   * @return requestId - A unique identifier of the request. Can be used to match
   * a request to a response in fulfillRandomWords.
   */
  function requestRandomWords(
    bytes32 keyHash,
    uint64 subId,
    uint16 minimumRequestConfirmations,
    uint32 callbackGasLimit,
    uint32 numWords
  ) external returns (uint256 requestId);

  /**
   * @notice Create a VRF subscription.
   * @return subId - A unique subscription id.
   * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer.
   * @dev Note to fund the subscription, use transferAndCall. For example
   * @dev  LINKTOKEN.transferAndCall(
   * @dev    address(COORDINATOR),
   * @dev    amount,
   * @dev    abi.encode(subId));
   */
  function createSubscription() external returns (uint64 subId);

  /**
   * @notice Get a VRF subscription.
   * @param subId - ID of the subscription
   * @return balance - LINK balance of the subscription in juels.
   * @return reqCount - number of requests for this subscription, determines fee tier.
   * @return owner - owner of the subscription.
   * @return consumers - list of consumer address which are able to use this subscription.
   */
  function getSubscription(uint64 subId)
    external
    view
    returns (
      uint96 balance,
      uint64 reqCount,
      address owner,
      address[] memory consumers
    );

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @param newOwner - proposed new owner of the subscription
   */
  function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @dev will revert if original owner of subId has
   * not requested that msg.sender become the new owner.
   */
  function acceptSubscriptionOwnerTransfer(uint64 subId) external;

  /**
   * @notice Add a consumer to a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - New consumer which can use the subscription
   */
  function addConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Remove a consumer from a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - Consumer to remove from the subscription
   */
  function removeConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Cancel a subscription
   * @param subId - ID of the subscription
   * @param to - Where to send the remaining LINK to
   */
  function cancelSubscription(uint64 subId, address to) external;

  /*
   * @notice Check to see if there exists a request commitment consumers
   * for all consumers and keyhashes for a given sub.
   * @param subId - ID of the subscription
   * @return true if there exists at least one unfulfilled request for the subscription, false
   * otherwise.
   */
  function pendingRequestExists(uint64 subId) external view returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint64","name":"subscriptionId","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"RequestFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"}],"name":"RequestSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addToJackpot","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"to","type":"address[]"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"traitId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"buyTrait","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claimPrize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentChosenTrait","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eliminateTrait","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eliminationCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameEnded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameHasStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getAllTokenInfo","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPurchaseTraitQuantities","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRands","outputs":[{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"getRequestStatus","outputs":[{"internalType":"bool","name":"fulfilled","type":"bool"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTraitQuantities","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTraitsByTokenId","outputs":[{"internalType":"uint256[2]","name":"","type":"uint256[2]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"headgearForToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isEliminated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"jackpot","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastRequestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numWinners","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"outfitForToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint256","name":"","type":"uint256"}],"name":"purchaseTraitCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"requestIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"requestRandomWords","outputs":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"s_requests","outputs":[{"internalType":"bool","name":"fulfilled","type":"bool"},{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalWinners","type":"uint256"}],"name":"setGameEnded","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isActive","type":"bool"}],"name":"setGameHasStarted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_supply","type":"uint256"}],"name":"setSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setTraitPrice","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":[],"name":"teamBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenHasClaimedPrize","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalEliminated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTraitIds","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTraits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"traitAmountCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"traitIsEliminated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"traitPrice","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":"uint256","name":"","type":"uint256"}],"name":"upgradeCountPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

7f8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef600e55600f80546001600160501b03191666020003000186a01790556105dc601090815560118054606460ff19909116811790915566354a6ba7a18000601255610d20604052600060a081815260c082905260e08290526101008290526101208290526101408290526101608290526101808290526101a08290526101c08290526101e08290526102008290526102208290526102408290526102609190915260146102808190526102a08190526102c08190526102e0819052601e61030081905261032081905260286103408190526103608390526103808290526103a08290526103c08390526103e08390526104008290526104208390526104408390526104608290526104808290526104a08290526104c08290526104e08290526105008290526105208290526105408290526105608290526105808290526105a08290526105c08390526105e08690526106008290526106208690526106408290526106608690526106808290526106a08690526106c08290526106e08290526107008290526107208290526107408190526107608390526107808290526107a08290526107c08390526107e08390526108008190526108208690526108408190526108608190526108808390526108a08190526108c08190526108e08290526109008290526109208390526109408190526109608390526109808290526109a08290526109c08690526109e0829052610a00829052610a20839052610a40819052610a60819052610a80829052610aa0839052610ac0869052610ae0839052610b00819052610b20839052610b40819052610b60819052610b80839052610ba0869052610bc0839052610be0829052610c00869052610c20829052610c40819052610c60819052610c80829052610ca095909552610cc0859052610ce091909152610d0093909352620002d392916200089f565b5060408051610c8081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a081018290526101c081019190915260146101e08201819052610200820181905261022082018190526102408201819052601e6102608301819052610280830181905260286102a084018190526102c084018390526102e08401829052610300840182905261032084018390526103408401839052610360840182905261038084018390526103a084018390526103c084018290526103e08401829052610400840182905261042084018290526104408401829052610460840182905261048084018290526104a084018290526104c084018290526104e084018290526105008401829052610520840183905260106105408501819052610560850183905261058085018190526105a085018390526105c085018190526105e08501839052610600850181905261062085018390526106408501839052610660850183905261068085018390526106a085018290526106c085018490526106e08501839052610700850183905261072085018490526107408501849052610760850182905261078085018190526107a085018290526107c085018290526107e08501849052610800850182905261082085018290526108408501839052610860850183905261088085018490526108a085018290526108c085018490526108e08501839052610900850183905261092085018190526109408501839052610960850183905261098085018490526109a085018290526109c085018290526109e08501839052610a008501849052610a208501819052610a408501849052610a608501829052610a808501849052610aa08501829052610ac08501829052610ae08501849052610b008501819052610b208501849052610b408501839052610b608501819052610b808501839052610ba08501829052610bc08501829052610be0850192909252610c00840191909152610c208301819052610c40830191909152610c608201526200060e90601f9060646200089f565b5061092e6020553480156200062257600080fd5b506040516200441d3803806200441d833981016040819052620006459162000a55565b733cc6cdda760b79bafa08df41ecfa224f810dceb6600173271682deb8c4e0901d1a1550ad2e64d568e6990985856200067e336200084f565b815162000693906003906020850190620008f4565b508051620006a9906004906020840190620008f4565b506000600190815560095550506001600160a01b03166080526daaeb6d7670e522a718067333cd4e3b15620008075780156200075557604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200073657600080fd5b505af11580156200074b573d6000803e3d6000fd5b5050505062000807565b6001600160a01b03821615620007a65760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af2903906044016200071b565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620007ed57600080fd5b505af115801562000802573d6000803e3d6000fd5b505050505b5050600b80546001600160401b03909216600160a01b026001600160e01b03199092169190911773271682deb8c4e0901d1a1550ad2e64d568e699091790555062000b169050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054828255906000526020600020908101928215620008e2579160200282015b82811115620008e2578251829060ff16905591602001919060010190620008c0565b50620008f092915062000971565b5090565b828054620009029062000ada565b90600052602060002090601f016020900481019282620009265760008555620008e2565b82601f106200094157805160ff1916838001178555620008e2565b82800160010185558215620008e2579182015b82811115620008e257825182559160200191906001019062000954565b5b80821115620008f0576000815560010162000972565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620009b057600080fd5b81516001600160401b0380821115620009cd57620009cd62000988565b604051601f8301601f19908116603f01168101908282118183101715620009f857620009f862000988565b8160405283815260209250868385880101111562000a1557600080fd5b600091505b8382101562000a39578582018301518183018401529082019062000a1a565b8382111562000a4b5760008385830101525b9695505050505050565b60008060006060848603121562000a6b57600080fd5b83516001600160401b038082111562000a8357600080fd5b62000a91878388016200099e565b9450602086015191508082111562000aa857600080fd5b62000ab6878388016200099e565b935060408601519150808216821462000ace57600080fd5b50809150509250925092565b600181811c9082168062000aef57607f821691505b60208210810362000b1057634e487b7160e01b600052602260045260246000fd5b50919050565b6080516138e462000b3960003960008181610d800152610dc201526138e46000f3fe60806040526004361061038f5760003560e01c8063729ad39e116101dc578063a490c7ee11610102578063e0c86289116100a0578063f2fde38b1161006f578063f2fde38b14610a70578063f642072114610a90578063f8b5072314610abc578063fc2a88c314610ad257600080fd5b8063e0c86289146109d0578063e2905d4f146109e5578063e58e6896146109fa578063e985e9c514610a2757600080fd5b8063c87b56dd116100dc578063c87b56dd1461094d578063cfbb7d361461096d578063d709815414610982578063d8a4676f146109a257600080fd5b8063a490c7ee146108f5578063b88d4fde14610925578063c19a6dd91461093857600080fd5b80638da5cb5b1161017a5780639b6db01f116101495780639b6db01f146108505780639d00f51514610870578063a168fa8914610885578063a22cb465146108d557600080fd5b80638da5cb5b146107f4578063917e3a7c14610812578063929134fe1461082557806395d89b411461083b57600080fd5b806386a53479116101b657806386a53479146107785780638796ba8c146107a857806389e85217146107c85780638b7bcc86146107de57600080fd5b8063729ad39e1461072257806372bbe04714610742578063751f48911461075857600080fd5b806332cb6b0c116102c15780635865618a1161025f5780636b14f8211161022e5780636b14f821146106aa5780636b31ee01146106d757806370a08231146106ed578063715018a61461070d57600080fd5b80635865618a1461061d5780635f208f301461064a5780636352211e1461066a578063635df01c1461068a57600080fd5b80633b4c4b251161029b5780633b4c4b251461059d57806342842e0e146105bd57806354c63bf2146105d057806355f804b3146105fd57600080fd5b806332cb6b0c14610552578063359598651461056857806336c235bd1461058857600080fd5b80630b035fd41161032e5780631fe543e3116103085780631fe543e3146104fd57806323b872dd1461051d578063256bcaa0146105305780632f6fe3961461053857600080fd5b80630b035fd4146104a557806318160ddd146104c5578063198615c0146104de57600080fd5b806306fdde031161036a57806306fdde0314610416578063081812fc14610438578063083b13d514610470578063095ea7b31461049057600080fd5b8062a9bb011461039b57806301ffc9a7146103c4578063044f661f146103f457600080fd5b3661039657005b600080fd5b3480156103a757600080fd5b506103b160125481565b6040519081526020015b60405180910390f35b3480156103d057600080fd5b506103e46103df366004612f92565b610ae8565b60405190151581526020016103bb565b34801561040057600080fd5b50610409610b3a565b6040516103bb9190612fea565b34801561042257600080fd5b5061042b610bce565b6040516103bb9190613055565b34801561044457600080fd5b50610458610453366004613068565b610c60565b6040516001600160a01b0390911681526020016103bb565b34801561047c57600080fd5b506103b161048b366004613068565b610ca4565b6104a361049e366004613098565b610cc5565b005b3480156104b157600080fd5b506103b16104c0366004613068565b610d65565b3480156104d157600080fd5b50600254600154036103b1565b3480156104ea57600080fd5b506016546103e490610100900460ff1681565b34801561050957600080fd5b506104a361051836600461312d565b610d75565b6104a361052b3660046131cf565b610e02565b6104a3610f5e565b34801561054457600080fd5b506016546103e49060ff1681565b34801561055e57600080fd5b506103b160105481565b34801561057457600080fd5b506104a3610583366004613068565b610fcf565b34801561059457600080fd5b50610409610fdc565b3480156105a957600080fd5b506104a36105b8366004613068565b611033565b6104a36105cb3660046131cf565b611040565b3480156105dc57600080fd5b506103b16105eb366004613068565b601b6020526000908152604090205481565b34801561060957600080fd5b506104a361061836600461320b565b611191565b34801561062957600080fd5b506103b1610638366004613068565b601c6020526000908152604090205481565b34801561065657600080fd5b506104a361066536600461328b565b6111aa565b34801561067657600080fd5b50610458610685366004613068565b6111cc565b34801561069657600080fd5b5061042b6106a5366004613068565b6111d7565b3480156106b657600080fd5b506103b16106c5366004613068565b601a6020526000908152604090205481565b3480156106e357600080fd5b506103b160175481565b3480156106f957600080fd5b506103b16107083660046132a8565b6113bb565b34801561071957600080fd5b506104a361140a565b34801561072e57600080fd5b506104a361073d3660046132c3565b61141e565b34801561074e57600080fd5b506103b160205481565b34801561076457600080fd5b506103e4610773366004613068565b611656565b34801561078457600080fd5b506103e4610793366004613068565b601d6020526000908152604090205460ff1681565b3480156107b457600080fd5b506103b16107c3366004613068565b6116b7565b3480156107d457600080fd5b506103b160185481565b3480156107ea57600080fd5b506103b160155481565b34801561080057600080fd5b506000546001600160a01b0316610458565b6104a3610820366004613326565b6116c7565b34801561083157600080fd5b506103b160135481565b34801561084757600080fd5b5061042b611a3e565b34801561085c57600080fd5b506104a361086b366004613068565b611a4d565b34801561087c57600080fd5b50610409611a67565b34801561089157600080fd5b506108be6108a0366004613068565b600a6020526000908152604090205460ff8082169161010090041682565b6040805192151583529015156020830152016103bb565b3480156108e157600080fd5b506104a36108f0366004613348565b611abd565b34801561090157600080fd5b506103e4610910366004613068565b60196020526000908152604090205460ff1681565b6104a361093336600461337f565b611b29565b34801561094457600080fd5b506103b1611c88565b34801561095957600080fd5b5061042b610968366004613068565b611f14565b34801561097957600080fd5b506104a3611f98565b34801561098e57600080fd5b506104a361099d366004613068565b612070565b3480156109ae57600080fd5b506109c26109bd366004613068565b61227a565b6040516103bb92919061343f565b3480156109dc57600080fd5b506103b161236e565b3480156109f157600080fd5b506103b161251b565b348015610a0657600080fd5b50610a1a610a15366004613068565b612563565b6040516103bb919061345a565b348015610a3357600080fd5b506103e4610a4236600461348b565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b348015610a7c57600080fd5b506104a3610a8b3660046132a8565b61259d565b348015610a9c57600080fd5b50601154610aaa9060ff1681565b60405160ff90911681526020016103bb565b348015610ac857600080fd5b506103b160145481565b348015610ade57600080fd5b506103b1600d5481565b60006301ffc9a760e01b6001600160e01b031983161480610b1957506380ac58cd60e01b6001600160e01b03198316145b80610b345750635b5e139f60e01b6001600160e01b03198316145b92915050565b600d546000908152600a60209081526040808320815160608181018452825460ff808216151584526101009091041615158286015260018301805485518188028101880187528181529297969395860193830182828015610bba57602002820191906000526020600020905b815481526020019060010190808311610ba6575b505050919092525050506040015192915050565b606060038054610bdd906134be565b80601f0160208091040260200160405190810160405280929190818152602001828054610c09906134be565b8015610c565780601f10610c2b57610100808354040283529160200191610c56565b820191906000526020600020905b815481529060010190602001808311610c3957829003601f168201915b5050505050905090565b6000610c6b82612613565b610c88576040516333d1c03960e21b815260040160405180910390fd5b506000908152600760205260409020546001600160a01b031690565b601f8181548110610cb457600080fd5b600091825260209091200154905081565b6000610cd0826111cc565b9050336001600160a01b03821614610d0957610cec8133610a42565b610d09576040516367d9dca160e11b815260040160405180910390fd5b60008281526007602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b601e8181548110610cb457600080fd5b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610df45760405163073e64fd60e21b81523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b610dfe828261263b565b5050565b826daaeb6d7670e522a718067333cd4e3b15610f4d57336001600160a01b03821603610e3857610e33848484612701565b610f58565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610e87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eab91906134f2565b8015610f2e5750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610f0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2e91906134f2565b610f4d57604051633b79c77360e21b8152336004820152602401610deb565b610f58848484612701565b50505050565b610f66612899565b60003411610fb65760405162461bcd60e51b815260206004820152601960248201527f4d7573742073656e64206d6f7265207468616e203020455448000000000000006044820152606401610deb565b3460176000828254610fc89190613525565b9091555050565b610fd7612899565b601255565b6060601f805480602002602001604051908101604052809291908181526020018280548015610c5657602002820191906000526020600020905b815481526020019060010190808311611016575050505050905090565b61103b612899565b601055565b826daaeb6d7670e522a718067333cd4e3b1561118657336001600160a01b0382160361107157610e338484846128f3565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156110c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e491906134f2565b80156111675750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611143573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116791906134f2565b61118657604051633b79c77360e21b8152336004820152602401610deb565b610f588484846128f3565b611199612899565b6111a560218383612e8a565b505050565b6111b2612899565b601680549115156101000261ff0019909216919091179055565b6000610b348261290e565b6000818152601a60205260409020546060906111f290612975565b6000838152601a60209081526040808320548352601d90915290205460ff16611238576040518060400160405280600581526020016466616c736560d81b815250611256565b604051806040016040528060048152602001637472756560e01b8152505b6000848152601b602052604090205461126e90612975565b6000858152601b60209081526040808320548352601d90915290205460ff166112b4576040518060400160405280600581526020016466616c736560d81b8152506112d2565b604051806040016040528060048152602001637472756560e01b8152505b6112db86611656565b611302576040518060400160405280600581526020016466616c736560d81b815250611320565b604051806040016040528060048152602001637472756560e01b8152505b60008781526019602052604090205460ff16611359576040518060400160405280600581526020016466616c736560d81b815250611377565b604051806040016040528060048152602001637472756560e01b8152505b6000888152601c602052604090205461138f90612975565b6040516020016113a59796959493929190613559565b6040516020818303038152906040529050919050565b60006001600160a01b0382166113e4576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526006602052604090205467ffffffffffffffff1690565b611412612899565b61141c6000612a08565b565b611426612899565b61142e612a58565b6010548161143f6002546001540390565b6114499190613525565b11156114975760405162461bcd60e51b815260206004820152601760248201527f776f756c6420657863656564206d617820737570706c790000000000000000006044820152606401610deb565b60005b8181101561164b57600060056114b36002546001540390565b6114bd91906136be565b90506000600a806114d16002546001540390565b6114db91906136d2565b600254600154036114ec9190613525565b6114f7906001613525565b61150191906136be565b61150c906005613525565b905080601b60006115206002546001540390565b81526020019081526020016000208190555081601a60006115446002546001540390565b815260200190815260200160002081905550601e8181548110611569576115696136e6565b906000526020600020015460016115809190613525565b601e8281548110611593576115936136e6565b9060005260206000200181905550601e82815481106115b4576115b46136e6565b906000526020600020015460016115cb9190613525565b601e83815481106115de576115de6136e6565b90600052602060002001819055506002602060008282546115ff9190613525565b90915550611636905085858581811061161a5761161a6136e6565b905060200201602081019061162f91906132a8565b6001612ab1565b50508080611643906136fc565b91505061149a565b50610dfe6001600955565b6000818152601a60209081526040808320548352601d90915281205460ff16158061169d57506000828152601b60209081526040808320548352601d90915290205460ff16155b156116aa57506000919050565b506001919050565b919050565b600c8181548110610cb457600080fd5b6116cf612a58565b60165460ff6101009091041615156001146117235760405162461bcd60e51b815260206004820152601460248201527319d85b59481a185cc81b9bdd081cdd185c9d195960621b6044820152606401610deb565b60165460ff16156117685760405162461bcd60e51b815260206004820152600f60248201526e19d85b59481a185cc8195b99195959608a1b6044820152606401610deb565b611771816111cc565b6001600160a01b0316336001600160a01b0316146117c75760405162461bcd60e51b815260206004820152601360248201527226bab9ba103132903a37b5b2b71037bbb732b960691b6044820152606401610deb565b60125434146118105760405162461bcd60e51b8152602060048201526015602482015274125b98dbdc9c9958dd08185b5bdd5b9d081cd95b9d605a1b6044820152606401610deb565b6000828152601d602052604090205460ff16156118655760405162461bcd60e51b8152602060048201526013602482015272151c985a5d081a5cc8195b1a5b5a5b985d1959606a1b6044820152606401610deb565b6000601f838154811061187a5761187a6136e6565b9060005260206000200154116118c65760405162461bcd60e51b8152602060048201526011602482015270151c985a5d081a5cc81cdbdb19081bdd5d607a1b6044820152606401610deb565b6118cf81611656565b156119125760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881a5cc8195b1a5b5a5b985d1959606a1b6044820152606401610deb565b600e821161195b5760405162461bcd60e51b815260206004820152601660248201527543616e6e6f742062757920626173652074726169747360501b6044820152606401610deb565b601f828154811061196e5761196e6136e6565b6000918252602082200180549161198483613715565b919050555060368210156119a8576000818152601b602052604090208290556119ba565b6000818152601a602052604090208290555b600a6119c734600761372c565b6119d191906136d2565b601760008282546119e29190613525565b90915550600a90506119f534600361372c565b6119ff91906136d2565b60186000828254611a109190613525565b90915550506000818152601c60205260408120805491611a2f836136fc565b9190505550610dfe6001600955565b606060048054610bdd906134be565b611a55612899565b6015556016805460ff19166001179055565b6060601e805480602002602001604051908101604052809291908181526020018280548015610c565760200282019190600052602060002090815481526020019060010190808311611016575050505050905090565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b836daaeb6d7670e522a718067333cd4e3b15611c7557336001600160a01b03821603611b6057611b5b85858585612acb565b611c81565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd391906134f2565b8015611c565750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611c32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5691906134f2565b611c7557604051633b79c77360e21b8152336004820152602401610deb565b611c8185858585612acb565b5050505050565b6000611c92612899565b60165460ff610100909104161515600114611cef5760405162461bcd60e51b815260206004820152601860248201527f67616d6520686173206e6f7420737461727465642079657400000000000000006044820152606401610deb565b60165460ff1615611d335760405162461bcd60e51b815260206004820152600e60248201526d19d85b59481a185cc8195b99195960921b6044820152606401610deb565b6000306001600160a01b031663044f661f6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611d73573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d9b919081019061374b565b90506000601e8054905082600081518110611db857611db86136e6565b6020026020010151611dca91906136be565b9050600060205483600181518110611de457611de46136e6565b6020026020010151611df691906136be565b905060008290506000601e8281548110611e1257611e126136e6565b906000526020600020015490505b82811015611e8457601e54611e37906001906137dc565b8203611e465760009150611e54565b81611e50816136fc565b9250505b601e8281548110611e6757611e676136e6565b906000526020600020015481611e7d9190613525565b9050611e20565b601e8281548110611e9757611e976136e6565b9060005260206000200154602054611eaf91906137dc565b6020819055506000601e8381548110611eca57611eca6136e6565b6000918252602080832090910192909255838152601d90915260408120805460ff1916600117905560138390556014805491611f05836136fc565b90915550919550505050505090565b6060611f1f82612613565b611f3c57604051630a14c4b560e41b815260040160405180910390fd5b6000611f46612b0f565b90508051600003611f665760405180602001604052806000815250611f91565b80611f7084612b1e565b604051602001611f819291906137f3565b6040516020818303038152906040525b9392505050565b611fa0612899565b60165460ff161515600114611ff15760405162461bcd60e51b815260206004820152601760248201527623b0b6b29034b99039ba34b6361034b71030b1ba34b7b760491b6044820152606401610deb565b60006018541161203a5760405162461bcd60e51b81526020600482015260146024820152734e6f2066756e647320746f20776974686472617760601b6044820152606401610deb565b601854604051339180156108fc02916000818181858888f19350505050158015612068573d6000803e3d6000fd5b506000601855565b612078612a58565b612081816111cc565b6001600160a01b0316336001600160a01b0316146120d75760405162461bcd60e51b815260206004820152601360248201527226bab9ba103132903a37b5b2b71037bbb732b960691b6044820152606401610deb565b6120e081611656565b156121235760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881a5cc8195b1a5b5a5b985d1959606a1b6044820152606401610deb565b60008181526019602052604090205460ff16156121825760405162461bcd60e51b815260206004820152601f60248201527f546f6b656e2068617320636c61696d6564207072697a6520616c7265616479006044820152606401610deb565b60165460ff1615156001146121d35760405162461bcd60e51b815260206004820152601760248201527623b0b6b29034b99039ba34b6361034b71030b1ba34b7b760491b6044820152606401610deb565b6015546000036122125760405162461bcd60e51b815260206004820152600a6024820152694e6f2077696e6e65727360b01b6044820152606401610deb565b6000818152601960205260408120805460ff1916600117905560155460175461223b91906136d2565b604051909150339082156108fc029083906000818181858888f1935050505015801561226b573d6000803e3d6000fd5b50506122776001600955565b50565b6000818152600a6020526040812054606090610100900460ff166122d45760405162461bcd60e51b81526020600482015260116024820152701c995c5d595cdd081b9bdd08199bdd5b99607a1b6044820152606401610deb565b6000838152600a602090815260408083208151606081018352815460ff808216151583526101009091041615158185015260018201805484518187028101870186528181529295939486019383018282801561234f57602002820191906000526020600020905b81548152602001906001019080831161233b575b5050505050815250509050806000015181604001519250925050915091565b6000612378612899565b600b54600e54600f546040516305d3b1d360e41b81526004810192909252600160a01b830467ffffffffffffffff166024830152640100000000810461ffff16604483015263ffffffff808216606484015266010000000000009091041660848201526001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af115801561240f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124339190613822565b6040805160608101825260008082526001602080840182815285518481528083018752858701908152878552600a83529590932084518154945161ffff1990951690151561ff001916176101009415159490940293909317835593518051959650929491936124a89391850192910190612f0e565b5050600c80546001810182556000919091527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c70182905550600d8190556040518181527f0cd21a41891ff04ecd9a8754bec97e2fb85d2a4e7694329d4dc364c796f23d069060200160405180910390a190565b60008060005b6002546001540381101561255d5761253881611656565b1561254b5781612547816136fc565b9250505b80612555816136fc565b915050612521565b50919050565b61256b612f49565b506040805180820182526000838152601a6020908152838220548352938152601b845291909120549181019190915290565b6125a5612899565b6001600160a01b03811661260a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610deb565b61227781612a08565b600060015482108015610b34575050600090815260056020526040902054600160e01b161590565b6000828152600a6020526040902054610100900460ff166126925760405162461bcd60e51b81526020600482015260116024820152701c995c5d595cdd081b9bdd08199bdd5b99607a1b6044820152606401610deb565b6000828152600a60209081526040909120805460ff19166001908117825583516126c3939290910191840190612f0e565b507ffe2e2d779dba245964d4e3ef9b994be63856fd568bf7d3ca9e224755cb1bd54d82826040516126f592919061383b565b60405180910390a15050565b600061270c8261290e565b9050836001600160a01b0316816001600160a01b03161461273f5760405162a1148160e81b815260040160405180910390fd5b60008281526007602052604090208054338082146001600160a01b0388169091141761278c5761276f8633610a42565b61278c57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166127b357604051633a954ecd60e21b815260040160405180910390fd5b80156127be57600082555b6001600160a01b038681166000908152600660205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260056020526040812091909155600160e11b841690036128505760018401600081815260056020526040812054900361284e57600154811461284e5760008181526005602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6000546001600160a01b0316331461141c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610deb565b6111a583838360405180602001604052806000815250611b29565b60008160015481101561295c5760008181526005602052604081205490600160e01b8216900361295a575b80600003611f91575060001901600081815260056020526040902054612939565b505b604051636f96cda160e11b815260040160405180910390fd5b6060600061298283612b62565b600101905060008167ffffffffffffffff8111156129a2576129a26130c2565b6040519080825280601f01601f1916602001820160405280156129cc576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846129d657509392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600260095403612aaa5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610deb565b6002600955565b610dfe828260405180602001604052806000815250612c3a565b612ad6848484610e02565b6001600160a01b0383163b15610f5857612af284848484612ca0565b610f58576040516368d2bf6b60e11b815260040160405180910390fd5b606060218054610bdd906134be565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480612b385750819003601f19909101908152919050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612ba15772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612bcd576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612beb57662386f26fc10000830492506010015b6305f5e1008310612c03576305f5e100830492506008015b6127108310612c1757612710830492506004015b60648310612c29576064830492506002015b600a8310610b345760010192915050565b612c448383612d8c565b6001600160a01b0383163b156111a5576001548281035b612c6e6000868380600101945086612ca0565b612c8b576040516368d2bf6b60e11b815260040160405180910390fd5b818110612c5b578160015414611c8157600080fd5b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612cd5903390899088908890600401613854565b6020604051808303816000875af1925050508015612d10575060408051601f3d908101601f19168201909252612d0d91810190613891565b60015b612d6e573d808015612d3e576040519150601f19603f3d011682016040523d82523d6000602084013e612d43565b606091505b508051600003612d66576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6001546000829003612db15760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526006602090815260408083208054680100000000000000018802019055848352600590915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b818114612e6057808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101612e28565b5081600003612e8157604051622e076360e81b815260040160405180910390fd5b60015550505050565b828054612e96906134be565b90600052602060002090601f016020900481019282612eb85760008555612efe565b82601f10612ed15782800160ff19823516178555612efe565b82800160010185558215612efe579182015b82811115612efe578235825591602001919060010190612ee3565b50612f0a929150612f67565b5090565b828054828255906000526020600020908101928215612efe579160200282015b82811115612efe578251825591602001919060010190612f2e565b60405180604001604052806002906020820280368337509192915050565b5b80821115612f0a5760008155600101612f68565b6001600160e01b03198116811461227757600080fd5b600060208284031215612fa457600080fd5b8135611f9181612f7c565b600081518084526020808501945080840160005b83811015612fdf57815187529582019590820190600101612fc3565b509495945050505050565b602081526000611f916020830184612faf565b60005b83811015613018578181015183820152602001613000565b83811115610f585750506000910152565b60008151808452613041816020860160208601612ffd565b601f01601f19169290920160200192915050565b602081526000611f916020830184613029565b60006020828403121561307a57600080fd5b5035919050565b80356001600160a01b03811681146116b257600080fd5b600080604083850312156130ab57600080fd5b6130b483613081565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613101576131016130c2565b604052919050565b600067ffffffffffffffff821115613123576131236130c2565b5060051b60200190565b6000806040838503121561314057600080fd5b8235915060208084013567ffffffffffffffff81111561315f57600080fd5b8401601f8101861361317057600080fd5b803561318361317e82613109565b6130d8565b81815260059190911b820183019083810190888311156131a257600080fd5b928401925b828410156131c0578335825292840192908401906131a7565b80955050505050509250929050565b6000806000606084860312156131e457600080fd5b6131ed84613081565b92506131fb60208501613081565b9150604084013590509250925092565b6000806020838503121561321e57600080fd5b823567ffffffffffffffff8082111561323657600080fd5b818501915085601f83011261324a57600080fd5b81358181111561325957600080fd5b86602082850101111561326b57600080fd5b60209290920196919550909350505050565b801515811461227757600080fd5b60006020828403121561329d57600080fd5b8135611f918161327d565b6000602082840312156132ba57600080fd5b611f9182613081565b600080602083850312156132d657600080fd5b823567ffffffffffffffff808211156132ee57600080fd5b818501915085601f83011261330257600080fd5b81358181111561331157600080fd5b8660208260051b850101111561326b57600080fd5b6000806040838503121561333957600080fd5b50508035926020909101359150565b6000806040838503121561335b57600080fd5b61336483613081565b915060208301356133748161327d565b809150509250929050565b6000806000806080858703121561339557600080fd5b61339e85613081565b935060206133ad818701613081565b935060408601359250606086013567ffffffffffffffff808211156133d157600080fd5b818801915088601f8301126133e557600080fd5b8135818111156133f7576133f76130c2565b613409601f8201601f191685016130d8565b9150808252898482850101111561341f57600080fd5b808484018584013760008482840101525080935050505092959194509250565b8215158152604060208201526000612d846040830184612faf565b60408101818360005b6002811015613482578151835260209283019290910190600101613463565b50505092915050565b6000806040838503121561349e57600080fd5b6134a783613081565b91506134b560208401613081565b90509250929050565b600181811c908216806134d257607f821691505b60208210810361255d57634e487b7160e01b600052602260045260246000fd5b60006020828403121561350457600080fd5b8151611f918161327d565b634e487b7160e01b600052601160045260246000fd5b600082198211156135385761353861350f565b500190565b6000815161354f818560208601612ffd565b9290920192915050565b6b3d93b432b0b233b2b0b9139d60a11b81526000885161358081600c850160208d01612ffd565b6f1613b432b0b233b2b0b922b634b6939d60811b600c9184019182015288516135b081601c840160208d01612ffd565b691613b7baba3334ba139d60b11b601c929091019182015287516135db816026840160208c01612ffd565b6d1613b7baba3334ba22b634b6939d60911b60269290910191820152865161360a816034840160208b01612ffd565b711613b1b7b6b83632ba32b63ca2b634b6939d60711b6034929091019182015261369a61368d61368761366b613665613646604687018c61353d565b721613b430b9a1b630b4b6b2b2283934bd32939d60691b815260130190565b8961353d565b6f1613bab833b930b232a1b7bab73a139d60811b815260100190565b8661353d565b607d60f81b815260010190565b9a9950505050505050505050565b634e487b7160e01b600052601260045260246000fd5b6000826136cd576136cd6136a8565b500690565b6000826136e1576136e16136a8565b500490565b634e487b7160e01b600052603260045260246000fd5b60006001820161370e5761370e61350f565b5060010190565b6000816137245761372461350f565b506000190190565b60008160001904831182151516156137465761374661350f565b500290565b6000602080838503121561375e57600080fd5b825167ffffffffffffffff81111561377557600080fd5b8301601f8101851361378657600080fd5b805161379461317e82613109565b81815260059190911b820183019083810190878311156137b357600080fd5b928401925b828410156137d1578351825292840192908401906137b8565b979650505050505050565b6000828210156137ee576137ee61350f565b500390565b60008351613805818460208801612ffd565b835190830190613819818360208801612ffd565b01949350505050565b60006020828403121561383457600080fd5b5051919050565b828152604060208201526000612d846040830184612faf565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061388790830184613029565b9695505050505050565b6000602082840312156138a357600080fd5b8151611f9181612f7c56fea2646970667358221220656370b027d175d2c3b57efd39e3aa0d876c0a1df6f0e839cd23d3836de3761664736f6c634300080d0033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000002b600000000000000000000000000000000000000000000000000000000000000174772756d626965732047656e6573697320426174746c6500000000000000000000000000000000000000000000000000000000000000000000000000000000034747420000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361061038f5760003560e01c8063729ad39e116101dc578063a490c7ee11610102578063e0c86289116100a0578063f2fde38b1161006f578063f2fde38b14610a70578063f642072114610a90578063f8b5072314610abc578063fc2a88c314610ad257600080fd5b8063e0c86289146109d0578063e2905d4f146109e5578063e58e6896146109fa578063e985e9c514610a2757600080fd5b8063c87b56dd116100dc578063c87b56dd1461094d578063cfbb7d361461096d578063d709815414610982578063d8a4676f146109a257600080fd5b8063a490c7ee146108f5578063b88d4fde14610925578063c19a6dd91461093857600080fd5b80638da5cb5b1161017a5780639b6db01f116101495780639b6db01f146108505780639d00f51514610870578063a168fa8914610885578063a22cb465146108d557600080fd5b80638da5cb5b146107f4578063917e3a7c14610812578063929134fe1461082557806395d89b411461083b57600080fd5b806386a53479116101b657806386a53479146107785780638796ba8c146107a857806389e85217146107c85780638b7bcc86146107de57600080fd5b8063729ad39e1461072257806372bbe04714610742578063751f48911461075857600080fd5b806332cb6b0c116102c15780635865618a1161025f5780636b14f8211161022e5780636b14f821146106aa5780636b31ee01146106d757806370a08231146106ed578063715018a61461070d57600080fd5b80635865618a1461061d5780635f208f301461064a5780636352211e1461066a578063635df01c1461068a57600080fd5b80633b4c4b251161029b5780633b4c4b251461059d57806342842e0e146105bd57806354c63bf2146105d057806355f804b3146105fd57600080fd5b806332cb6b0c14610552578063359598651461056857806336c235bd1461058857600080fd5b80630b035fd41161032e5780631fe543e3116103085780631fe543e3146104fd57806323b872dd1461051d578063256bcaa0146105305780632f6fe3961461053857600080fd5b80630b035fd4146104a557806318160ddd146104c5578063198615c0146104de57600080fd5b806306fdde031161036a57806306fdde0314610416578063081812fc14610438578063083b13d514610470578063095ea7b31461049057600080fd5b8062a9bb011461039b57806301ffc9a7146103c4578063044f661f146103f457600080fd5b3661039657005b600080fd5b3480156103a757600080fd5b506103b160125481565b6040519081526020015b60405180910390f35b3480156103d057600080fd5b506103e46103df366004612f92565b610ae8565b60405190151581526020016103bb565b34801561040057600080fd5b50610409610b3a565b6040516103bb9190612fea565b34801561042257600080fd5b5061042b610bce565b6040516103bb9190613055565b34801561044457600080fd5b50610458610453366004613068565b610c60565b6040516001600160a01b0390911681526020016103bb565b34801561047c57600080fd5b506103b161048b366004613068565b610ca4565b6104a361049e366004613098565b610cc5565b005b3480156104b157600080fd5b506103b16104c0366004613068565b610d65565b3480156104d157600080fd5b50600254600154036103b1565b3480156104ea57600080fd5b506016546103e490610100900460ff1681565b34801561050957600080fd5b506104a361051836600461312d565b610d75565b6104a361052b3660046131cf565b610e02565b6104a3610f5e565b34801561054457600080fd5b506016546103e49060ff1681565b34801561055e57600080fd5b506103b160105481565b34801561057457600080fd5b506104a3610583366004613068565b610fcf565b34801561059457600080fd5b50610409610fdc565b3480156105a957600080fd5b506104a36105b8366004613068565b611033565b6104a36105cb3660046131cf565b611040565b3480156105dc57600080fd5b506103b16105eb366004613068565b601b6020526000908152604090205481565b34801561060957600080fd5b506104a361061836600461320b565b611191565b34801561062957600080fd5b506103b1610638366004613068565b601c6020526000908152604090205481565b34801561065657600080fd5b506104a361066536600461328b565b6111aa565b34801561067657600080fd5b50610458610685366004613068565b6111cc565b34801561069657600080fd5b5061042b6106a5366004613068565b6111d7565b3480156106b657600080fd5b506103b16106c5366004613068565b601a6020526000908152604090205481565b3480156106e357600080fd5b506103b160175481565b3480156106f957600080fd5b506103b16107083660046132a8565b6113bb565b34801561071957600080fd5b506104a361140a565b34801561072e57600080fd5b506104a361073d3660046132c3565b61141e565b34801561074e57600080fd5b506103b160205481565b34801561076457600080fd5b506103e4610773366004613068565b611656565b34801561078457600080fd5b506103e4610793366004613068565b601d6020526000908152604090205460ff1681565b3480156107b457600080fd5b506103b16107c3366004613068565b6116b7565b3480156107d457600080fd5b506103b160185481565b3480156107ea57600080fd5b506103b160155481565b34801561080057600080fd5b506000546001600160a01b0316610458565b6104a3610820366004613326565b6116c7565b34801561083157600080fd5b506103b160135481565b34801561084757600080fd5b5061042b611a3e565b34801561085c57600080fd5b506104a361086b366004613068565b611a4d565b34801561087c57600080fd5b50610409611a67565b34801561089157600080fd5b506108be6108a0366004613068565b600a6020526000908152604090205460ff8082169161010090041682565b6040805192151583529015156020830152016103bb565b3480156108e157600080fd5b506104a36108f0366004613348565b611abd565b34801561090157600080fd5b506103e4610910366004613068565b60196020526000908152604090205460ff1681565b6104a361093336600461337f565b611b29565b34801561094457600080fd5b506103b1611c88565b34801561095957600080fd5b5061042b610968366004613068565b611f14565b34801561097957600080fd5b506104a3611f98565b34801561098e57600080fd5b506104a361099d366004613068565b612070565b3480156109ae57600080fd5b506109c26109bd366004613068565b61227a565b6040516103bb92919061343f565b3480156109dc57600080fd5b506103b161236e565b3480156109f157600080fd5b506103b161251b565b348015610a0657600080fd5b50610a1a610a15366004613068565b612563565b6040516103bb919061345a565b348015610a3357600080fd5b506103e4610a4236600461348b565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b348015610a7c57600080fd5b506104a3610a8b3660046132a8565b61259d565b348015610a9c57600080fd5b50601154610aaa9060ff1681565b60405160ff90911681526020016103bb565b348015610ac857600080fd5b506103b160145481565b348015610ade57600080fd5b506103b1600d5481565b60006301ffc9a760e01b6001600160e01b031983161480610b1957506380ac58cd60e01b6001600160e01b03198316145b80610b345750635b5e139f60e01b6001600160e01b03198316145b92915050565b600d546000908152600a60209081526040808320815160608181018452825460ff808216151584526101009091041615158286015260018301805485518188028101880187528181529297969395860193830182828015610bba57602002820191906000526020600020905b815481526020019060010190808311610ba6575b505050919092525050506040015192915050565b606060038054610bdd906134be565b80601f0160208091040260200160405190810160405280929190818152602001828054610c09906134be565b8015610c565780601f10610c2b57610100808354040283529160200191610c56565b820191906000526020600020905b815481529060010190602001808311610c3957829003601f168201915b5050505050905090565b6000610c6b82612613565b610c88576040516333d1c03960e21b815260040160405180910390fd5b506000908152600760205260409020546001600160a01b031690565b601f8181548110610cb457600080fd5b600091825260209091200154905081565b6000610cd0826111cc565b9050336001600160a01b03821614610d0957610cec8133610a42565b610d09576040516367d9dca160e11b815260040160405180910390fd5b60008281526007602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b601e8181548110610cb457600080fd5b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091614610df45760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091660248201526044015b60405180910390fd5b610dfe828261263b565b5050565b826daaeb6d7670e522a718067333cd4e3b15610f4d57336001600160a01b03821603610e3857610e33848484612701565b610f58565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610e87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eab91906134f2565b8015610f2e5750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610f0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2e91906134f2565b610f4d57604051633b79c77360e21b8152336004820152602401610deb565b610f58848484612701565b50505050565b610f66612899565b60003411610fb65760405162461bcd60e51b815260206004820152601960248201527f4d7573742073656e64206d6f7265207468616e203020455448000000000000006044820152606401610deb565b3460176000828254610fc89190613525565b9091555050565b610fd7612899565b601255565b6060601f805480602002602001604051908101604052809291908181526020018280548015610c5657602002820191906000526020600020905b815481526020019060010190808311611016575050505050905090565b61103b612899565b601055565b826daaeb6d7670e522a718067333cd4e3b1561118657336001600160a01b0382160361107157610e338484846128f3565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa1580156110c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e491906134f2565b80156111675750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611143573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116791906134f2565b61118657604051633b79c77360e21b8152336004820152602401610deb565b610f588484846128f3565b611199612899565b6111a560218383612e8a565b505050565b6111b2612899565b601680549115156101000261ff0019909216919091179055565b6000610b348261290e565b6000818152601a60205260409020546060906111f290612975565b6000838152601a60209081526040808320548352601d90915290205460ff16611238576040518060400160405280600581526020016466616c736560d81b815250611256565b604051806040016040528060048152602001637472756560e01b8152505b6000848152601b602052604090205461126e90612975565b6000858152601b60209081526040808320548352601d90915290205460ff166112b4576040518060400160405280600581526020016466616c736560d81b8152506112d2565b604051806040016040528060048152602001637472756560e01b8152505b6112db86611656565b611302576040518060400160405280600581526020016466616c736560d81b815250611320565b604051806040016040528060048152602001637472756560e01b8152505b60008781526019602052604090205460ff16611359576040518060400160405280600581526020016466616c736560d81b815250611377565b604051806040016040528060048152602001637472756560e01b8152505b6000888152601c602052604090205461138f90612975565b6040516020016113a59796959493929190613559565b6040516020818303038152906040529050919050565b60006001600160a01b0382166113e4576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526006602052604090205467ffffffffffffffff1690565b611412612899565b61141c6000612a08565b565b611426612899565b61142e612a58565b6010548161143f6002546001540390565b6114499190613525565b11156114975760405162461bcd60e51b815260206004820152601760248201527f776f756c6420657863656564206d617820737570706c790000000000000000006044820152606401610deb565b60005b8181101561164b57600060056114b36002546001540390565b6114bd91906136be565b90506000600a806114d16002546001540390565b6114db91906136d2565b600254600154036114ec9190613525565b6114f7906001613525565b61150191906136be565b61150c906005613525565b905080601b60006115206002546001540390565b81526020019081526020016000208190555081601a60006115446002546001540390565b815260200190815260200160002081905550601e8181548110611569576115696136e6565b906000526020600020015460016115809190613525565b601e8281548110611593576115936136e6565b9060005260206000200181905550601e82815481106115b4576115b46136e6565b906000526020600020015460016115cb9190613525565b601e83815481106115de576115de6136e6565b90600052602060002001819055506002602060008282546115ff9190613525565b90915550611636905085858581811061161a5761161a6136e6565b905060200201602081019061162f91906132a8565b6001612ab1565b50508080611643906136fc565b91505061149a565b50610dfe6001600955565b6000818152601a60209081526040808320548352601d90915281205460ff16158061169d57506000828152601b60209081526040808320548352601d90915290205460ff16155b156116aa57506000919050565b506001919050565b919050565b600c8181548110610cb457600080fd5b6116cf612a58565b60165460ff6101009091041615156001146117235760405162461bcd60e51b815260206004820152601460248201527319d85b59481a185cc81b9bdd081cdd185c9d195960621b6044820152606401610deb565b60165460ff16156117685760405162461bcd60e51b815260206004820152600f60248201526e19d85b59481a185cc8195b99195959608a1b6044820152606401610deb565b611771816111cc565b6001600160a01b0316336001600160a01b0316146117c75760405162461bcd60e51b815260206004820152601360248201527226bab9ba103132903a37b5b2b71037bbb732b960691b6044820152606401610deb565b60125434146118105760405162461bcd60e51b8152602060048201526015602482015274125b98dbdc9c9958dd08185b5bdd5b9d081cd95b9d605a1b6044820152606401610deb565b6000828152601d602052604090205460ff16156118655760405162461bcd60e51b8152602060048201526013602482015272151c985a5d081a5cc8195b1a5b5a5b985d1959606a1b6044820152606401610deb565b6000601f838154811061187a5761187a6136e6565b9060005260206000200154116118c65760405162461bcd60e51b8152602060048201526011602482015270151c985a5d081a5cc81cdbdb19081bdd5d607a1b6044820152606401610deb565b6118cf81611656565b156119125760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881a5cc8195b1a5b5a5b985d1959606a1b6044820152606401610deb565b600e821161195b5760405162461bcd60e51b815260206004820152601660248201527543616e6e6f742062757920626173652074726169747360501b6044820152606401610deb565b601f828154811061196e5761196e6136e6565b6000918252602082200180549161198483613715565b919050555060368210156119a8576000818152601b602052604090208290556119ba565b6000818152601a602052604090208290555b600a6119c734600761372c565b6119d191906136d2565b601760008282546119e29190613525565b90915550600a90506119f534600361372c565b6119ff91906136d2565b60186000828254611a109190613525565b90915550506000818152601c60205260408120805491611a2f836136fc565b9190505550610dfe6001600955565b606060048054610bdd906134be565b611a55612899565b6015556016805460ff19166001179055565b6060601e805480602002602001604051908101604052809291908181526020018280548015610c565760200282019190600052602060002090815481526020019060010190808311611016575050505050905090565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b836daaeb6d7670e522a718067333cd4e3b15611c7557336001600160a01b03821603611b6057611b5b85858585612acb565b611c81565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611baf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd391906134f2565b8015611c565750604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611c32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5691906134f2565b611c7557604051633b79c77360e21b8152336004820152602401610deb565b611c8185858585612acb565b5050505050565b6000611c92612899565b60165460ff610100909104161515600114611cef5760405162461bcd60e51b815260206004820152601860248201527f67616d6520686173206e6f7420737461727465642079657400000000000000006044820152606401610deb565b60165460ff1615611d335760405162461bcd60e51b815260206004820152600e60248201526d19d85b59481a185cc8195b99195960921b6044820152606401610deb565b6000306001600160a01b031663044f661f6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611d73573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d9b919081019061374b565b90506000601e8054905082600081518110611db857611db86136e6565b6020026020010151611dca91906136be565b9050600060205483600181518110611de457611de46136e6565b6020026020010151611df691906136be565b905060008290506000601e8281548110611e1257611e126136e6565b906000526020600020015490505b82811015611e8457601e54611e37906001906137dc565b8203611e465760009150611e54565b81611e50816136fc565b9250505b601e8281548110611e6757611e676136e6565b906000526020600020015481611e7d9190613525565b9050611e20565b601e8281548110611e9757611e976136e6565b9060005260206000200154602054611eaf91906137dc565b6020819055506000601e8381548110611eca57611eca6136e6565b6000918252602080832090910192909255838152601d90915260408120805460ff1916600117905560138390556014805491611f05836136fc565b90915550919550505050505090565b6060611f1f82612613565b611f3c57604051630a14c4b560e41b815260040160405180910390fd5b6000611f46612b0f565b90508051600003611f665760405180602001604052806000815250611f91565b80611f7084612b1e565b604051602001611f819291906137f3565b6040516020818303038152906040525b9392505050565b611fa0612899565b60165460ff161515600114611ff15760405162461bcd60e51b815260206004820152601760248201527623b0b6b29034b99039ba34b6361034b71030b1ba34b7b760491b6044820152606401610deb565b60006018541161203a5760405162461bcd60e51b81526020600482015260146024820152734e6f2066756e647320746f20776974686472617760601b6044820152606401610deb565b601854604051339180156108fc02916000818181858888f19350505050158015612068573d6000803e3d6000fd5b506000601855565b612078612a58565b612081816111cc565b6001600160a01b0316336001600160a01b0316146120d75760405162461bcd60e51b815260206004820152601360248201527226bab9ba103132903a37b5b2b71037bbb732b960691b6044820152606401610deb565b6120e081611656565b156121235760405162461bcd60e51b8152602060048201526013602482015272151bdad95b881a5cc8195b1a5b5a5b985d1959606a1b6044820152606401610deb565b60008181526019602052604090205460ff16156121825760405162461bcd60e51b815260206004820152601f60248201527f546f6b656e2068617320636c61696d6564207072697a6520616c7265616479006044820152606401610deb565b60165460ff1615156001146121d35760405162461bcd60e51b815260206004820152601760248201527623b0b6b29034b99039ba34b6361034b71030b1ba34b7b760491b6044820152606401610deb565b6015546000036122125760405162461bcd60e51b815260206004820152600a6024820152694e6f2077696e6e65727360b01b6044820152606401610deb565b6000818152601960205260408120805460ff1916600117905560155460175461223b91906136d2565b604051909150339082156108fc029083906000818181858888f1935050505015801561226b573d6000803e3d6000fd5b50506122776001600955565b50565b6000818152600a6020526040812054606090610100900460ff166122d45760405162461bcd60e51b81526020600482015260116024820152701c995c5d595cdd081b9bdd08199bdd5b99607a1b6044820152606401610deb565b6000838152600a602090815260408083208151606081018352815460ff808216151583526101009091041615158185015260018201805484518187028101870186528181529295939486019383018282801561234f57602002820191906000526020600020905b81548152602001906001019080831161233b575b5050505050815250509050806000015181604001519250925050915091565b6000612378612899565b600b54600e54600f546040516305d3b1d360e41b81526004810192909252600160a01b830467ffffffffffffffff166024830152640100000000810461ffff16604483015263ffffffff808216606484015266010000000000009091041660848201526001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af115801561240f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124339190613822565b6040805160608101825260008082526001602080840182815285518481528083018752858701908152878552600a83529590932084518154945161ffff1990951690151561ff001916176101009415159490940293909317835593518051959650929491936124a89391850192910190612f0e565b5050600c80546001810182556000919091527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c70182905550600d8190556040518181527f0cd21a41891ff04ecd9a8754bec97e2fb85d2a4e7694329d4dc364c796f23d069060200160405180910390a190565b60008060005b6002546001540381101561255d5761253881611656565b1561254b5781612547816136fc565b9250505b80612555816136fc565b915050612521565b50919050565b61256b612f49565b506040805180820182526000838152601a6020908152838220548352938152601b845291909120549181019190915290565b6125a5612899565b6001600160a01b03811661260a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610deb565b61227781612a08565b600060015482108015610b34575050600090815260056020526040902054600160e01b161590565b6000828152600a6020526040902054610100900460ff166126925760405162461bcd60e51b81526020600482015260116024820152701c995c5d595cdd081b9bdd08199bdd5b99607a1b6044820152606401610deb565b6000828152600a60209081526040909120805460ff19166001908117825583516126c3939290910191840190612f0e565b507ffe2e2d779dba245964d4e3ef9b994be63856fd568bf7d3ca9e224755cb1bd54d82826040516126f592919061383b565b60405180910390a15050565b600061270c8261290e565b9050836001600160a01b0316816001600160a01b03161461273f5760405162a1148160e81b815260040160405180910390fd5b60008281526007602052604090208054338082146001600160a01b0388169091141761278c5761276f8633610a42565b61278c57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166127b357604051633a954ecd60e21b815260040160405180910390fd5b80156127be57600082555b6001600160a01b038681166000908152600660205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260056020526040812091909155600160e11b841690036128505760018401600081815260056020526040812054900361284e57600154811461284e5760008181526005602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6000546001600160a01b0316331461141c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610deb565b6111a583838360405180602001604052806000815250611b29565b60008160015481101561295c5760008181526005602052604081205490600160e01b8216900361295a575b80600003611f91575060001901600081815260056020526040902054612939565b505b604051636f96cda160e11b815260040160405180910390fd5b6060600061298283612b62565b600101905060008167ffffffffffffffff8111156129a2576129a26130c2565b6040519080825280601f01601f1916602001820160405280156129cc576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846129d657509392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600260095403612aaa5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610deb565b6002600955565b610dfe828260405180602001604052806000815250612c3a565b612ad6848484610e02565b6001600160a01b0383163b15610f5857612af284848484612ca0565b610f58576040516368d2bf6b60e11b815260040160405180910390fd5b606060218054610bdd906134be565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480612b385750819003601f19909101908152919050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612ba15772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612bcd576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612beb57662386f26fc10000830492506010015b6305f5e1008310612c03576305f5e100830492506008015b6127108310612c1757612710830492506004015b60648310612c29576064830492506002015b600a8310610b345760010192915050565b612c448383612d8c565b6001600160a01b0383163b156111a5576001548281035b612c6e6000868380600101945086612ca0565b612c8b576040516368d2bf6b60e11b815260040160405180910390fd5b818110612c5b578160015414611c8157600080fd5b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612cd5903390899088908890600401613854565b6020604051808303816000875af1925050508015612d10575060408051601f3d908101601f19168201909252612d0d91810190613891565b60015b612d6e573d808015612d3e576040519150601f19603f3d011682016040523d82523d6000602084013e612d43565b606091505b508051600003612d66576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6001546000829003612db15760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526006602090815260408083208054680100000000000000018802019055848352600590915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b818114612e6057808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101612e28565b5081600003612e8157604051622e076360e81b815260040160405180910390fd5b60015550505050565b828054612e96906134be565b90600052602060002090601f016020900481019282612eb85760008555612efe565b82601f10612ed15782800160ff19823516178555612efe565b82800160010185558215612efe579182015b82811115612efe578235825591602001919060010190612ee3565b50612f0a929150612f67565b5090565b828054828255906000526020600020908101928215612efe579160200282015b82811115612efe578251825591602001919060010190612f2e565b60405180604001604052806002906020820280368337509192915050565b5b80821115612f0a5760008155600101612f68565b6001600160e01b03198116811461227757600080fd5b600060208284031215612fa457600080fd5b8135611f9181612f7c565b600081518084526020808501945080840160005b83811015612fdf57815187529582019590820190600101612fc3565b509495945050505050565b602081526000611f916020830184612faf565b60005b83811015613018578181015183820152602001613000565b83811115610f585750506000910152565b60008151808452613041816020860160208601612ffd565b601f01601f19169290920160200192915050565b602081526000611f916020830184613029565b60006020828403121561307a57600080fd5b5035919050565b80356001600160a01b03811681146116b257600080fd5b600080604083850312156130ab57600080fd5b6130b483613081565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613101576131016130c2565b604052919050565b600067ffffffffffffffff821115613123576131236130c2565b5060051b60200190565b6000806040838503121561314057600080fd5b8235915060208084013567ffffffffffffffff81111561315f57600080fd5b8401601f8101861361317057600080fd5b803561318361317e82613109565b6130d8565b81815260059190911b820183019083810190888311156131a257600080fd5b928401925b828410156131c0578335825292840192908401906131a7565b80955050505050509250929050565b6000806000606084860312156131e457600080fd5b6131ed84613081565b92506131fb60208501613081565b9150604084013590509250925092565b6000806020838503121561321e57600080fd5b823567ffffffffffffffff8082111561323657600080fd5b818501915085601f83011261324a57600080fd5b81358181111561325957600080fd5b86602082850101111561326b57600080fd5b60209290920196919550909350505050565b801515811461227757600080fd5b60006020828403121561329d57600080fd5b8135611f918161327d565b6000602082840312156132ba57600080fd5b611f9182613081565b600080602083850312156132d657600080fd5b823567ffffffffffffffff808211156132ee57600080fd5b818501915085601f83011261330257600080fd5b81358181111561331157600080fd5b8660208260051b850101111561326b57600080fd5b6000806040838503121561333957600080fd5b50508035926020909101359150565b6000806040838503121561335b57600080fd5b61336483613081565b915060208301356133748161327d565b809150509250929050565b6000806000806080858703121561339557600080fd5b61339e85613081565b935060206133ad818701613081565b935060408601359250606086013567ffffffffffffffff808211156133d157600080fd5b818801915088601f8301126133e557600080fd5b8135818111156133f7576133f76130c2565b613409601f8201601f191685016130d8565b9150808252898482850101111561341f57600080fd5b808484018584013760008482840101525080935050505092959194509250565b8215158152604060208201526000612d846040830184612faf565b60408101818360005b6002811015613482578151835260209283019290910190600101613463565b50505092915050565b6000806040838503121561349e57600080fd5b6134a783613081565b91506134b560208401613081565b90509250929050565b600181811c908216806134d257607f821691505b60208210810361255d57634e487b7160e01b600052602260045260246000fd5b60006020828403121561350457600080fd5b8151611f918161327d565b634e487b7160e01b600052601160045260246000fd5b600082198211156135385761353861350f565b500190565b6000815161354f818560208601612ffd565b9290920192915050565b6b3d93b432b0b233b2b0b9139d60a11b81526000885161358081600c850160208d01612ffd565b6f1613b432b0b233b2b0b922b634b6939d60811b600c9184019182015288516135b081601c840160208d01612ffd565b691613b7baba3334ba139d60b11b601c929091019182015287516135db816026840160208c01612ffd565b6d1613b7baba3334ba22b634b6939d60911b60269290910191820152865161360a816034840160208b01612ffd565b711613b1b7b6b83632ba32b63ca2b634b6939d60711b6034929091019182015261369a61368d61368761366b613665613646604687018c61353d565b721613b430b9a1b630b4b6b2b2283934bd32939d60691b815260130190565b8961353d565b6f1613bab833b930b232a1b7bab73a139d60811b815260100190565b8661353d565b607d60f81b815260010190565b9a9950505050505050505050565b634e487b7160e01b600052601260045260246000fd5b6000826136cd576136cd6136a8565b500690565b6000826136e1576136e16136a8565b500490565b634e487b7160e01b600052603260045260246000fd5b60006001820161370e5761370e61350f565b5060010190565b6000816137245761372461350f565b506000190190565b60008160001904831182151516156137465761374661350f565b500290565b6000602080838503121561375e57600080fd5b825167ffffffffffffffff81111561377557600080fd5b8301601f8101851361378657600080fd5b805161379461317e82613109565b81815260059190911b820183019083810190878311156137b357600080fd5b928401925b828410156137d1578351825292840192908401906137b8565b979650505050505050565b6000828210156137ee576137ee61350f565b500390565b60008351613805818460208801612ffd565b835190830190613819818360208801612ffd565b01949350505050565b60006020828403121561383457600080fd5b5051919050565b828152604060208201526000612d846040830184612faf565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061388790830184613029565b9695505050505050565b6000602082840312156138a357600080fd5b8151611f9181612f7c56fea2646970667358221220656370b027d175d2c3b57efd39e3aa0d876c0a1df6f0e839cd23d3836de3761664736f6c634300080d0033

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

000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000002b600000000000000000000000000000000000000000000000000000000000000174772756d626965732047656e6573697320426174746c6500000000000000000000000000000000000000000000000000000000000000000000000000000000034747420000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name (string): Grumbies Genesis Battle
Arg [1] : symbol (string): GGB
Arg [2] : subscriptionId (uint64): 694

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 00000000000000000000000000000000000000000000000000000000000002b6
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000017
Arg [4] : 4772756d626965732047656e6573697320426174746c65000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [6] : 4747420000000000000000000000000000000000000000000000000000000000


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.