RugPoolz #0 (RP)

Overview

TokenID

43

Total Transfers

-

Market

Onchain Market Cap

-

Circulating Supply Market Cap

-
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information

Contract Source Code Verified (Exact Match)

Contract Name:
RugPool

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 1000 runs

Other Settings:
paris EvmVersion
File 1 of 16 : RugPool.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import {ERC721A} from "erc721a/contracts/ERC721A.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
// Local imports
import {IPoolSync} from "./Interfaces/IPoolSync.sol";
import {Pool} from "./Structs/Pool.sol";
import {Base64} from "./Utils/Base64.sol";
import {RNGLib} from "./Utils/RNGLib.sol";
import {StringConverter} from "./Utils/StringConverter.sol";

contract RugPool is ERC721A, ERC2981, ReentrancyGuard {
    // All data for Pool
    Pool internal poolData;
    // Contract synchronizes pool events
    address public poolSync;
    // The selected ID
    uint256 public rugger;
    // Token Image for Secondary Markets
    string public imageURI;
    // Beneficiary address
    address public beneficiary;
    // Pool Completed Flag
    bool public rugged;

    // Custom Errors
    error ERC20Error();
    error InvalidEntryQuantity();
    error MintedOut();
    error NotEnoughTokens();
    error NotExpiredYet();
    error PoolAlreadyRugged();

    constructor(uint256 _id,
                address _creator,
                address _token, 
                uint256 _price, 
                uint256 _maxEntries, 
                uint256 _end,
                uint256[2] memory _feePercentage,
                address _beneficiary,
                address _poolSync,
                string memory _poolURI) 
    ERC721A(string(abi.encodePacked("RugPoolz #", _toString(_id))), "RP")
    {
        // Storing Pool Data
        poolData.id = _id;
        poolData.creator = _creator;
        poolData.token = _token;
        poolData.price = _price;
        poolData.maxEntries = _maxEntries;
        poolData.end = _end;
        poolData.protocolPercent = _feePercentage[0];
        poolData.creatorPercent = _feePercentage[1];
        beneficiary = _beneficiary;
        poolSync = _poolSync;
        imageURI = _poolURI;
        _setDefaultRoyalty(beneficiary, 250);
    }

    /// @notice Buy a entry for pool
    /// @param quantity number of entries to buy in ERC-20 token
    function buyEntry(uint256 quantity) external nonReentrant() {
        if(quantity < 1) { revert InvalidEntryQuantity(); }
        if(totalSupply() + quantity > poolData.maxEntries) { revert MintedOut(); }
        processFees(poolData.price * quantity);
        // Mint Entry
        _mint(msg.sender, quantity);

        IPoolSync(poolSync).entriesMinted(address(this), msg.sender, quantity);
    }

    function getPoolData() external view returns(Pool memory){
        return poolData;
    }

    /// @notice Use Gelato RNG library to determine rugger
    function rugPool() external nonReentrant {
        if(totalSupply() < poolData.maxEntries) {
            if(poolData.end > block.timestamp) { revert NotExpiredYet(); }
        }

        if(rugged) { revert PoolAlreadyRugged(); }
        // CALL RNG 0 - totalSupply
        rugger = RNGLib.revealRugger(poolData.id, totalSupply(), string(abi.encodePacked(msg.sender, poolData.end, 
                                                            poolData.creator, poolData.token)));
        poolData.selectedNFT = rugger;
        address ruggerAddress = ownerOf(rugger);
        // Rug the Pool
        rugged = true;
        uint256 poolBalance = IERC20(poolData.token).balanceOf(address(this));
        if(!IERC20(poolData.token).transfer(ruggerAddress, poolBalance)) { revert ERC20Error(); }
        IPoolSync(poolSync).resultsDrawn(address(this), ruggerAddress, rugger, poolBalance);
    }

    /// @notice Process the payment distribution between Protocol, Creator, and Rugger
    function processFees(uint256 _totalCost) internal {
        uint256 _protocolFee;
        uint256 _creatorFee;
        // Prevent Divide by 0 if protocol fees are off
        if(poolData.protocolPercent > 0)
        {
            // Protocol Fee
             _protocolFee = _totalCost * poolData.protocolPercent / 1e18;
            if(!IERC20(poolData.token).transferFrom(msg.sender, beneficiary, _protocolFee)) { revert ERC20Error(); }
        }
        // Prevent Divide by 0 if creator fees are off
        if(poolData.creatorPercent > 0)
        {
        // Creator Fee
        _creatorFee = _totalCost * poolData.creatorPercent / 1e18;
        if(!IERC20(poolData.token).transferFrom(msg.sender, poolData.creator, _creatorFee)) { revert ERC20Error(); }
        }
        _totalCost = _totalCost - (_protocolFee + _creatorFee);
        // Collect Tokens or Revert
        if(!IERC20(poolData.token).transferFrom(msg.sender, address(this), _totalCost)) { revert ERC20Error(); }
        IPoolSync(poolSync).processedFees(address(this), _protocolFee, poolData.creator, _creatorFee);
    }

    /// @notice Returns the baseURI
    /// @dev Metadata is base64 encoded (on-chain metadata)
    /// @param tokenId the token id you are trying to retrieve the tokenURI for
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        return
            string(
                abi.encodePacked(
                    "data:application/json;base64,",
                    Base64.encode(
                        bytes(_generateMetadata(tokenId))
                    )
                )
            );
    }

    function _generateMetadata(uint256 _id) internal view returns (string memory baseURI) {
        string memory result;
        if(rugged) { if(_id == rugger){result = "WINNER";} else {result = "LOSER";}} else { result = "PENDING"; }
        string memory tokenAddress = StringConverter.toAsciiString(poolData.token);
        baseURI = string(abi.encodePacked('{"name":"RugPool #', _toString(poolData.id), 
        ' [Entry # ', _toString(_id), ']","description": "This NFT represents an entry in a',
        'Rug Poolz pool. Only the NFT selected to be the claimer can collect the pool. Burn after use"'));

        baseURI = string(abi.encodePacked(baseURI, 
        ', "image": "', imageURI, '0x', tokenAddress, '.png","attributes":[',
        '{"trait_type": "Pool Expires", "value": "', StringConverter.formatDate(poolData.end) ,'"},', 
        '{"trait_type": "Cost", "value": "', StringConverter.decimalString(poolData.price, 18, false), '"},'));
        baseURI = string(abi.encodePacked(baseURI, '{"trait_type": "Token","value": "0x', tokenAddress, '"},',
        '{"trait_type": "Result", "value": "', result, '"}]}'));
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, ERC2981) returns (bool) {
        // Supports the following `interfaceId`s:
        // - IERC165: 0x01ffc9a7
        // - IERC721: 0x80ac58cd
        // - IERC721Metadata: 0x5b5e139f
        // - IERC2981: 0x2a55205a
        return 
            ERC721A.supportsInterface(interfaceId) || 
            ERC2981.supportsInterface(interfaceId);
    }
}

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

pragma solidity ^0.8.20;

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

        return (royalty.receiver, royaltyAmount);
    }

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

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

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

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

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

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

File 4 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

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

pragma solidity ^0.8.20;

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

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

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

pragma solidity ^0.8.20;

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

File 7 of 16 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

File 8 of 16 : IPoolSync.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

interface IPoolSync {

    function entriesMinted(address _pool, address _minter, uint256 _quantity) external;

    function newPool(address _pool, uint256 _id, address _token) external;

    function processedFees(address _pool, uint256 _protocolFee, address _creatorAddress, uint256 _creatorFee) external;

    function resultsDrawn(address _pool, address _rugger, uint256 _ruggerId, uint256 _poolBalance) external;
}

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

/// @dev With modifications, the below taken 
/// @notice from:
/// https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/libraries/NFTDescriptor.sol#L189-L231
struct DecimalStringParams {
    // significant figures of decimal
    uint256 sigfigs;
    // length of decimal string
    uint8 bufferLength;
    // ending index for significant figures (funtion works backwards when copying sigfigs)
    uint8 sigfigIndex;
    // index of decimal place (0 if no decimal)
    uint8 decimalIndex;
    // start index for trailing/leading 0's for very small/large numbers
    uint8 zerosStartIndex;
    // end index for trailing/leading 0's for very small/large numbers
    uint8 zerosEndIndex;
    // true if decimal number is less than one
    bool isLessThanOne;
    // true if string should include "%"
    bool isPercent;
}

File 10 of 16 : Pool.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

struct Pool {
    uint256 id;
    // Creator of Pool
    address creator;
    // Maximum Number of entries.
    uint256 maxEntries;
    // Token used
    address token;
    // Cost per Ticket
    uint256 price;
    // Ticket Sale Ends
    uint256 end;
    // Selected NFT
    uint256 selectedNFT;
    // Creator Fee
    uint256 creatorPercent;
    // Protocol Percent
    uint256 protocolPercent;
}

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

/// [MIT License]
/// @title Base64
/// @notice Provides a function for encoding some bytes in base64
/// @author Brecht Devos <[email protected]>
library Base64 {
    bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /// @notice Encodes some bytes to the base64 representation
    function encode(bytes memory data) internal pure returns (string memory) {
        uint256 len = data.length;
        if (len == 0) return "";

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((len + 2) / 3);

        // Add some extra buffer at the end
        bytes memory result = new bytes(encodedLen + 32);

        bytes memory table = TABLE;

        assembly {
            let tablePtr := add(table, 1)
            let resultPtr := add(result, 32)

            for {
                let i := 0
            } lt(i, len) {

            } {
                i := add(i, 3)
                let input := and(mload(add(data, i)), 0xffffff)

                let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
                out := shl(8, out)
                out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF))
                out := shl(8, out)
                out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF))
                out := shl(8, out)
                out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF))
                out := shl(224, out)

                mstore(resultPtr, out)

                resultPtr := add(resultPtr, 4)
            }

            switch mod(len, 3)
            case 1 {
                mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
            }
            case 2 {
                mstore(sub(resultPtr, 1), shl(248, 0x3d))
            }

            mstore(result, encodedLen)
        }

        return string(result);
    }
}

File 12 of 16 : BokkyPooBahsDateTimeLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;

// ----------------------------------------------------------------------------
// BokkyPooBah's DateTime Library v1.01
//
// A gas-efficient Solidity date and time library
//
// https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary
//
// Tested date range 1970/01/01 to 2345/12/31
//
// Conventions:
// Unit      | Range         | Notes
// :-------- |:-------------:|:-----
// timestamp | >= 0          | Unix timestamp, number of seconds since 1970/01/01 00:00:00 UTC
// year      | 1970 ... 2345 |
// month     | 1 ... 12      |
// day       | 1 ... 31      |
// hour      | 0 ... 23      |
// minute    | 0 ... 59      |
// second    | 0 ... 59      |
// dayOfWeek | 1 ... 7       | 1 = Monday, ..., 7 = Sunday
//
//
// Enjoy. (c) BokkyPooBah / Bok Consulting Pty Ltd 2018-2019. The MIT Licence.
// ----------------------------------------------------------------------------

library BokkyPooBahsDateTimeLibrary {

    uint constant SECONDS_PER_DAY = 24 * 60 * 60;
    uint constant SECONDS_PER_HOUR = 60 * 60;
    uint constant SECONDS_PER_MINUTE = 60;
    int constant OFFSET19700101 = 2440588;

    uint constant DOW_MON = 1;
    uint constant DOW_TUE = 2;
    uint constant DOW_WED = 3;
    uint constant DOW_THU = 4;
    uint constant DOW_FRI = 5;
    uint constant DOW_SAT = 6;
    uint constant DOW_SUN = 7;

    // ------------------------------------------------------------------------
    // Calculate the number of days from 1970/01/01 to year/month/day using
    // the date conversion algorithm from
    //   https://aa.usno.navy.mil/faq/JD_formula.html
    // and subtracting the offset 2440588 so that 1970/01/01 is day 0
    //
    // days = day
    //      - 32075
    //      + 1461 * (year + 4800 + (month - 14) / 12) / 4
    //      + 367 * (month - 2 - (month - 14) / 12 * 12) / 12
    //      - 3 * ((year + 4900 + (month - 14) / 12) / 100) / 4
    //      - offset
    // ------------------------------------------------------------------------
    function _daysFromDate(uint year, uint month, uint day) internal pure returns (uint _days) {
        require(year >= 1970);
        int _year = int(year);
        int _month = int(month);
        int _day = int(day);

        int __days = _day
          - 32075
          + 1461 * (_year + 4800 + (_month - 14) / 12) / 4
          + 367 * (_month - 2 - (_month - 14) / 12 * 12) / 12
          - 3 * ((_year + 4900 + (_month - 14) / 12) / 100) / 4
          - OFFSET19700101;

        _days = uint(__days);
    }

    // ------------------------------------------------------------------------
    // Calculate year/month/day from the number of days since 1970/01/01 using
    // the date conversion algorithm from
    //   http://aa.usno.navy.mil/faq/docs/JD_Formula.php
    // and adding the offset 2440588 so that 1970/01/01 is day 0
    //
    // int L = days + 68569 + offset
    // int N = 4 * L / 146097
    // L = L - (146097 * N + 3) / 4
    // year = 4000 * (L + 1) / 1461001
    // L = L - 1461 * year / 4 + 31
    // month = 80 * L / 2447
    // dd = L - 2447 * month / 80
    // L = month / 11
    // month = month + 2 - 12 * L
    // year = 100 * (N - 49) + year + L
    // ------------------------------------------------------------------------
    function _daysToDate(uint _days) internal pure returns (uint year, uint month, uint day) {
        int __days = int(_days);

        int L = __days + 68569 + OFFSET19700101;
        int N = 4 * L / 146097;
        L = L - (146097 * N + 3) / 4;
        int _year = 4000 * (L + 1) / 1461001;
        L = L - 1461 * _year / 4 + 31;
        int _month = 80 * L / 2447;
        int _day = L - 2447 * _month / 80;
        L = _month / 11;
        _month = _month + 2 - 12 * L;
        _year = 100 * (N - 49) + _year + L;

        year = uint(_year);
        month = uint(_month);
        day = uint(_day);
    }

    function timestampFromDate(uint year, uint month, uint day) internal pure returns (uint timestamp) {
        timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY;
    }
    function timestampFromDateTime(uint year, uint month, uint day, uint hour, uint minute, uint second) internal pure returns (uint timestamp) {
        timestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + hour * SECONDS_PER_HOUR + minute * SECONDS_PER_MINUTE + second;
    }
    function timestampToDate(uint timestamp) internal pure returns (uint year, uint month, uint day) {
        (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }
    function timestampToDateTime(uint timestamp) internal pure returns (uint year, uint month, uint day, uint hour, uint minute, uint second) {
        (year, month, day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        uint secs = timestamp % SECONDS_PER_DAY;
        hour = secs / SECONDS_PER_HOUR;
        secs = secs % SECONDS_PER_HOUR;
        minute = secs / SECONDS_PER_MINUTE;
        second = secs % SECONDS_PER_MINUTE;
    }

    function isValidDate(uint year, uint month, uint day) internal pure returns (bool valid) {
        if (year >= 1970 && month > 0 && month <= 12) {
            uint daysInMonth = _getDaysInMonth(year, month);
            if (day > 0 && day <= daysInMonth) {
                valid = true;
            }
        }
    }
    function isValidDateTime(uint year, uint month, uint day, uint hour, uint minute, uint second) internal pure returns (bool valid) {
        if (isValidDate(year, month, day)) {
            if (hour < 24 && minute < 60 && second < 60) {
                valid = true;
            }
        }
    }
    function isLeapYear(uint timestamp) internal pure returns (bool leapYear) {
        (uint year,,) = _daysToDate(timestamp / SECONDS_PER_DAY);
        leapYear = _isLeapYear(year);
    }
    function _isLeapYear(uint year) internal pure returns (bool leapYear) {
        leapYear = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
    }
    function isWeekDay(uint timestamp) internal pure returns (bool weekDay) {
        weekDay = getDayOfWeek(timestamp) <= DOW_FRI;
    }
    function isWeekEnd(uint timestamp) internal pure returns (bool weekEnd) {
        weekEnd = getDayOfWeek(timestamp) >= DOW_SAT;
    }
    function getDaysInMonth(uint timestamp) internal pure returns (uint daysInMonth) {
        (uint year, uint month,) = _daysToDate(timestamp / SECONDS_PER_DAY);
        daysInMonth = _getDaysInMonth(year, month);
    }
    function _getDaysInMonth(uint year, uint month) internal pure returns (uint daysInMonth) {
        if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
            daysInMonth = 31;
        } else if (month != 2) {
            daysInMonth = 30;
        } else {
            daysInMonth = _isLeapYear(year) ? 29 : 28;
        }
    }
    // 1 = Monday, 7 = Sunday
    function getDayOfWeek(uint timestamp) internal pure returns (uint dayOfWeek) {
        uint _days = timestamp / SECONDS_PER_DAY;
        dayOfWeek = (_days + 3) % 7 + 1;
    }

    function getYear(uint timestamp) internal pure returns (uint year) {
        (year,,) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }
    function getMonth(uint timestamp) internal pure returns (uint month) {
        (,month,) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }
    function getDay(uint timestamp) internal pure returns (uint day) {
        (,,day) = _daysToDate(timestamp / SECONDS_PER_DAY);
    }
    function getHour(uint timestamp) internal pure returns (uint hour) {
        uint secs = timestamp % SECONDS_PER_DAY;
        hour = secs / SECONDS_PER_HOUR;
    }
    function getMinute(uint timestamp) internal pure returns (uint minute) {
        uint secs = timestamp % SECONDS_PER_HOUR;
        minute = secs / SECONDS_PER_MINUTE;
    }
    function getSecond(uint timestamp) internal pure returns (uint second) {
        second = timestamp % SECONDS_PER_MINUTE;
    }

    function addYears(uint timestamp, uint _years) internal pure returns (uint newTimestamp) {
        (uint year, uint month, uint day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        year += _years;
        uint daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY;
        require(newTimestamp >= timestamp);
    }
    function addMonths(uint timestamp, uint _months) internal pure returns (uint newTimestamp) {
        (uint year, uint month, uint day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        month += _months;
        year += (month - 1) / 12;
        month = (month - 1) % 12 + 1;
        uint daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY;
        require(newTimestamp >= timestamp);
    }
    function addDays(uint timestamp, uint _days) internal pure returns (uint newTimestamp) {
        newTimestamp = timestamp + _days * SECONDS_PER_DAY;
        require(newTimestamp >= timestamp);
    }
    function addHours(uint timestamp, uint _hours) internal pure returns (uint newTimestamp) {
        newTimestamp = timestamp + _hours * SECONDS_PER_HOUR;
        require(newTimestamp >= timestamp);
    }
    function addMinutes(uint timestamp, uint _minutes) internal pure returns (uint newTimestamp) {
        newTimestamp = timestamp + _minutes * SECONDS_PER_MINUTE;
        require(newTimestamp >= timestamp);
    }
    function addSeconds(uint timestamp, uint _seconds) internal pure returns (uint newTimestamp) {
        newTimestamp = timestamp + _seconds;
        require(newTimestamp >= timestamp);
    }

    function subYears(uint timestamp, uint _years) internal pure returns (uint newTimestamp) {
        (uint year, uint month, uint day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        year -= _years;
        uint daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY;
        require(newTimestamp <= timestamp);
    }
    function subMonths(uint timestamp, uint _months) internal pure returns (uint newTimestamp) {
        (uint year, uint month, uint day) = _daysToDate(timestamp / SECONDS_PER_DAY);
        uint yearMonth = year * 12 + (month - 1) - _months;
        year = yearMonth / 12;
        month = yearMonth % 12 + 1;
        uint daysInMonth = _getDaysInMonth(year, month);
        if (day > daysInMonth) {
            day = daysInMonth;
        }
        newTimestamp = _daysFromDate(year, month, day) * SECONDS_PER_DAY + timestamp % SECONDS_PER_DAY;
        require(newTimestamp <= timestamp);
    }
    function subDays(uint timestamp, uint _days) internal pure returns (uint newTimestamp) {
        newTimestamp = timestamp - _days * SECONDS_PER_DAY;
        require(newTimestamp <= timestamp);
    }
    function subHours(uint timestamp, uint _hours) internal pure returns (uint newTimestamp) {
        newTimestamp = timestamp - _hours * SECONDS_PER_HOUR;
        require(newTimestamp <= timestamp);
    }
    function subMinutes(uint timestamp, uint _minutes) internal pure returns (uint newTimestamp) {
        newTimestamp = timestamp - _minutes * SECONDS_PER_MINUTE;
        require(newTimestamp <= timestamp);
    }
    function subSeconds(uint timestamp, uint _seconds) internal pure returns (uint newTimestamp) {
        newTimestamp = timestamp - _seconds;
        require(newTimestamp <= timestamp);
    }

    function diffYears(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _years) {
        require(fromTimestamp <= toTimestamp);
        (uint fromYear,,) = _daysToDate(fromTimestamp / SECONDS_PER_DAY);
        (uint toYear,,) = _daysToDate(toTimestamp / SECONDS_PER_DAY);
        _years = toYear - fromYear;
    }
    function diffMonths(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _months) {
        require(fromTimestamp <= toTimestamp);
        (uint fromYear, uint fromMonth,) = _daysToDate(fromTimestamp / SECONDS_PER_DAY);
        (uint toYear, uint toMonth,) = _daysToDate(toTimestamp / SECONDS_PER_DAY);
        _months = toYear * 12 + toMonth - fromYear * 12 - fromMonth;
    }
    function diffDays(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _days) {
        require(fromTimestamp <= toTimestamp);
        _days = (toTimestamp - fromTimestamp) / SECONDS_PER_DAY;
    }
    function diffHours(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _hours) {
        require(fromTimestamp <= toTimestamp);
        _hours = (toTimestamp - fromTimestamp) / SECONDS_PER_HOUR;
    }
    function diffMinutes(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _minutes) {
        require(fromTimestamp <= toTimestamp);
        _minutes = (toTimestamp - fromTimestamp) / SECONDS_PER_MINUTE;
    }
    function diffSeconds(uint fromTimestamp, uint toTimestamp) internal pure returns (uint _seconds) {
        require(fromTimestamp <= toTimestamp);
        _seconds = toTimestamp - fromTimestamp;
    }
}

File 13 of 16 : RNGLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @title RNGLib
 * @dev Library providing a simple interface to manage a
 * contract-internal PRNG and pull random numbers from it.
 */
library RNGLib {
    /// @dev Structure to hold the state of the random number generator (RNG).
    struct RNGState {
        bytes32 seed;
        uint256 counter;
    }

    /// @notice Seed a new RNG based on value from a public randomness beacon.
    /// @dev To ensure domain separation, at least one of randomness, chain id, current contract
    /// address, or the domain string must be different between two different RNGs.
    /// @param randomness The value from a public randomness beacon.
    /// @param domain A string that contributes to domain separation.
    /// @return st The initialized RNGState struct.
    function makeRNG(
        uint256 randomness,
        string memory domain
    ) internal view returns (RNGState memory st) {
        st.seed = keccak256(
            abi.encodePacked(randomness, block.chainid, address(this), domain)
        );
        st.counter = 0;
    }

    /// @notice Generate a distinct, uniformly distributed number, and advance the RNG.
    /// @param st The RNGState struct representing the state of the RNG.
    /// @return random A distinct, uniformly distributed number.
    function randomUint256(
        RNGState memory st
    ) internal pure returns (uint256 random) {
        random = uint256(keccak256(abi.encodePacked(st.seed, st.counter)));
        unchecked {
            // It's not possible to call random enough times to overflow
            st.counter++;
        }
    }

    /// @notice Generate a distinct, uniformly distributed number less than max, and advance the RNG
    /// @dev Max is limited to uint224 to ensure modulo bias probability is negligible.
    /// @param st The RNGState struct representing the state of the RNG.
    /// @param max The upper limit for the generated random number (exclusive).
    /// @return A distinct, uniformly distributed number less than max.
    function randomUintLessThan(
        RNGState memory st,
        uint224 max
    ) internal pure returns (uint224) {
        return uint224(randomUint256(st) % max);
    }

    /// @dev Custom function that will return the rugger number using gelato RNGLib
    /// @param rand1 random value to help RNG, this case it's pool ID which will be difrerent every pool
    /// @param rand2 random value to help RNG, this case it's totalMinted which can be different every pool
    /// @param rand3 string made up of multiple random values to help with RNG
    function revealRugger(uint256 rand1, uint256 rand2, string memory rand3) internal view returns(uint256 rugger) {
        RNGState memory rng = makeRNG(rand1 + rand2, rand3);
        rugger = RNGLib.randomUint256(rng) % rand2;
    }
}

File 14 of 16 : StringConverter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../Structs/DecimalStringParams.sol";
import '../Utils/BokkyPooBahsDateTimeLibrary.sol';

library StringConverter {

    function toString(uint256 value) internal pure returns (string memory) {
    // Inspired by OraclizeAPI's implementation - MIT license
    // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
        if (value == 0) {
            return "0";
        }

        uint256 temp = value;
        uint256 digits;

        while (temp != 0) {
            digits++;
            temp /= 10;
        }

        bytes memory buffer = new bytes(digits);

        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }

        return string(buffer);
    }  

    /**
     * @dev Used to display contract address as string
     * @param x address to convert to string
     */
    function toAsciiString(address x) internal pure returns (string memory) {
    bytes memory s = new bytes(40);
    for (uint i = 0; i < 20; i++) {
        bytes1 b = bytes1(uint8(uint(uint160(x)) / (2**(8*(19 - i)))));
        bytes1 hi = bytes1(uint8(b) / 16);
        bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi));
        s[2*i] = char(hi);
        s[2*i+1] = char(lo);            
    }
    return string(s);
}

    /**
     * @dev used by toAsciiString
     * @param b bytes1
     */
    function char(bytes1 b) internal pure returns (bytes1 c) {
       if (uint8(b) < 10) return bytes1(uint8(b) + 0x30);
       else return bytes1(uint8(b) + 0x57);
    }

    /// @notice From https://gist.github.com/wilsoncusack/d2e680e0f961e36393d1bf0b6faafba7
    function decimalString(uint256 number, uint8 decimals, bool isPercent) internal pure returns(string memory){
        uint8 percentBufferOffset = isPercent ? 1 : 0;
        uint256 tenPowDecimals = 10 ** decimals;
        uint256 temp = number;
        uint8 digits;
        uint8 numSigfigs;
        while (temp != 0) {
            if (numSigfigs > 0) {
                // count all digits preceding least significant figure
                numSigfigs++;
            } else if (temp % 10 != 0) {
                numSigfigs++;
            }
            digits++;
            temp /= 10;
        }

        DecimalStringParams memory params;
        params.isPercent = isPercent;
        if((digits - numSigfigs) >= decimals) {
            // no decimals, ensure we preserve all trailing zeros
            params.sigfigs = number / tenPowDecimals;
            params.sigfigIndex = digits - decimals;
            params.bufferLength = params.sigfigIndex + percentBufferOffset;
        } else {
            // chop all trailing zeros for numbers with decimals
            params.sigfigs = number / (10 ** (digits - numSigfigs));
            if(tenPowDecimals > number){
                // number is less tahn one
                // in this case, there may be leading zeros after the decimal place 
                // that need to be added

                // offset leading zeros by two to account for leading '0.'
                params.zerosStartIndex = 2;
                params.zerosEndIndex = decimals - digits + 2;
                params.sigfigIndex = numSigfigs + params.zerosEndIndex;
                params.bufferLength = params.sigfigIndex + percentBufferOffset;
                params.isLessThanOne = true;
            } else {
                // In this case, there are digits before and
                // after the decimal place
                params.sigfigIndex = numSigfigs + 1;
                params.decimalIndex = digits - decimals + 1;
            }
        }
        params.bufferLength = params.sigfigIndex + percentBufferOffset;
        return generateDecimalString(params);
    }

    function generateDecimalString(DecimalStringParams memory params) private pure returns (string memory) {
        bytes memory buffer = new bytes(params.bufferLength);
        if (params.isPercent) {
            buffer[buffer.length - 1] = '%';
        }
        if (params.isLessThanOne) {
            buffer[0] = '0';
            buffer[1] = '.';
        }

        // add leading/trailing 0's
        for (uint256 zerosCursor = params.zerosStartIndex; zerosCursor < params.zerosEndIndex; zerosCursor++) {
            buffer[zerosCursor] = bytes1(uint8(48));
        }
        // add sigfigs
        while (params.sigfigs > 0) {
            if (params.decimalIndex > 0 && params.sigfigIndex == params.decimalIndex) {
                buffer[--params.sigfigIndex] = '.';
            }
            buffer[--params.sigfigIndex] = bytes1(uint8(uint256(48) + (params.sigfigs % 10)));
            params.sigfigs /= 10;
        }
        return string(buffer);
    }

    /// @notice Formats unixtimestamp into readable string
    /// @param _date The timestamp to convert
    function formatDate(uint256 _date) internal pure returns (string memory dateString) {
        (uint year, uint month, 
        uint day, uint hour, 
        uint minute, uint second) = BokkyPooBahsDateTimeLibrary.timestampToDateTime(_date);

        return string(abi.encodePacked(
                      toString(year), '-',
                      toString(month), '-',
                      toString(day), ' ',
                      toString(hour), ':',
                      toString(minute), ':',
                      toString(second), ' UTC'
                )
            );                            
    }
}

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

pragma solidity ^0.8.4;

import './IERC721A.sol';

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _tokenApprovals[tokenId].value;
    }

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

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

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted. See {_mint}.
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool result) {
        if (_startTokenId() <= tokenId) {
            if (tokenId > _sequentialUpTo()) return _packedOwnershipExists(_packedOwnerships[tokenId]);

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfers(from, to, tokenId, 1);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        unchecked {
            if (to.code.length != 0) {
                uint256 end = _currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        _revert(TransferToNonERC721ReceiverImplementer.selector);
                    }
                } while (index < end);
                // This prevents reentrancy to `_safeMint`.
                // It does not prevent reentrancy to `_safeMintSpot`.
                if (_currentIndex != end) revert();
            }
        }
    }

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

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

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

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

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

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

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

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

            ++_spotMinted;
        }

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

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

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

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

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

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

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

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

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

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

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

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

        address from = address(uint160(prevOwnershipPacked));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 16 of 16 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.3.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_creator","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_maxEntries","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"},{"internalType":"uint256[2]","name":"_feePercentage","type":"uint256[2]"},{"internalType":"address","name":"_beneficiary","type":"address"},{"internalType":"address","name":"_poolSync","type":"address"},{"internalType":"string","name":"_poolURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"ERC20Error","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[],"name":"InvalidEntryQuantity","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"MintedOut","type":"error"},{"inputs":[],"name":"NotCompatibleWithSpotMints","type":"error"},{"inputs":[],"name":"NotEnoughTokens","type":"error"},{"inputs":[],"name":"NotExpiredYet","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PoolAlreadyRugged","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"SequentialMintExceedsLimit","type":"error"},{"inputs":[],"name":"SequentialUpToTooSmall","type":"error"},{"inputs":[],"name":"SpotMintTokenIdTooSmall","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"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":[],"name":"beneficiary","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"buyEntry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolData","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint256","name":"maxEntries","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"},{"internalType":"uint256","name":"selectedNFT","type":"uint256"},{"internalType":"uint256","name":"creatorPercent","type":"uint256"},{"internalType":"uint256","name":"protocolPercent","type":"uint256"}],"internalType":"struct Pool","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"imageURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolSync","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rugPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rugged","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rugger","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":"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":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"}]

60806040523480156200001157600080fd5b506040516200385638038062003856833981016040819052620000349162000346565b6200003f8a62000141565b60405160200162000051919062000450565b60408051601f19818403018152828201909152600280835261052560f41b602084015290919062000083838262000515565b50600362000092828262000515565b505060008055506001600b55600c8a9055600d80546001600160a01b038b81166001600160a01b031992831617909255600f80548b84169083161790556010899055600e889055601187905585516014556020860151601355601880548684169083161790556015805492851692909116919091179055601762000117828262000515565b5060185462000131906001600160a01b031660fa62000186565b50505050505050505050620005e1565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806200015b5750819003601f19909101908152919050565b6127106001600160601b038216811015620001cb57604051636f483d0960e01b81526001600160601b0383166004820152602481018290526044015b60405180910390fd5b6001600160a01b038316620001f757604051635b6cc80560e11b815260006004820152602401620001c2565b50604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b80516001600160a01b03811681146200024957600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b03811182821017156200028957620002896200024e565b60405290565b60005b83811015620002ac57818101518382015260200162000292565b50506000910152565b600082601f830112620002c757600080fd5b81516001600160401b0380821115620002e457620002e46200024e565b604051601f8301601f19908116603f011681019082821181831017156200030f576200030f6200024e565b816040528381528660208588010111156200032957600080fd5b6200033c8460208301602089016200028f565b9695505050505050565b6000806000806000806000806000806101608b8d0312156200036757600080fd5b8a51995060206200037b60208d0162000231565b99506200038b60408d0162000231565b985060608c0151975060808c0151965060a08c015195508c60df8d0112620003b257600080fd5b620003bc62000264565b806101008e018f811115620003d057600080fd5b60c08f015b81811015620003ee5780518452928401928401620003d5565b50819750620003fd8162000231565b965050505050620004126101208c0162000231565b6101408c01519092506001600160401b038111156200043057600080fd5b6200043e8d828e01620002b5565b9150509295989b9194979a5092959850565b69527567506f6f6c7a202360b01b8152600082516200047781600a8501602087016200028f565b91909101600a0192915050565b600181811c908216806200049957607f821691505b602082108103620004ba57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000510576000816000526020600020601f850160051c81016020861015620004eb5750805b601f850160051c820191505b818110156200050c57828155600101620004f7565b5050505b505050565b81516001600160401b038111156200053157620005316200024e565b620005498162000542845462000484565b84620004c0565b602080601f831160018114620005815760008415620005685750858301515b600019600386901b1c1916600185901b1785556200050c565b600085815260208120601f198616915b82811015620005b25788860151825594840194600190910190840162000591565b5085821015620005d15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61326580620005f16000396000f3fe6080604052600436106101805760003560e01c806342842e0e116100d6578063b6b40fed1161007f578063e985e9c511610059578063e985e9c514610405578063ec6c92ed1461044e578063fb29238b1461046357600080fd5b8063b6b40fed146103bc578063b88d4fde146103d2578063c87b56dd146103e557600080fd5b8063767d59af116100b0578063767d59af1461036757806395d89b4114610387578063a22cb4651461039c57600080fd5b806342842e0e146103145780636352211e1461032757806370a082311461034757600080fd5b806311ed64441161013857806323b872dd1161011257806323b872dd146102a25780632a55205a146102b557806338af3eed146102f457600080fd5b806311ed64441461024a578063135d088d1461026a57806318160ddd1461027f57600080fd5b806306fdde031161016957806306fdde03146101db578063081812fc146101fd578063095ea7b31461023557600080fd5b806301ffc9a714610185578063033808b4146101ba575b600080fd5b34801561019157600080fd5b506101a56101a03660046124e4565b6104f4565b60405190151581526020015b60405180910390f35b3480156101c657600080fd5b506018546101a590600160a01b900460ff1681565b3480156101e757600080fd5b506101f0610514565b6040516101b19190612558565b34801561020957600080fd5b5061021d61021836600461256b565b6105a6565b6040516001600160a01b0390911681526020016101b1565b61024861024336600461259b565b6105fa565b005b34801561025657600080fd5b5060155461021d906001600160a01b031681565b34801561027657600080fd5b506101f061060a565b34801561028b57600080fd5b50600154600054035b6040519081526020016101b1565b6102486102b03660046125c5565b610698565b3480156102c157600080fd5b506102d56102d0366004612601565b610866565b604080516001600160a01b0390931683526020830191909152016101b1565b34801561030057600080fd5b5060185461021d906001600160a01b031681565b6102486103223660046125c5565b610921565b34801561033357600080fd5b5061021d61034236600461256b565b610941565b34801561035357600080fd5b50610294610362366004612623565b61094c565b34801561037357600080fd5b5061024861038236600461256b565b6109ab565b34801561039357600080fd5b506101f0610af2565b3480156103a857600080fd5b506102486103b736600461264c565b610b01565b3480156103c857600080fd5b5061029460165481565b6102486103e0366004612699565b610b6d565b3480156103f157600080fd5b506101f061040036600461256b565b610bae565b34801561041157600080fd5b506101a5610420366004612775565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561045a57600080fd5b50610248610be7565b34801561046f57600080fd5b50610478610f06565b6040516101b191906000610120820190508251825260208301516001600160a01b0380821660208501526040850151604085015280606086015116606085015250506080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525092915050565b60006104ff82610fcc565b8061050e575061050e8261104c565b92915050565b606060028054610523906127a8565b80601f016020809104026020016040519081016040528092919081815260200182805461054f906127a8565b801561059c5780601f106105715761010080835404028352916020019161059c565b820191906000526020600020905b81548152906001019060200180831161057f57829003601f168201915b5050505050905090565b60006105b18261109a565b6105de576105de7fcf4700e4000000000000000000000000000000000000000000000000000000006110df565b506000908152600660205260409020546001600160a01b031690565b610606828260016110e9565b5050565b60178054610617906127a8565b80601f0160208091040260200160405190810160405280929190818152602001828054610643906127a8565b80156106905780601f1061066557610100808354040283529160200191610690565b820191906000526020600020905b81548152906001019060200180831161067357829003601f168201915b505050505081565b60006106a3826111da565b6001600160a01b0394851694909150811684146106e3576106e37fa1148100000000000000000000000000000000000000000000000000000000006110df565b60008281526006602052604090208054338082146001600160a01b0388169091141761075d576001600160a01b038616600090815260076020908152604080832033845290915290205460ff1661075d5761075d7f59c896be000000000000000000000000000000000000000000000000000000006110df565b801561076857600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036107fa576001840160008181526004602052604081205490036107f85760005481146107f85760008181526004602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a48060000361085d5761085d7fea553b34000000000000000000000000000000000000000000000000000000006110df565b50505050505050565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff169282019290925282916108e55750604080518082019091526009546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b602081015160009061271090610909906bffffffffffffffffffffffff16876127f8565b6109139190612825565b915196919550909350505050565b61093c83838360405180602001604052806000815250610b6d565b505050565b600061050e826111da565b60006001600160a01b038216610985576109857f8f4eb604000000000000000000000000000000000000000000000000000000006110df565b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6109b3611270565b60018110156109ee576040517f5cfd825e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e54816109ff6001546000540390565b610a099190612839565b1115610a41576040517f846fb9e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601054610a5890610a539083906127f8565b6112b3565b610a62338261157d565b6015546040517fd6218a5a000000000000000000000000000000000000000000000000000000008152306004820152336024820152604481018390526001600160a01b039091169063d6218a5a90606401600060405180830381600087803b158015610acd57600080fd5b505af1158015610ae1573d6000803e3d6000fd5b50505050610aef6001600b55565b50565b606060038054610523906127a8565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610b78848484610698565b6001600160a01b0383163b15610ba857610b948484848461166f565b610ba857610ba86368d2bf6b60e11b6110df565b50505050565b6060610bc1610bbc83611752565b6118e3565b604051602001610bd19190612868565b6040516020818303038152906040529050919050565b610bef611270565b600e54600154600054031015610c3b57601154421015610c3b576040517fa8058ea900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601854600160a01b900460ff1615610c7f576040517f523de80500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c54610ceb90610c936001546000540390565b601154600d54600f546040516bffffffffffffffffffffffff1933606090811b82166020840152603483019590955292841b83166054820152921b166068820152607c01604051602081830303815290604052611a84565b60168190556012819055600090610d0190610941565b601880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b179055600f546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610d96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dba91906128ad565b600f546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301526024820184905292935091169063a9059cbb906044016020604051808303816000875af1158015610e28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4c91906128c6565b610e695760405163012c72af60e71b815260040160405180910390fd5b6015546016546040517fbbc151ea0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03858116602483015260448201929092526064810184905291169063bbc151ea90608401600060405180830381600087803b158015610ee057600080fd5b505af1158015610ef4573d6000803e3d6000fd5b505050505050610f046001600b55565b565b610f676040518061012001604052806000815260200160006001600160a01b031681526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b506040805161012081018252600c548152600d546001600160a01b039081166020830152600e5492820192909252600f549091166060820152601054608082015260115460a082015260125460c082015260135460e082015260145461010082015290565b60006301ffc9a760e01b6001600160e01b03198316148061101657507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061050e5750506001600160e01b0319167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b60006001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000148061050e57506301ffc9a760e01b6001600160e01b031983161461050e565b600080548210156110da5760005b50600082815260046020526040812054908190036110d0576110c9836128e3565b92506110a8565b600160e01b161590505b919050565b8060005260046000fd5b60006110f483610941565b905081801561110c5750336001600160a01b03821614155b15611165576001600160a01b038116600090815260076020908152604080832033845290915290205460ff16611165576111657fcfb3b942000000000000000000000000000000000000000000000000000000006110df565b60008381526006602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b6000818152600460205260409020548060000361124d57600054821061120a5761120a636f96cda160e11b6110df565b5b5060001901600081815260046020526040902054801561120b57600160e01b811660000361123857919050565b611248636f96cda160e11b6110df565b61120b565b600160e01b811660000361126057919050565b6110da636f96cda160e11b6110df565b6002600b54036112ac576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600b55565b60145460009081901561137f57601454670de0b6b3a7640000906112d790856127f8565b6112e19190612825565b600f546018546040516323b872dd60e01b81523360048201526001600160a01b0391821660248201526044810184905292945016906323b872dd906064016020604051808303816000875af115801561133e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136291906128c6565b61137f5760405163012c72af60e71b815260040160405180910390fd5b6013541561144657601354670de0b6b3a76400009061139e90856127f8565b6113a89190612825565b600f54600d546040516323b872dd60e01b81523360048201526001600160a01b0391821660248201526044810184905292935016906323b872dd906064016020604051808303816000875af1158015611405573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142991906128c6565b6114465760405163012c72af60e71b815260040160405180910390fd5b6114508183612839565b61145a90846128fa565b600f546040516323b872dd60e01b8152336004820152306024820152604481018390529194506001600160a01b0316906323b872dd906064016020604051808303816000875af11580156114b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d691906128c6565b6114f35760405163012c72af60e71b815260040160405180910390fd5b601554600d546040517f3b46bbc4000000000000000000000000000000000000000000000000000000008152306004820152602481018590526001600160a01b03918216604482015260648101849052911690633b46bbc490608401600060405180830381600087803b15801561156957600080fd5b505af115801561085d573d6000803e3d6000fd5b60008054908290036115b2576115b27fb562e8dd000000000000000000000000000000000000000000000000000000006110df565b60008181526004602090815260408083206001600160a01b0387164260a01b6001881460e11b1781179091558084526005909252822080546801000000000000000186020190559081900361162a5761162a7f2e076300000000000000000000000000000000000000000000000000000000006110df565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a481816001019150810361162f575060005550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906116a490339089908890889060040161290d565b6020604051808303816000875af19250505080156116df575060408051601f3d908101601f191682019092526116dc91810190612949565b60015b611734573d80801561170d576040519150601f19603f3d011682016040523d82523d6000602084013e611712565b606091505b50805160000361172c5761172c6368d2bf6b60e11b6110df565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6018546060908190600160a01b900460ff16156117e65760165483036117ac575060408051808201909152600681527f57494e4e45520000000000000000000000000000000000000000000000000000602082015261181c565b5060408051808201909152600581527f4c4f534552000000000000000000000000000000000000000000000000000000602082015261181c565b5060408051808201909152600781527f50454e44494e470000000000000000000000000000000000000000000000000060208201525b600f54600090611834906001600160a01b0316611ab9565b9050611844600c60000154611bf9565b61184d85611bf9565b60405160200161185e929190612966565b604051602081830303815290604052925082601782611881600c60050154611c3d565b6010546118919060126000611cc4565b6040516020016118a5959493929190612aa9565b60405160208183030381529060405292508281836040516020016118cb93929190612cbc565b60405160208183030381529060405292505050919050565b80516060906000819003611907575050604080516020810190915260008152919050565b60006003611916836002612839565b6119209190612825565b61192b9060046127f8565b9050600061193a826020612839565b67ffffffffffffffff81111561195257611952612683565b6040519080825280601f01601f19166020018201604052801561197c576020820181803683370190505b50905060006040518060600160405280604081526020016131f0604091399050600181016020830160005b86811015611a08576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b8352600490920191016119a7565b506003860660018114611a225760028114611a4e57611a76565b7f3d3d000000000000000000000000000000000000000000000000000000000000600119830152611a76565b7f3d000000000000000000000000000000000000000000000000000000000000006000198301525b505050918152949350505050565b600080611a9a611a948587612839565b84611ebe565b905083611aa682611f0f565b611ab09190612dd6565b95945050505050565b60408051602880825260608281019093526000919060208201818036833701905050905060005b6014811015611bf2576000611af68260136128fa565b611b019060086127f8565b611b0c906002612ece565b611b1f906001600160a01b038716612825565b60f81b9050600060108260f81c611b369190612eda565b60f81b905060008160f81c6010611b4d9190612efc565b8360f81c611b5b9190612f18565b60f81b9050611b6982611f5a565b85611b758660026127f8565b81518110611b8557611b85612f31565b60200101906001600160f81b031916908160001a905350611ba581611f5a565b85611bb18660026127f8565b611bbc906001612839565b81518110611bcc57611bcc612f31565b60200101906001600160f81b031916908160001a9053505060019092019150611ae09050565b5092915050565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611c135750819003601f19909101908152919050565b6060600080600080600080611c5188611f90565b955095509550955095509550611c6686612004565b611c6f86612004565b611c7886612004565b611c8186612004565b611c8a86612004565b611c9386612004565b604051602001611ca896959493929190612f47565b6040516020818303038152906040529650505050505050919050565b6060600082611cd4576000611cd7565b60015b90506000611ce685600a613086565b9050856000805b8215611d4c5760ff811615611d0e5780611d0681613095565b915050611d2c565b611d19600a84612dd6565b15611d2c5780611d2881613095565b9150505b81611d3681613095565b9250611d459050600a84612825565b9250611ced565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915287151560e082015260ff8916611d9c8385612f18565b60ff1610611ddc57611dae858b612825565b8152611dba8984612f18565b60ff1660408201819052611dcf9087906130b4565b60ff166020820152611e8f565b611de68284612f18565b611df190600a613086565b611dfb908b612825565b815289851115611e5e5760026080820152611e16838a612f18565b611e219060026130b4565b60ff1660a08201819052611e3590836130b4565b60ff1660408201819052611e4a9087906130b4565b60ff166020820152600160c0820152611e8f565b611e698260016130b4565b60ff166040820152611e7b8984612f18565b611e869060016130b4565b60ff1660608201525b858160400151611e9f91906130b4565b60ff166020820152611eb081612105565b9a9950505050505050505050565b604080518082019091526000808252602082015282463084604051602001611ee994939291906130cd565b60408051601f198184030181529190528051602091820120825260009082015292915050565b600081600001518260200151604051602001611f35929190918252602082015260400190565b60408051601f1981840301815291905280516020918201209201805160010190525090565b6000600a60f883901c1015611f8157611f7860f883901c60306130b4565b60f81b92915050565b611f7860f883901c60576130b4565b60008080808080611fac611fa76201518089612825565b61235a565b919750955093506000611fc26201518089612dd6565b9050611fd0610e1082612825565b9350611fde610e1082612dd6565b9050611feb603c82612825565b9250611ff8603c82612dd6565b91505091939550919395565b60608160000361202b5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612055578061203f81613113565b915061204e9050600a83612825565b915061202f565b60008167ffffffffffffffff81111561207057612070612683565b6040519080825280601f01601f19166020018201604052801561209a576020820181803683370190505b5090505b841561174a576120af6001836128fa565b91506120bc600a86612dd6565b6120c7906030612839565b60f81b8183815181106120dc576120dc612f31565b60200101906001600160f81b031916908160001a9053506120fe600a86612825565b945061209e565b60606000826020015160ff1667ffffffffffffffff81111561212957612129612683565b6040519080825280601f01601f191660200182016040528015612153576020820181803683370190505b5090508260e00151156121b8577f2500000000000000000000000000000000000000000000000000000000000000816001835161219091906128fa565b815181106121a0576121a0612f31565b60200101906001600160f81b031916908160001a9053505b8260c001511561222157600360fc1b816000815181106121da576121da612f31565b60200101906001600160f81b031916908160001a905350601760f91b8160018151811061220957612209612f31565b60200101906001600160f81b031916908160001a9053505b608083015160ff165b8360a0015160ff1681101561226f57603060f81b82828151811061225057612250612f31565b60200101906001600160f81b031916908160001a90535060010161222a565b505b82511561050e576000836060015160ff1611801561229c5750826060015160ff16836040015160ff16145b156122e557601760f91b818460400180516122b69061312c565b60ff1690819052815181106122cd576122cd612f31565b60200101906001600160f81b031916908160001a9053505b82516122f390600a90612dd6565b6122fe906030612839565b60f81b818460400180516123119061312c565b60ff16908190528151811061232857612328612f31565b60200101906001600160f81b031916908160001a905350600a836000018181516123529190612825565b905250612271565b60008080838162253d8c6123718362010bd9613149565b61237b9190613149565b9050600062023ab161238e836004613171565b61239891906131a1565b905060046123a98262023ab1613171565b6123b4906003613149565b6123be91906131a1565b6123c890836131cf565b9150600062164b096123db846001613149565b6123e790610fa0613171565b6123f191906131a1565b90506004612401826105b5613171565b61240b91906131a1565b61241590846131cf565b61242090601f613149565b9250600061098f612432856050613171565b61243c91906131a1565b90506000605061244e8361098f613171565b61245891906131a1565b61246290866131cf565b905061246f600b836131a1565b945061247c85600c613171565b612487836002613149565b61249191906131cf565b915084836124a06031876131cf565b6124ab906064613171565b6124b59190613149565b6124bf9190613149565b9a919950975095505050505050565b6001600160e01b031981168114610aef57600080fd5b6000602082840312156124f657600080fd5b8135612501816124ce565b9392505050565b60005b8381101561252357818101518382015260200161250b565b50506000910152565b60008151808452612544816020860160208601612508565b601f01601f19169290920160200192915050565b602081526000612501602083018461252c565b60006020828403121561257d57600080fd5b5035919050565b80356001600160a01b03811681146110da57600080fd5b600080604083850312156125ae57600080fd5b6125b783612584565b946020939093013593505050565b6000806000606084860312156125da57600080fd5b6125e384612584565b92506125f160208501612584565b9150604084013590509250925092565b6000806040838503121561261457600080fd5b50508035926020909101359150565b60006020828403121561263557600080fd5b61250182612584565b8015158114610aef57600080fd5b6000806040838503121561265f57600080fd5b61266883612584565b915060208301356126788161263e565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156126af57600080fd5b6126b885612584565b93506126c660208601612584565b925060408501359150606085013567ffffffffffffffff808211156126ea57600080fd5b818701915087601f8301126126fe57600080fd5b81358181111561271057612710612683565b604051601f8201601f19908116603f0116810190838211818310171561273857612738612683565b816040528281528a602084870101111561275157600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561278857600080fd5b61279183612584565b915061279f60208401612584565b90509250929050565b600181811c908216806127bc57607f821691505b6020821081036127dc57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761050e5761050e6127e2565b634e487b7160e01b600052601260045260246000fd5b6000826128345761283461280f565b500490565b8082018082111561050e5761050e6127e2565b6000815161285e818560208601612508565b9290920192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516128a081601d850160208701612508565b91909101601d0192915050565b6000602082840312156128bf57600080fd5b5051919050565b6000602082840312156128d857600080fd5b81516125018161263e565b6000816128f2576128f26127e2565b506000190190565b8181038181111561050e5761050e6127e2565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261293f608083018461252c565b9695505050505050565b60006020828403121561295b57600080fd5b8151612501816124ce565b7f7b226e616d65223a22527567506f6f6c2023000000000000000000000000000081526000835161299e816012850160208801612508565b7f205b456e7472792023200000000000000000000000000000000000000000000060129184019182015283516129db81601c840160208801612508565b7f5d222c226465736372697074696f6e223a202254686973204e46542072657072601c92909101918201527f6573656e747320616e20656e74727920696e2061000000000000000000000000603c8201527f52756720506f6f6c7a20706f6f6c2e204f6e6c7920746865204e46542073656c60508201527f656374656420746f2062652074686520636c61696d65722063616e20636f6c6c60708201527f6563742074686520706f6f6c2e204275726e2061667465722075736522000000609082015260ad01949350505050565b60008651612abb818460208b01612508565b7f2c2022696d616765223a202200000000000000000000000000000000000000009083019081528654600090600181811c9080831680612afc57607f831692505b602083108103612b1a57634e487b7160e01b85526022600452602485fd5b808015612b2e5760018114612b4957612b7d565b60ff198516600c880152600c84151585028801019550612b7d565b60008d81526020902060005b85811015612b72578154898201600c015290840190602001612b55565b5050600c8488010195505b5050505050612caf612c4b612ca9612c5a612c4b612c45612bf6612bcd612bc7897f3078000000000000000000000000000000000000000000000000000000000000815260020190565b8f61284c565b7f2e706e67222c2261747472696275746573223a5b000000000000000000000000815260140190565b7f7b2274726169745f74797065223a2022506f6f6c2045787069726573222c202281527f76616c7565223a20220000000000000000000000000000000000000000000000602082015260290190565b8b61284c565b62089f4b60ea1b815260030190565b7f7b2274726169745f74797065223a2022436f7374222c202276616c7565223a2081527f2200000000000000000000000000000000000000000000000000000000000000602082015260210190565b8761284c565b9998505050505050505050565b60008451612cce818460208901612508565b80830190507f7b2274726169745f74797065223a2022546f6b656e222c2276616c7565223a2081527f223078000000000000000000000000000000000000000000000000000000000060208201528451612d2f816023840160208901612508565b62089f4b60ea1b602392909101918201527f7b2274726169745f74797065223a2022526573756c74222c202276616c75652260268201527f3a2022000000000000000000000000000000000000000000000000000000000060468201528351612d9f816049840160208801612508565b7f227d5d7d0000000000000000000000000000000000000000000000000000000060499290910191820152604d0195945050505050565b600082612de557612de561280f565b500690565b600181815b80851115612e25578160001904821115612e0b57612e0b6127e2565b80851615612e1857918102915b93841c9390800290612def565b509250929050565b600082612e3c5750600161050e565b81612e495750600061050e565b8160018114612e5f5760028114612e6957612e85565b600191505061050e565b60ff841115612e7a57612e7a6127e2565b50506001821b61050e565b5060208310610133831016604e8410600b8410161715612ea8575081810a61050e565b612eb28383612dea565b8060001904821115612ec657612ec66127e2565b029392505050565b60006125018383612e2d565b600060ff831680612eed57612eed61280f565b8060ff84160491505092915050565b60ff8181168382160290811690818114611bf257611bf26127e2565b60ff828116828216039081111561050e5761050e6127e2565b634e487b7160e01b600052603260045260246000fd5b600087516020612f5a8285838d01612508565b81840191507f2d000000000000000000000000000000000000000000000000000000000000008083528951612f958160018601858e01612508565b60019301928301528751612faf8160028501848c01612508565b7f2000000000000000000000000000000000000000000000000000000000000000600293909101928301528651612fec8160038501848b01612508565b8083019250507f3a00000000000000000000000000000000000000000000000000000000000000806003840152865161302b8160048601858b01612508565b600493019283015284516130458160058501848901612508565b6130776005828501017f2055544300000000000000000000000000000000000000000000000000000000815260040190565b9b9a5050505050505050505050565b600061250160ff841683612e2d565b600060ff821660ff81036130ab576130ab6127e2565b60010192915050565b60ff818116838216019081111561050e5761050e6127e2565b8481528360208201526bffffffffffffffffffffffff198360601b16604082015260008251613103816054850160208701612508565b9190910160540195945050505050565b600060018201613125576131256127e2565b5060010190565b600060ff82168061313f5761313f6127e2565b6000190192915050565b8082018281126000831280158216821582161715613169576131696127e2565b505092915050565b80820260008212600160ff1b8414161561318d5761318d6127e2565b818105831482151761050e5761050e6127e2565b6000826131b0576131b061280f565b600160ff1b8214600019841416156131ca576131ca6127e2565b500590565b8181036000831280158383131683831282161715611bf257611bf26127e256fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212204423db559adf12652e14bf18d70fe429ff5f94ab9f13a2d97ec4833cd451832a64736f6c634300081800330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f89e2e88835481ade9826e032478762130695494000000000000000000000000b2a909b8bcce9b30bbc9d4c748fd897d6ad9c28500000000000000000000000000000000000000000000021e19e0c9bab240000000000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000067675680000000000000000000000000000000000000000000000000010a741a46278000000000000000000000000000000000000000000000000000010a741a46278000000000000000000000000000be5431f6a0cc57bd2153ce4238fd45855d1d1f1c0000000000000000000000004636469958a5262d90b22ed118d98e3f421b3c230000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000002868747470733a2f2f70696c6f742e727567706f6f6c7a2e636f6d2f6173736574732f706f6f6c732f000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106101805760003560e01c806342842e0e116100d6578063b6b40fed1161007f578063e985e9c511610059578063e985e9c514610405578063ec6c92ed1461044e578063fb29238b1461046357600080fd5b8063b6b40fed146103bc578063b88d4fde146103d2578063c87b56dd146103e557600080fd5b8063767d59af116100b0578063767d59af1461036757806395d89b4114610387578063a22cb4651461039c57600080fd5b806342842e0e146103145780636352211e1461032757806370a082311461034757600080fd5b806311ed64441161013857806323b872dd1161011257806323b872dd146102a25780632a55205a146102b557806338af3eed146102f457600080fd5b806311ed64441461024a578063135d088d1461026a57806318160ddd1461027f57600080fd5b806306fdde031161016957806306fdde03146101db578063081812fc146101fd578063095ea7b31461023557600080fd5b806301ffc9a714610185578063033808b4146101ba575b600080fd5b34801561019157600080fd5b506101a56101a03660046124e4565b6104f4565b60405190151581526020015b60405180910390f35b3480156101c657600080fd5b506018546101a590600160a01b900460ff1681565b3480156101e757600080fd5b506101f0610514565b6040516101b19190612558565b34801561020957600080fd5b5061021d61021836600461256b565b6105a6565b6040516001600160a01b0390911681526020016101b1565b61024861024336600461259b565b6105fa565b005b34801561025657600080fd5b5060155461021d906001600160a01b031681565b34801561027657600080fd5b506101f061060a565b34801561028b57600080fd5b50600154600054035b6040519081526020016101b1565b6102486102b03660046125c5565b610698565b3480156102c157600080fd5b506102d56102d0366004612601565b610866565b604080516001600160a01b0390931683526020830191909152016101b1565b34801561030057600080fd5b5060185461021d906001600160a01b031681565b6102486103223660046125c5565b610921565b34801561033357600080fd5b5061021d61034236600461256b565b610941565b34801561035357600080fd5b50610294610362366004612623565b61094c565b34801561037357600080fd5b5061024861038236600461256b565b6109ab565b34801561039357600080fd5b506101f0610af2565b3480156103a857600080fd5b506102486103b736600461264c565b610b01565b3480156103c857600080fd5b5061029460165481565b6102486103e0366004612699565b610b6d565b3480156103f157600080fd5b506101f061040036600461256b565b610bae565b34801561041157600080fd5b506101a5610420366004612775565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561045a57600080fd5b50610248610be7565b34801561046f57600080fd5b50610478610f06565b6040516101b191906000610120820190508251825260208301516001600160a01b0380821660208501526040850151604085015280606086015116606085015250506080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525092915050565b60006104ff82610fcc565b8061050e575061050e8261104c565b92915050565b606060028054610523906127a8565b80601f016020809104026020016040519081016040528092919081815260200182805461054f906127a8565b801561059c5780601f106105715761010080835404028352916020019161059c565b820191906000526020600020905b81548152906001019060200180831161057f57829003601f168201915b5050505050905090565b60006105b18261109a565b6105de576105de7fcf4700e4000000000000000000000000000000000000000000000000000000006110df565b506000908152600660205260409020546001600160a01b031690565b610606828260016110e9565b5050565b60178054610617906127a8565b80601f0160208091040260200160405190810160405280929190818152602001828054610643906127a8565b80156106905780601f1061066557610100808354040283529160200191610690565b820191906000526020600020905b81548152906001019060200180831161067357829003601f168201915b505050505081565b60006106a3826111da565b6001600160a01b0394851694909150811684146106e3576106e37fa1148100000000000000000000000000000000000000000000000000000000006110df565b60008281526006602052604090208054338082146001600160a01b0388169091141761075d576001600160a01b038616600090815260076020908152604080832033845290915290205460ff1661075d5761075d7f59c896be000000000000000000000000000000000000000000000000000000006110df565b801561076857600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036107fa576001840160008181526004602052604081205490036107f85760005481146107f85760008181526004602052604090208490555b505b6001600160a01b0385168481887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a48060000361085d5761085d7fea553b34000000000000000000000000000000000000000000000000000000006110df565b50505050505050565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff169282019290925282916108e55750604080518082019091526009546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b602081015160009061271090610909906bffffffffffffffffffffffff16876127f8565b6109139190612825565b915196919550909350505050565b61093c83838360405180602001604052806000815250610b6d565b505050565b600061050e826111da565b60006001600160a01b038216610985576109857f8f4eb604000000000000000000000000000000000000000000000000000000006110df565b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b6109b3611270565b60018110156109ee576040517f5cfd825e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600e54816109ff6001546000540390565b610a099190612839565b1115610a41576040517f846fb9e200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601054610a5890610a539083906127f8565b6112b3565b610a62338261157d565b6015546040517fd6218a5a000000000000000000000000000000000000000000000000000000008152306004820152336024820152604481018390526001600160a01b039091169063d6218a5a90606401600060405180830381600087803b158015610acd57600080fd5b505af1158015610ae1573d6000803e3d6000fd5b50505050610aef6001600b55565b50565b606060038054610523906127a8565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610b78848484610698565b6001600160a01b0383163b15610ba857610b948484848461166f565b610ba857610ba86368d2bf6b60e11b6110df565b50505050565b6060610bc1610bbc83611752565b6118e3565b604051602001610bd19190612868565b6040516020818303038152906040529050919050565b610bef611270565b600e54600154600054031015610c3b57601154421015610c3b576040517fa8058ea900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601854600160a01b900460ff1615610c7f576040517f523de80500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c54610ceb90610c936001546000540390565b601154600d54600f546040516bffffffffffffffffffffffff1933606090811b82166020840152603483019590955292841b83166054820152921b166068820152607c01604051602081830303815290604052611a84565b60168190556012819055600090610d0190610941565b601880547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b179055600f546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa158015610d96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dba91906128ad565b600f546040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b0385811660048301526024820184905292935091169063a9059cbb906044016020604051808303816000875af1158015610e28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4c91906128c6565b610e695760405163012c72af60e71b815260040160405180910390fd5b6015546016546040517fbbc151ea0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03858116602483015260448201929092526064810184905291169063bbc151ea90608401600060405180830381600087803b158015610ee057600080fd5b505af1158015610ef4573d6000803e3d6000fd5b505050505050610f046001600b55565b565b610f676040518061012001604052806000815260200160006001600160a01b031681526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000815260200160008152602001600081525090565b506040805161012081018252600c548152600d546001600160a01b039081166020830152600e5492820192909252600f549091166060820152601054608082015260115460a082015260125460c082015260135460e082015260145461010082015290565b60006301ffc9a760e01b6001600160e01b03198316148061101657507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061050e5750506001600160e01b0319167f5b5e139f000000000000000000000000000000000000000000000000000000001490565b60006001600160e01b031982167f2a55205a00000000000000000000000000000000000000000000000000000000148061050e57506301ffc9a760e01b6001600160e01b031983161461050e565b600080548210156110da5760005b50600082815260046020526040812054908190036110d0576110c9836128e3565b92506110a8565b600160e01b161590505b919050565b8060005260046000fd5b60006110f483610941565b905081801561110c5750336001600160a01b03821614155b15611165576001600160a01b038116600090815260076020908152604080832033845290915290205460ff16611165576111657fcfb3b942000000000000000000000000000000000000000000000000000000006110df565b60008381526006602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b6000818152600460205260409020548060000361124d57600054821061120a5761120a636f96cda160e11b6110df565b5b5060001901600081815260046020526040902054801561120b57600160e01b811660000361123857919050565b611248636f96cda160e11b6110df565b61120b565b600160e01b811660000361126057919050565b6110da636f96cda160e11b6110df565b6002600b54036112ac576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600b55565b60145460009081901561137f57601454670de0b6b3a7640000906112d790856127f8565b6112e19190612825565b600f546018546040516323b872dd60e01b81523360048201526001600160a01b0391821660248201526044810184905292945016906323b872dd906064016020604051808303816000875af115801561133e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136291906128c6565b61137f5760405163012c72af60e71b815260040160405180910390fd5b6013541561144657601354670de0b6b3a76400009061139e90856127f8565b6113a89190612825565b600f54600d546040516323b872dd60e01b81523360048201526001600160a01b0391821660248201526044810184905292935016906323b872dd906064016020604051808303816000875af1158015611405573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142991906128c6565b6114465760405163012c72af60e71b815260040160405180910390fd5b6114508183612839565b61145a90846128fa565b600f546040516323b872dd60e01b8152336004820152306024820152604481018390529194506001600160a01b0316906323b872dd906064016020604051808303816000875af11580156114b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d691906128c6565b6114f35760405163012c72af60e71b815260040160405180910390fd5b601554600d546040517f3b46bbc4000000000000000000000000000000000000000000000000000000008152306004820152602481018590526001600160a01b03918216604482015260648101849052911690633b46bbc490608401600060405180830381600087803b15801561156957600080fd5b505af115801561085d573d6000803e3d6000fd5b60008054908290036115b2576115b27fb562e8dd000000000000000000000000000000000000000000000000000000006110df565b60008181526004602090815260408083206001600160a01b0387164260a01b6001881460e11b1781179091558084526005909252822080546801000000000000000186020190559081900361162a5761162a7f2e076300000000000000000000000000000000000000000000000000000000006110df565b818301825b808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a481816001019150810361162f575060005550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906116a490339089908890889060040161290d565b6020604051808303816000875af19250505080156116df575060408051601f3d908101601f191682019092526116dc91810190612949565b60015b611734573d80801561170d576040519150601f19603f3d011682016040523d82523d6000602084013e611712565b606091505b50805160000361172c5761172c6368d2bf6b60e11b6110df565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6018546060908190600160a01b900460ff16156117e65760165483036117ac575060408051808201909152600681527f57494e4e45520000000000000000000000000000000000000000000000000000602082015261181c565b5060408051808201909152600581527f4c4f534552000000000000000000000000000000000000000000000000000000602082015261181c565b5060408051808201909152600781527f50454e44494e470000000000000000000000000000000000000000000000000060208201525b600f54600090611834906001600160a01b0316611ab9565b9050611844600c60000154611bf9565b61184d85611bf9565b60405160200161185e929190612966565b604051602081830303815290604052925082601782611881600c60050154611c3d565b6010546118919060126000611cc4565b6040516020016118a5959493929190612aa9565b60405160208183030381529060405292508281836040516020016118cb93929190612cbc565b60405160208183030381529060405292505050919050565b80516060906000819003611907575050604080516020810190915260008152919050565b60006003611916836002612839565b6119209190612825565b61192b9060046127f8565b9050600061193a826020612839565b67ffffffffffffffff81111561195257611952612683565b6040519080825280601f01601f19166020018201604052801561197c576020820181803683370190505b50905060006040518060600160405280604081526020016131f0604091399050600181016020830160005b86811015611a08576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b8352600490920191016119a7565b506003860660018114611a225760028114611a4e57611a76565b7f3d3d000000000000000000000000000000000000000000000000000000000000600119830152611a76565b7f3d000000000000000000000000000000000000000000000000000000000000006000198301525b505050918152949350505050565b600080611a9a611a948587612839565b84611ebe565b905083611aa682611f0f565b611ab09190612dd6565b95945050505050565b60408051602880825260608281019093526000919060208201818036833701905050905060005b6014811015611bf2576000611af68260136128fa565b611b019060086127f8565b611b0c906002612ece565b611b1f906001600160a01b038716612825565b60f81b9050600060108260f81c611b369190612eda565b60f81b905060008160f81c6010611b4d9190612efc565b8360f81c611b5b9190612f18565b60f81b9050611b6982611f5a565b85611b758660026127f8565b81518110611b8557611b85612f31565b60200101906001600160f81b031916908160001a905350611ba581611f5a565b85611bb18660026127f8565b611bbc906001612839565b81518110611bcc57611bcc612f31565b60200101906001600160f81b031916908160001a9053505060019092019150611ae09050565b5092915050565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611c135750819003601f19909101908152919050565b6060600080600080600080611c5188611f90565b955095509550955095509550611c6686612004565b611c6f86612004565b611c7886612004565b611c8186612004565b611c8a86612004565b611c9386612004565b604051602001611ca896959493929190612f47565b6040516020818303038152906040529650505050505050919050565b6060600082611cd4576000611cd7565b60015b90506000611ce685600a613086565b9050856000805b8215611d4c5760ff811615611d0e5780611d0681613095565b915050611d2c565b611d19600a84612dd6565b15611d2c5780611d2881613095565b9150505b81611d3681613095565b9250611d459050600a84612825565b9250611ced565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915287151560e082015260ff8916611d9c8385612f18565b60ff1610611ddc57611dae858b612825565b8152611dba8984612f18565b60ff1660408201819052611dcf9087906130b4565b60ff166020820152611e8f565b611de68284612f18565b611df190600a613086565b611dfb908b612825565b815289851115611e5e5760026080820152611e16838a612f18565b611e219060026130b4565b60ff1660a08201819052611e3590836130b4565b60ff1660408201819052611e4a9087906130b4565b60ff166020820152600160c0820152611e8f565b611e698260016130b4565b60ff166040820152611e7b8984612f18565b611e869060016130b4565b60ff1660608201525b858160400151611e9f91906130b4565b60ff166020820152611eb081612105565b9a9950505050505050505050565b604080518082019091526000808252602082015282463084604051602001611ee994939291906130cd565b60408051601f198184030181529190528051602091820120825260009082015292915050565b600081600001518260200151604051602001611f35929190918252602082015260400190565b60408051601f1981840301815291905280516020918201209201805160010190525090565b6000600a60f883901c1015611f8157611f7860f883901c60306130b4565b60f81b92915050565b611f7860f883901c60576130b4565b60008080808080611fac611fa76201518089612825565b61235a565b919750955093506000611fc26201518089612dd6565b9050611fd0610e1082612825565b9350611fde610e1082612dd6565b9050611feb603c82612825565b9250611ff8603c82612dd6565b91505091939550919395565b60608160000361202b5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612055578061203f81613113565b915061204e9050600a83612825565b915061202f565b60008167ffffffffffffffff81111561207057612070612683565b6040519080825280601f01601f19166020018201604052801561209a576020820181803683370190505b5090505b841561174a576120af6001836128fa565b91506120bc600a86612dd6565b6120c7906030612839565b60f81b8183815181106120dc576120dc612f31565b60200101906001600160f81b031916908160001a9053506120fe600a86612825565b945061209e565b60606000826020015160ff1667ffffffffffffffff81111561212957612129612683565b6040519080825280601f01601f191660200182016040528015612153576020820181803683370190505b5090508260e00151156121b8577f2500000000000000000000000000000000000000000000000000000000000000816001835161219091906128fa565b815181106121a0576121a0612f31565b60200101906001600160f81b031916908160001a9053505b8260c001511561222157600360fc1b816000815181106121da576121da612f31565b60200101906001600160f81b031916908160001a905350601760f91b8160018151811061220957612209612f31565b60200101906001600160f81b031916908160001a9053505b608083015160ff165b8360a0015160ff1681101561226f57603060f81b82828151811061225057612250612f31565b60200101906001600160f81b031916908160001a90535060010161222a565b505b82511561050e576000836060015160ff1611801561229c5750826060015160ff16836040015160ff16145b156122e557601760f91b818460400180516122b69061312c565b60ff1690819052815181106122cd576122cd612f31565b60200101906001600160f81b031916908160001a9053505b82516122f390600a90612dd6565b6122fe906030612839565b60f81b818460400180516123119061312c565b60ff16908190528151811061232857612328612f31565b60200101906001600160f81b031916908160001a905350600a836000018181516123529190612825565b905250612271565b60008080838162253d8c6123718362010bd9613149565b61237b9190613149565b9050600062023ab161238e836004613171565b61239891906131a1565b905060046123a98262023ab1613171565b6123b4906003613149565b6123be91906131a1565b6123c890836131cf565b9150600062164b096123db846001613149565b6123e790610fa0613171565b6123f191906131a1565b90506004612401826105b5613171565b61240b91906131a1565b61241590846131cf565b61242090601f613149565b9250600061098f612432856050613171565b61243c91906131a1565b90506000605061244e8361098f613171565b61245891906131a1565b61246290866131cf565b905061246f600b836131a1565b945061247c85600c613171565b612487836002613149565b61249191906131cf565b915084836124a06031876131cf565b6124ab906064613171565b6124b59190613149565b6124bf9190613149565b9a919950975095505050505050565b6001600160e01b031981168114610aef57600080fd5b6000602082840312156124f657600080fd5b8135612501816124ce565b9392505050565b60005b8381101561252357818101518382015260200161250b565b50506000910152565b60008151808452612544816020860160208601612508565b601f01601f19169290920160200192915050565b602081526000612501602083018461252c565b60006020828403121561257d57600080fd5b5035919050565b80356001600160a01b03811681146110da57600080fd5b600080604083850312156125ae57600080fd5b6125b783612584565b946020939093013593505050565b6000806000606084860312156125da57600080fd5b6125e384612584565b92506125f160208501612584565b9150604084013590509250925092565b6000806040838503121561261457600080fd5b50508035926020909101359150565b60006020828403121561263557600080fd5b61250182612584565b8015158114610aef57600080fd5b6000806040838503121561265f57600080fd5b61266883612584565b915060208301356126788161263e565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156126af57600080fd5b6126b885612584565b93506126c660208601612584565b925060408501359150606085013567ffffffffffffffff808211156126ea57600080fd5b818701915087601f8301126126fe57600080fd5b81358181111561271057612710612683565b604051601f8201601f19908116603f0116810190838211818310171561273857612738612683565b816040528281528a602084870101111561275157600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561278857600080fd5b61279183612584565b915061279f60208401612584565b90509250929050565b600181811c908216806127bc57607f821691505b6020821081036127dc57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761050e5761050e6127e2565b634e487b7160e01b600052601260045260246000fd5b6000826128345761283461280f565b500490565b8082018082111561050e5761050e6127e2565b6000815161285e818560208601612508565b9290920192915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516128a081601d850160208701612508565b91909101601d0192915050565b6000602082840312156128bf57600080fd5b5051919050565b6000602082840312156128d857600080fd5b81516125018161263e565b6000816128f2576128f26127e2565b506000190190565b8181038181111561050e5761050e6127e2565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261293f608083018461252c565b9695505050505050565b60006020828403121561295b57600080fd5b8151612501816124ce565b7f7b226e616d65223a22527567506f6f6c2023000000000000000000000000000081526000835161299e816012850160208801612508565b7f205b456e7472792023200000000000000000000000000000000000000000000060129184019182015283516129db81601c840160208801612508565b7f5d222c226465736372697074696f6e223a202254686973204e46542072657072601c92909101918201527f6573656e747320616e20656e74727920696e2061000000000000000000000000603c8201527f52756720506f6f6c7a20706f6f6c2e204f6e6c7920746865204e46542073656c60508201527f656374656420746f2062652074686520636c61696d65722063616e20636f6c6c60708201527f6563742074686520706f6f6c2e204275726e2061667465722075736522000000609082015260ad01949350505050565b60008651612abb818460208b01612508565b7f2c2022696d616765223a202200000000000000000000000000000000000000009083019081528654600090600181811c9080831680612afc57607f831692505b602083108103612b1a57634e487b7160e01b85526022600452602485fd5b808015612b2e5760018114612b4957612b7d565b60ff198516600c880152600c84151585028801019550612b7d565b60008d81526020902060005b85811015612b72578154898201600c015290840190602001612b55565b5050600c8488010195505b5050505050612caf612c4b612ca9612c5a612c4b612c45612bf6612bcd612bc7897f3078000000000000000000000000000000000000000000000000000000000000815260020190565b8f61284c565b7f2e706e67222c2261747472696275746573223a5b000000000000000000000000815260140190565b7f7b2274726169745f74797065223a2022506f6f6c2045787069726573222c202281527f76616c7565223a20220000000000000000000000000000000000000000000000602082015260290190565b8b61284c565b62089f4b60ea1b815260030190565b7f7b2274726169745f74797065223a2022436f7374222c202276616c7565223a2081527f2200000000000000000000000000000000000000000000000000000000000000602082015260210190565b8761284c565b9998505050505050505050565b60008451612cce818460208901612508565b80830190507f7b2274726169745f74797065223a2022546f6b656e222c2276616c7565223a2081527f223078000000000000000000000000000000000000000000000000000000000060208201528451612d2f816023840160208901612508565b62089f4b60ea1b602392909101918201527f7b2274726169745f74797065223a2022526573756c74222c202276616c75652260268201527f3a2022000000000000000000000000000000000000000000000000000000000060468201528351612d9f816049840160208801612508565b7f227d5d7d0000000000000000000000000000000000000000000000000000000060499290910191820152604d0195945050505050565b600082612de557612de561280f565b500690565b600181815b80851115612e25578160001904821115612e0b57612e0b6127e2565b80851615612e1857918102915b93841c9390800290612def565b509250929050565b600082612e3c5750600161050e565b81612e495750600061050e565b8160018114612e5f5760028114612e6957612e85565b600191505061050e565b60ff841115612e7a57612e7a6127e2565b50506001821b61050e565b5060208310610133831016604e8410600b8410161715612ea8575081810a61050e565b612eb28383612dea565b8060001904821115612ec657612ec66127e2565b029392505050565b60006125018383612e2d565b600060ff831680612eed57612eed61280f565b8060ff84160491505092915050565b60ff8181168382160290811690818114611bf257611bf26127e2565b60ff828116828216039081111561050e5761050e6127e2565b634e487b7160e01b600052603260045260246000fd5b600087516020612f5a8285838d01612508565b81840191507f2d000000000000000000000000000000000000000000000000000000000000008083528951612f958160018601858e01612508565b60019301928301528751612faf8160028501848c01612508565b7f2000000000000000000000000000000000000000000000000000000000000000600293909101928301528651612fec8160038501848b01612508565b8083019250507f3a00000000000000000000000000000000000000000000000000000000000000806003840152865161302b8160048601858b01612508565b600493019283015284516130458160058501848901612508565b6130776005828501017f2055544300000000000000000000000000000000000000000000000000000000815260040190565b9b9a5050505050505050505050565b600061250160ff841683612e2d565b600060ff821660ff81036130ab576130ab6127e2565b60010192915050565b60ff818116838216019081111561050e5761050e6127e2565b8481528360208201526bffffffffffffffffffffffff198360601b16604082015260008251613103816054850160208701612508565b9190910160540195945050505050565b600060018201613125576131256127e2565b5060010190565b600060ff82168061313f5761313f6127e2565b6000190192915050565b8082018281126000831280158216821582161715613169576131696127e2565b505092915050565b80820260008212600160ff1b8414161561318d5761318d6127e2565b818105831482151761050e5761050e6127e2565b6000826131b0576131b061280f565b600160ff1b8214600019841416156131ca576131ca6127e2565b500590565b8181036000831280158383131683831282161715611bf257611bf26127e256fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212204423db559adf12652e14bf18d70fe429ff5f94ab9f13a2d97ec4833cd451832a64736f6c63430008180033

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

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f89e2e88835481ade9826e032478762130695494000000000000000000000000b2a909b8bcce9b30bbc9d4c748fd897d6ad9c28500000000000000000000000000000000000000000000021e19e0c9bab240000000000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000067675680000000000000000000000000000000000000000000000000010a741a46278000000000000000000000000000000000000000000000000000010a741a46278000000000000000000000000000be5431f6a0cc57bd2153ce4238fd45855d1d1f1c0000000000000000000000004636469958a5262d90b22ed118d98e3f421b3c230000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000002868747470733a2f2f70696c6f742e727567706f6f6c7a2e636f6d2f6173736574732f706f6f6c732f000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _id (uint256): 0
Arg [1] : _creator (address): 0xF89e2E88835481Ade9826E032478762130695494
Arg [2] : _token (address): 0xB2a909b8bCce9B30BbC9d4c748fD897d6AD9c285
Arg [3] : _price (uint256): 10000000000000000000000
Arg [4] : _maxEntries (uint256): 500
Arg [5] : _end (uint256): 1734825600
Arg [6] : _feePercentage (uint256[2]): 75000000000000000,75000000000000000
Arg [7] : _beneficiary (address): 0xBE5431F6a0Cc57Bd2153Ce4238FD45855D1D1F1C
Arg [8] : _poolSync (address): 0x4636469958a5262d90B22eD118d98E3f421B3C23
Arg [9] : _poolURI (string): https://pilot.rugpoolz.com/assets/pools/

-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 000000000000000000000000f89e2e88835481ade9826e032478762130695494
Arg [2] : 000000000000000000000000b2a909b8bcce9b30bbc9d4c748fd897d6ad9c285
Arg [3] : 00000000000000000000000000000000000000000000021e19e0c9bab2400000
Arg [4] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [5] : 0000000000000000000000000000000000000000000000000000000067675680
Arg [6] : 000000000000000000000000000000000000000000000000010a741a46278000
Arg [7] : 000000000000000000000000000000000000000000000000010a741a46278000
Arg [8] : 000000000000000000000000be5431f6a0cc57bd2153ce4238fd45855d1d1f1c
Arg [9] : 0000000000000000000000004636469958a5262d90b22ed118d98e3f421b3c23
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000028
Arg [12] : 68747470733a2f2f70696c6f742e727567706f6f6c7a2e636f6d2f6173736574
Arg [13] : 732f706f6f6c732f000000000000000000000000000000000000000000000000


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