Token Smol Creeps

Overview ERC721

Total Supply:
800 CREEPS

Holders:
333 addresses

Transfers:
-

Loading
[ Download CSV Export  ] 
Loading
Loading

Click here to update the token ICO / general information
# Exchange Pair Price  24H Volume % Volume

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xFD191c51c008184925B99E4218f2112b799599FF

Contract Name:
FlatLaunchpeg

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 23 : VRFCoordinatorV2Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 2 of 23 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 3 of 23 : IERC2981Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981Upgradeable is IERC165Upgradeable {
    /**
     * @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 payed in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

File 4 of 23 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 5 of 23 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 6 of 23 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721ReceiverUpgradeable {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 7 of 23 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @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
    ) external;

    /**
     * @dev Transfers `tokenId` token 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;

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

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

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

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

File 8 of 23 : IERC721MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @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);
}

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

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981Upgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

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

    function __ERC2981_init_unchained() internal onlyInitializing {
    }
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

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

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

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

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

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

        return (royalty.receiver, royaltyAmount);
    }

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

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

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[48] private __gap;
}

File 10 of 23 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 11 of 23 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 12 of 23 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // 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 Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

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

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

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

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

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @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 15 of 23 : BaseLaunchpeg.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";

import "erc721a-upgradeable/contracts/ERC721AUpgradeable.sol";

import "./BatchReveal.sol";
import "./LaunchpegErrors.sol";
import "./interfaces/IBaseLaunchpeg.sol";

/// @title BaseLaunchpeg
/// @author Trader Joe
/// @notice Implements the functionalities shared between Launchpeg and FlatLaunchpeg contracts.
abstract contract BaseLaunchpeg is
    IBaseLaunchpeg,
    ERC721AUpgradeable,
    BatchReveal,
    OwnableUpgradeable,
    ReentrancyGuardUpgradeable,
    ERC2981Upgradeable
{
    using StringsUpgradeable for uint256;

    /// @notice The collection size (e.g 10000)
    uint256 public override collectionSize;

    /// @notice Amount of NFTs reserved for `projectOwner` (e.g 200)
    /// @dev It can be minted any time via `devMint`
    uint256 public override amountForDevs;

    /// @notice Amount of NFTs available for the allowlist mint (e.g 1000)
    uint256 public override amountForAllowlist;

    /// @notice Max amount of NFTs that can be minted at once
    uint256 public override maxBatchSize;

    /// @notice Max amount of NFTs an address can mint
    uint256 public override maxPerAddressDuringMint;

    /// @notice The fees collected by Joepegs on the sale benefits
    /// @dev In basis points e.g 100 for 1%
    uint256 public override joeFeePercent;

    /// @notice The address to which the fees on the sale will be sent
    address public override joeFeeCollector;

    /// @notice Percentage base point
    uint256 public constant BASIS_POINT_PRECISION = 10_000;

    /// @notice The project owner
    /// @dev We may own the contract during the launch; this address is allowed to call `devMint`
    address public override projectOwner;

    /// @notice Token URI after collection reveal
    string public override baseURI;

    /// @notice Token URI before the collection reveal
    string public override unrevealedURI;

    /// @notice The amount of NFTs each allowed address can mint during the allowlist mint
    mapping(address => uint256) public override allowlist;

    /// @notice Tracks the amount of NFTs minted by `projectOwner`
    uint256 public override amountMintedByDevs;

    /// @notice Tracks the amount of NFTs minted on Allowlist phase
    uint256 public override amountMintedDuringAllowlist;

    /// @notice Tracks the amount of NFTs minted on Public Sale phase
    uint256 public override amountMintedDuringPublicSale;

    /// @notice Start time of the allowlist mint in seconds
    uint256 public override allowlistStartTime;

    /// @notice Start time of the public sale in seconds
    /// @dev A timestamp greater than the allowlist mint start
    uint256 public override publicSaleStartTime;

    /// @dev Emitted on initializeJoeFee()
    /// @param feePercent The fees collected by Joepegs on the sale benefits
    /// @param feeCollector The address to which the fees on the sale will be sent
    event JoeFeeInitialized(uint256 feePercent, address feeCollector);

    /// @dev Emitted on devMint()
    /// @param sender The address that minted
    /// @param quantity Amount of NFTs minted
    event DevMint(address indexed sender, uint256 quantity);

    /// @dev Emitted on withdrawAVAX()
    /// @param sender The address that withdrew the tokens
    /// @param amount Amount of AVAX transfered to `sender`
    /// @param fee Amount of AVAX paid to the fee collector
    event AvaxWithdraw(address indexed sender, uint256 amount, uint256 fee);

    /// @dev Emitted on setProjectOwner()
    /// @param owner The new project owner
    event ProjectOwnerUpdated(address indexed owner);

    /// @dev Emitted on setBaseURI()
    /// @param baseURI The new base URI
    event BaseURISet(string baseURI);

    /// @dev Emitted on setUnrevealedURI()
    /// @param unrevealedURI The new base URI
    event UnrevealedURISet(string unrevealedURI);

    /// @dev Emitted on seedAllowlist()
    event AllowlistSeeded();

    /// @dev Emitted on _setDefaultRoyalty()
    /// @param receiver Royalty fee collector
    /// @param feePercent Royalty fee percent in basis point
    event DefaultRoyaltySet(address indexed receiver, uint256 feePercent);

    /// @dev emitted on setVRF()
    /// @param _vrfCoordinator Chainlink coordinator address
    /// @param _keyHash Keyhash of the gas lane wanted
    /// @param _subscriptionId Chainlink subscription ID
    /// @param _callbackGasLimit Max gas used by the coordinator callback
    event VRFSet(
        address _vrfCoordinator,
        bytes32 _keyHash,
        uint64 _subscriptionId,
        uint32 _callbackGasLimit
    );

    modifier isEOA() {
        if (tx.origin != msg.sender) {
            revert Launchpeg__Unauthorized();
        }
        _;
    }

    modifier onlyProjectOwner() {
        if (projectOwner != msg.sender) {
            revert Launchpeg__Unauthorized();
        }
        _;
    }

    /// @dev BaseLaunchpeg initialization
    /// @param _name ERC721 name
    /// @param _symbol ERC721 symbol
    /// @param _projectOwner The project owner
    /// @param _royaltyReceiver Royalty fee collector
    /// @param _maxBatchSize Max amount of NFTs that can be minted at once
    /// @param _collectionSize The collection size (e.g 10000)
    /// @param _amountForDevs Amount of NFTs reserved for `projectOwner` (e.g 200)
    /// @param _amountForAllowlist Amount of NFTs available for the allowlist mint (e.g 1000)
    /// @param _batchRevealSize Size of the batch reveal
    function initializeBaseLaunchpeg(
        string memory _name,
        string memory _symbol,
        address _projectOwner,
        address _royaltyReceiver,
        uint256 _maxBatchSize,
        uint256 _collectionSize,
        uint256 _amountForDevs,
        uint256 _amountForAllowlist,
        uint256 _batchRevealSize,
        uint256 _revealStartTime,
        uint256 _revealInterval
    ) internal onlyInitializing {
        __Ownable_init();
        __ReentrancyGuard_init();
        __ERC2981_init();

        __ERC721A_init(_name, _symbol);
        initializeBatchReveal(_batchRevealSize, _collectionSize);

        if (_projectOwner == address(0)) {
            revert Launchpeg__InvalidProjectOwner();
        }

        if (_amountForDevs + _amountForAllowlist > _collectionSize) {
            revert Launchpeg__LargerCollectionSizeNeeded();
        }

        if (_maxBatchSize > _collectionSize) {
            revert Launchpeg__InvalidMaxBatchSize();
        }
        // We assume that if the reveal is more than 100 days in the future, that's a mistake
        // Same if the reveal interval is longer than 10 days
        if (
            _revealStartTime > block.timestamp + 8_640_000 ||
            _revealInterval > 864_000
        ) {
            revert Launchpeg__InvalidRevealDates();
        }

        projectOwner = _projectOwner;
        // Default royalty is 5%
        _setDefaultRoyalty(_royaltyReceiver, 500);

        maxBatchSize = _maxBatchSize;
        collectionSize = _collectionSize;
        maxPerAddressDuringMint = _maxBatchSize;
        amountForDevs = _amountForDevs;
        amountForAllowlist = _amountForAllowlist;

        revealStartTime = _revealStartTime;
        revealInterval = _revealInterval;
    }

    /// @notice Initialize the sales fee percent taken by Joepegs and address that collects the fees
    /// @param _joeFeePercent The fees collected by Joepegs on the sale benefits
    /// @param _joeFeeCollector The address to which the fees on the sale will be sent
    function initializeJoeFee(uint256 _joeFeePercent, address _joeFeeCollector)
        external
        override
        onlyOwner
    {
        if (joeFeeCollector != address(0)) {
            revert Launchpeg__JoeFeeAlreadyInitialized();
        }
        if (_joeFeePercent > BASIS_POINT_PRECISION) {
            revert Launchpeg__InvalidPercent();
        }
        if (_joeFeeCollector == address(0)) {
            revert Launchpeg__InvalidJoeFeeCollector();
        }
        joeFeePercent = _joeFeePercent;
        joeFeeCollector = _joeFeeCollector;
        emit JoeFeeInitialized(_joeFeePercent, _joeFeeCollector);
    }

    /// @notice Set the royalty fee
    /// @param _receiver Royalty fee collector
    /// @param _feePercent Royalty fee percent in basis point
    function setRoyaltyInfo(address _receiver, uint96 _feePercent)
        external
        override
        onlyOwner
    {
        // Royalty fees are limited to 25%
        if (_feePercent > 2_500) {
            revert Launchpeg__InvalidRoyaltyInfo();
        }
        _setDefaultRoyalty(_receiver, _feePercent);
        emit DefaultRoyaltySet(_receiver, _feePercent);
    }

    /// @notice Set amount of NFTs mintable per address during the allowlist phase
    /// @param _addresses List of addresses allowed to mint during the allowlist phase
    /// @param _numNfts List of NFT quantities mintable per address
    function seedAllowlist(
        address[] calldata _addresses,
        uint256[] calldata _numNfts
    ) external override onlyOwner {
        uint256 addressesLength = _addresses.length;
        if (addressesLength != _numNfts.length) {
            revert Launchpeg__WrongAddressesAndNumSlotsLength();
        }
        for (uint256 i; i < addressesLength; i++) {
            allowlist[_addresses[i]] = _numNfts[i];
        }

        emit AllowlistSeeded();
    }

    /// @notice Set the base URI
    /// @dev This sets the URI for revealed tokens
    /// Only callable by project owner
    /// @param _baseURI Base URI to be set
    function setBaseURI(string calldata _baseURI) external override onlyOwner {
        baseURI = _baseURI;
        emit BaseURISet(baseURI);
    }

    /// @notice Set the unrevealed URI
    /// @dev Only callable by project owner
    /// @param _unrevealedURI Unrevealed URI to be set
    function setUnrevealedURI(string calldata _unrevealedURI)
        external
        override
        onlyOwner
    {
        unrevealedURI = _unrevealedURI;
        emit UnrevealedURISet(unrevealedURI);
    }

    /// @notice Set the project owner
    /// @dev The project owner can call `devMint` any time
    /// @param _projectOwner The project owner
    function setProjectOwner(address _projectOwner)
        external
        override
        onlyOwner
    {
        if (_projectOwner == address(0)) {
            revert Launchpeg__InvalidProjectOwner();
        }

        projectOwner = _projectOwner;
        emit ProjectOwnerUpdated(projectOwner);
    }

    /// @notice Set VRF configuration
    /// @param _vrfCoordinator Chainlink coordinator address
    /// @param _keyHash Keyhash of the gas lane wanted
    /// @param _subscriptionId Chainlink subscription ID
    /// @param _callbackGasLimit Max gas used by the coordinator callback
    function setVRF(
        address _vrfCoordinator,
        bytes32 _keyHash,
        uint64 _subscriptionId,
        uint32 _callbackGasLimit
    ) external override onlyOwner {
        if (_vrfCoordinator == address(0)) {
            revert Launchpeg__InvalidCoordinator();
        }

        (
            ,
            uint32 _maxGasLimit,
            bytes32[] memory s_provingKeyHashes
        ) = VRFCoordinatorV2Interface(_vrfCoordinator).getRequestConfig();

        // 20_000 is the cost of storing one word, callback cost will never be lower than that
        if (_callbackGasLimit > _maxGasLimit || _callbackGasLimit < 20_000) {
            revert Launchpeg__InvalidCallbackGasLimit();
        }

        bool keyHashFound;
        for (uint256 i; i < s_provingKeyHashes.length; i++) {
            if (s_provingKeyHashes[i] == _keyHash) {
                keyHashFound = true;
                break;
            }
        }

        if (!keyHashFound) {
            revert Launchpeg__InvalidKeyHash();
        }

        (, , , address[] memory consumers) = VRFCoordinatorV2Interface(
            _vrfCoordinator
        ).getSubscription(_subscriptionId);

        bool isInConsumerList;
        for (uint256 i; i < consumers.length; i++) {
            if (consumers[i] == address(this)) {
                isInConsumerList = true;
                break;
            }
        }

        if (!isInConsumerList) {
            revert Launchpeg__IsNotInTheConsumerList();
        }

        useVRF = true;
        setVRFConsumer(_vrfCoordinator);
        keyHash = _keyHash;
        subscriptionId = _subscriptionId;
        callbackGasLimit = _callbackGasLimit;

        emit VRFSet(
            _vrfCoordinator,
            _keyHash,
            _subscriptionId,
            _callbackGasLimit
        );
    }

    /// @notice Mint NFTs to the project owner
    /// @dev Can only mint up to `amountForDevs`
    /// @param _quantity Quantity of NFTs to mint
    function devMint(uint256 _quantity) external override onlyProjectOwner {
        if (totalSupply() + _quantity > collectionSize) {
            revert Launchpeg__MaxSupplyReached();
        }
        if (amountMintedByDevs + _quantity > amountForDevs) {
            revert Launchpeg__MaxSupplyForDevReached();
        }
        if (_quantity % maxBatchSize != 0) {
            revert Launchpeg__CanOnlyMintMultipleOfMaxBatchSize();
        }
        amountMintedByDevs = amountMintedByDevs + _quantity;
        uint256 numChunks = _quantity / maxBatchSize;
        for (uint256 i; i < numChunks; i++) {
            _mint(msg.sender, maxBatchSize, "", false);
        }
        emit DevMint(msg.sender, _quantity);
    }

    /// @notice Withdraw AVAX to the contract owner
    /// @param _to Recipient of the earned AVAX
    function withdrawAVAX(address _to)
        external
        override
        onlyOwner
        nonReentrant
    {
        uint256 amount = address(this).balance;
        uint256 fee;
        bool sent;

        if (joeFeePercent > 0) {
            fee = (amount * joeFeePercent) / BASIS_POINT_PRECISION;
            amount = amount - fee;

            (sent, ) = joeFeeCollector.call{value: fee}("");
            if (!sent) {
                revert Launchpeg__TransferFailed();
            }
        }

        (sent, ) = _to.call{value: amount}("");
        if (!sent) {
            revert Launchpeg__TransferFailed();
        }

        emit AvaxWithdraw(_to, amount, fee);
    }

    /// @notice Reveals the next batch if the reveal conditions are met
    function revealNextBatch() external override isEOA {
        if (!_revealNextBatch(totalSupply())) {
            revert Launchpeg__RevealNextBatchNotAvailable();
        }
    }

    /// @notice Allows Owner to reveal batches even if the conditions are not met
    function forceReveal() external override onlyOwner {
        _forceReveal();
    }

    /// @notice Tells you if a batch can be revealed
    /// @return bool Whether reveal can be triggered or not
    /// @return uint256 The number of the next batch that will be revealed
    function hasBatchToReveal() external view override returns (bool, uint256) {
        return _hasBatchToReveal(totalSupply());
    }

    /// @notice Returns the ownership data of a specific token ID
    /// @param _tokenId Token ID
    /// @return TokenOwnership Ownership struct for a specific token ID
    function getOwnershipData(uint256 _tokenId)
        external
        view
        override
        returns (TokenOwnership memory)
    {
        return _ownershipOf(_tokenId);
    }

    /// @notice Returns the Uniform Resource Identifier (URI) for `tokenId` token.
    /// @param _id Token id
    /// @return URI Token URI
    function tokenURI(uint256 _id)
        public
        view
        override(ERC721AUpgradeable, IERC721MetadataUpgradeable)
        returns (string memory)
    {
        if (_id >= lastTokenRevealed) {
            return unrevealedURI;
        } else {
            return
                string(
                    abi.encodePacked(
                        baseURI,
                        _getShuffledTokenId(_id).toString()
                    )
                );
        }
    }

    /// @notice Returns the number of NFTs minted by a specific address
    /// @param _owner The owner of the NFTs
    /// @return numberMinted Number of NFTs minted
    function numberMinted(address _owner)
        public
        view
        override
        returns (uint256)
    {
        return _numberMinted(_owner);
    }

    /// @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.
    /// @param _interfaceId InterfaceId to consider. Comes from type(InterfaceContract).interfaceId
    /// @return isInterfaceSupported True if the considered interface is supported
    function supportsInterface(bytes4 _interfaceId)
        public
        view
        virtual
        override(ERC721AUpgradeable, ERC2981Upgradeable, IERC165Upgradeable)
        returns (bool)
    {
        return
            ERC721AUpgradeable.supportsInterface(_interfaceId) ||
            ERC2981Upgradeable.supportsInterface(_interfaceId) ||
            ERC165Upgradeable.supportsInterface(_interfaceId) ||
            super.supportsInterface(_interfaceId);
    }

    /// @dev Verifies that enough AVAX has been sent by the sender and refunds the extra tokens if any
    /// @param _price The price paid by the sender for minting NFTs
    function _refundIfOver(uint256 _price) internal {
        if (msg.value < _price) {
            revert Launchpeg__NotEnoughAVAX(msg.value);
        }
        if (msg.value > _price) {
            (bool success, ) = msg.sender.call{value: msg.value - _price}("");
            if (!success) {
                revert Launchpeg__TransferFailed();
            }
        }
    }
}

File 16 of 23 : BatchReveal.sol
//SPDX-License-Identifier: CC0
pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";

import "./chainlink/VRFConsumerBaseV2Upgradeable.sol";
import "./interfaces/IBatchReveal.sol";
import "./LaunchpegErrors.sol";

// Creator: Tubby Cats
/// https://github.com/tubby-cats/batch-nft-reveal

/// @title BatchReveal
/// @notice Implements a gas efficient way of revealing NFT URIs gradually
abstract contract BatchReveal is
    IBatchReveal,
    VRFConsumerBaseV2Upgradeable,
    Initializable
{
    /// @dev Initialized on parent contract creation
    uint256 private collectionSize;
    int128 private intCollectionSize;

    /// @notice Size of the batch reveal
    /// @dev Must divide collectionSize
    uint256 public override revealBatchSize;

    /// @notice Randomized seeds used to shuffle TokenURIs
    mapping(uint256 => uint256) public override batchToSeed;

    /// @notice Last token that has been revealed
    uint256 public override lastTokenRevealed = 0;

    /// @dev Size of the array that will store already taken URIs numbers
    uint256 private _rangeLength;

    /// @notice Timestamp for the start of the reveal process
    /// @dev Can be set to zero for immediate reveal after token mint
    uint256 public override revealStartTime;

    /// @notice Time interval for gradual reveal
    /// @dev Can be set to zero in order to reveal the collection all at once
    uint256 public override revealInterval;

    /// @notice Contract uses VRF or pseudo-randomness
    bool public override useVRF;

    /// @notice Chainlink subscription ID
    uint64 public override subscriptionId;

    /// @notice The gas lane to use, which specifies the maximum gas price to bump to.
    /// For a list of available gas lanes on each network,
    /// see https://docs.chain.link/docs/vrf-contracts/#configurations
    bytes32 public override keyHash;

    /// @notice Depends on the number of requested values that you want sent to the
    /// fulfillRandomWords() function. Storing each word costs about 20,000 gas,
    /// so 100,000 is a safe default for this example contract. Test and adjust
    /// this limit based on the network that you select, the size of the request,
    /// and the processing of the callback request in the fulfillRandomWords()
    /// function.
    uint32 public override callbackGasLimit;

    /// @notice Number of block confirmations that the coordinator will wait before triggering the callback
    /// The default is 3
    uint16 public constant override requestConfirmations = 3;

    /// @notice Next batch that will be revealed by VRF, if activated
    uint256 public override nextBatchToReveal;

    /// @notice Has a batch been force revealed
    /// @dev VRF will not be used anymore if a batch has been force revealed
    bool public override hasBeenForceRevealed;

    /// @notice Has the random number for a batch already been asked
    /// @dev Prevents people from spamming the random words request
    /// and therefore reveal more batches than expected
    mapping(uint256 => bool) public override vrfRequestedForBatch;

    struct Range {
        int128 start;
        int128 end;
    }

    /// @dev Emitted on revealNextBatch() and forceReveal()
    /// @param batchNumber The batch revealed
    /// @param batchSeed The random number drawn
    event Reveal(uint256 batchNumber, uint256 batchSeed);

    /// @dev BatchReveal initialization
    /// @param _revealBatchSize Size of the batch reveal
    /// @param _collectionSize Needs to be sent by child contract
    function initializeBatchReveal(
        uint256 _revealBatchSize,
        uint256 _collectionSize
    ) internal onlyInitializing {
        if (
            _collectionSize % _revealBatchSize != 0 ||
            _revealBatchSize == 0 ||
            _revealBatchSize > _collectionSize
        ) {
            revert Launchpeg__InvalidBatchRevealSize();
        }
        revealBatchSize = _revealBatchSize;
        collectionSize = _collectionSize;
        _rangeLength = (_collectionSize / _revealBatchSize) * 2;
        intCollectionSize = int128(int256(_collectionSize));
    }

    // Forked from openzeppelin
    /// @dev Returns the smallest of two numbers.
    /// @param _a First number to consider
    /// @param _b Second number to consider
    /// @return min Minimum between the two params
    function _min(int128 _a, int128 _b) internal pure returns (int128) {
        return _a < _b ? _a : _b;
    }

    /// @notice Fills the range array
    /// @dev Ranges include the start but not the end [start, end)
    /// @param _ranges initial range array
    /// @param _start beginning of the array to be added
    /// @param _end end of the array to be added
    /// @param _lastIndex last position in the range array to consider
    /// @return newLastIndex new lastIndex to consider for the future range to be added
    function _addRange(
        Range[] memory _ranges,
        int128 _start,
        int128 _end,
        uint256 _lastIndex
    ) private view returns (uint256) {
        uint256 positionToAssume = _lastIndex;
        for (uint256 j; j < _lastIndex; j++) {
            int128 rangeStart = _ranges[j].start;
            int128 rangeEnd = _ranges[j].end;
            if (_start < rangeStart && positionToAssume == _lastIndex) {
                positionToAssume = j;
            }
            if (
                (_start < rangeStart && _end > rangeStart) ||
                (rangeStart <= _start && _end <= rangeEnd) ||
                (_start < rangeEnd && _end > rangeEnd)
            ) {
                int128 length = _end - _start;
                _start = _min(_start, rangeStart);
                _end = _start + length + (rangeEnd - rangeStart);
                _ranges[j] = Range(-1, -1); // Delete
            }
        }
        for (uint256 pos = _lastIndex; pos > positionToAssume; pos--) {
            _ranges[pos] = _ranges[pos - 1];
        }
        _ranges[positionToAssume] = Range(
            _start,
            _min(_end, intCollectionSize)
        );
        _lastIndex++;
        if (_end > intCollectionSize) {
            _addRange(_ranges, 0, _end - intCollectionSize, _lastIndex);
            _lastIndex++;
        }
        return _lastIndex;
    }

    /// @dev Adds the last batch into the ranges array
    /// @param _lastBatch Batch number to consider
    /// @return ranges Ranges array filled with every URI taken by batches smaller or equal to lastBatch
    function _buildJumps(uint256 _lastBatch)
        private
        view
        returns (Range[] memory)
    {
        Range[] memory ranges = new Range[](_rangeLength);
        uint256 lastIndex;
        for (uint256 i; i < _lastBatch; i++) {
            int128 start = int128(
                int256(_getFreeTokenId(batchToSeed[i], ranges))
            );
            int128 end = start + int128(int256(revealBatchSize));
            lastIndex = _addRange(ranges, start, end, lastIndex);
        }
        return ranges;
    }

    /// @dev Gets the random token URI number from tokenId
    /// @param _startId Token Id to consider
    /// @return uriId Revealed Token URI Id
    function _getShuffledTokenId(uint256 _startId)
        internal
        view
        returns (uint256)
    {
        uint256 batch = _startId / revealBatchSize;
        Range[] memory ranges = new Range[](_rangeLength);

        ranges = _buildJumps(batch);

        uint256 positionsToMove = (_startId % revealBatchSize) +
            batchToSeed[batch];

        return _getFreeTokenId(positionsToMove, ranges);
    }

    /// @dev Gets the shifted URI number from tokenId and range array
    /// @param _positionsToMoveStart Token URI offset if none of the URI Ids were taken
    /// @param _ranges Ranges array built by _buildJumps()
    /// @return uriId Revealed Token URI Id
    function _getFreeTokenId(
        uint256 _positionsToMoveStart,
        Range[] memory _ranges
    ) private view returns (uint256) {
        int128 positionsToMove = int128(int256(_positionsToMoveStart));
        int128 id;

        for (uint256 round = 0; round < 2; round++) {
            for (uint256 i; i < _rangeLength; i++) {
                int128 start = _ranges[i].start;
                int128 end = _ranges[i].end;
                if (id < start) {
                    int128 finalId = id + positionsToMove;
                    if (finalId < start) {
                        return uint256(uint128(finalId));
                    } else {
                        positionsToMove -= start - id;
                        id = end;
                    }
                } else if (id < end) {
                    id = end;
                }
            }
            if ((id + positionsToMove) >= intCollectionSize) {
                positionsToMove -= intCollectionSize - id;
                id = 0;
            }
        }
        return uint256(uint128(id + positionsToMove));
    }

    /// @dev Sets batch seed for specified batch number
    /// @param _batchNumber Batch number that needs to be revealed
    function _setBatchSeed(uint256 _batchNumber) internal {
        uint256 randomness = uint256(
            keccak256(
                abi.encode(
                    msg.sender,
                    tx.gasprice,
                    block.number,
                    block.timestamp,
                    block.difficulty,
                    blockhash(block.number - 1),
                    address(this)
                )
            )
        );

        // not perfectly random since the folding doesn't match bounds perfectly, but difference is small
        batchToSeed[_batchNumber] =
            randomness %
            (collectionSize - (_batchNumber * revealBatchSize));
    }

    /// @dev Returns true if a batch can be revealed
    /// @param _totalSupply Number of token already minted
    /// @return hasToRevealInfo Returns a bool saying whether a reveal can be triggered or not
    /// and the number of the next batch that will be revealed
    function _hasBatchToReveal(uint256 _totalSupply)
        internal
        view
        returns (bool, uint256)
    {
        uint256 batchNumber;
        unchecked {
            batchNumber = lastTokenRevealed / revealBatchSize;
        }

        // We don't want to reveal other batches if a VRF random words request is pending
        if (
            block.timestamp < revealStartTime + batchNumber * revealInterval ||
            _totalSupply < lastTokenRevealed + revealBatchSize ||
            vrfRequestedForBatch[batchNumber]
        ) {
            return (false, batchNumber);
        }

        return (true, batchNumber);
    }

    /// @dev Reveals next batch if possible
    /// @dev If using VRF, the reveal happens on the coordinator callback call
    /// @param _totalSupply Number of token already minted
    /// @return isRevealed Returns false if it is not possible to reveal the next batch
    function _revealNextBatch(uint256 _totalSupply) internal returns (bool) {
        uint256 batchNumber;
        bool canReveal;
        (canReveal, batchNumber) = _hasBatchToReveal(_totalSupply);

        if (!canReveal) {
            return false;
        }

        if (useVRF) {
            VRFCoordinatorV2Interface(vrfCoordinator).requestRandomWords(
                keyHash,
                subscriptionId,
                requestConfirmations,
                callbackGasLimit,
                1
            );
            vrfRequestedForBatch[batchNumber] = true;
        } else {
            lastTokenRevealed += revealBatchSize;
            _setBatchSeed(batchNumber);
            emit Reveal(batchNumber, batchToSeed[batchNumber]);
        }

        return true;
    }

    /// @dev Callback triggered by the VRF coordinator
    /// @param _randomWords Array of random numbers provided by the VRF coordinator
    function fulfillRandomWords(
        uint256, /* requestId */
        uint256[] memory _randomWords
    ) internal override {
        if (hasBeenForceRevealed) {
            revert Launchpeg__HasBeenForceRevealed();
        }

        uint256 _batchToReveal = nextBatchToReveal++;
        uint256 _revealBatchSize = revealBatchSize;
        uint256 _seed = _randomWords[0] %
            (collectionSize - (_batchToReveal * _revealBatchSize));

        batchToSeed[_batchToReveal] = _seed;
        lastTokenRevealed += _revealBatchSize;

        emit Reveal(_batchToReveal, batchToSeed[_batchToReveal]);
    }

    /// @dev Force reveal, should be restricted to owner
    function _forceReveal() internal {
        uint256 batchNumber;
        unchecked {
            batchNumber = lastTokenRevealed / revealBatchSize;
            lastTokenRevealed += revealBatchSize;
        }

        _setBatchSeed(batchNumber);
        hasBeenForceRevealed = true;
        emit Reveal(batchNumber, batchToSeed[batchNumber]);
    }
}

File 17 of 23 : FlatLaunchpeg.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./interfaces/IFlatLaunchpeg.sol";
import "./BaseLaunchpeg.sol";

/// @title FlatLaunchpeg
/// @author Trader Joe
/// @notice Implements a simple minting NFT contract with an allowlist and public sale phase.
contract FlatLaunchpeg is BaseLaunchpeg, IFlatLaunchpeg {
    /// @notice Price of one NFT for people on the mint list
    /// @dev allowlistPrice is scaled to 1e18
    uint256 public override allowlistPrice;

    /// @notice Price of one NFT during the public sale
    /// @dev salePrice is scaled to 1e18
    uint256 public override salePrice;

    /// @dev Emitted on initializePhases()
    /// @param allowlistStartTime Allowlist mint start time in seconds
    /// @param publicSaleStartTime Public sale start time in seconds
    /// @param allowlistPrice Price of the allowlist sale in Avax
    /// @param salePrice Price of the public sale in Avax
    event Initialized(
        uint256 allowlistStartTime,
        uint256 publicSaleStartTime,
        uint256 allowlistPrice,
        uint256 salePrice
    );

    /// @dev Emitted on allowlistMint(), publicSaleMint()
    /// @param sender The address that minted
    /// @param quantity Amount of NFTs minted
    /// @param price Price in AVAX for the NFTs
    /// @param tokenId The token ID of the first minted NFT
    event Mint(
        address indexed sender,
        uint256 quantity,
        uint256 price,
        uint256 tokenId
    );

    /// @dev Emitted on setPublicSaleActive()
    /// @param isActive True if the public sale is open, false otherwise
    event PublicSaleStateChanged(bool isActive);

    modifier atPhase(Phase _phase) {
        if (currentPhase() != _phase) {
            revert Launchpeg__WrongPhase();
        }
        _;
    }

    /// @notice FlatLaunchpeg initialization
    /// Can only be called once
    /// @param _name ERC721 name
    /// @param _symbol ERC721 symbol
    /// @param _projectOwner The project owner
    /// @param _royaltyReceiver Royalty fee collector
    /// @param _maxBatchSize Max amount of NFTs that can be minted at once
    /// @param _collectionSize The collection size (e.g 10000)
    /// @param _amountForDevs Amount of NFTs reserved for `projectOwner` (e.g 200)
    /// @param _amountForAllowlist Amount of NFTs available for the allowlist mint (e.g 1000)
    /// @param _batchRevealSize Size of the batch reveal
    /// @param _revealStartTime Start of the token URIs reveal in seconds
    /// @param _revealInterval Interval between two batch reveals in seconds
    function initialize(
        string memory _name,
        string memory _symbol,
        address _projectOwner,
        address _royaltyReceiver,
        uint256 _maxBatchSize,
        uint256 _collectionSize,
        uint256 _amountForDevs,
        uint256 _amountForAllowlist,
        uint256 _batchRevealSize,
        uint256 _revealStartTime,
        uint256 _revealInterval
    ) external override initializer {
        initializeBaseLaunchpeg(
            _name,
            _symbol,
            _projectOwner,
            _royaltyReceiver,
            _maxBatchSize,
            _collectionSize,
            _amountForDevs,
            _amountForAllowlist,
            _batchRevealSize,
            _revealStartTime,
            _revealInterval
        );
    }

    /// @notice Initialize the two phases of the sale
    /// @dev Can only be called once
    /// @param _allowlistStartTime Allowlist mint start time in seconds
    /// @param _publicSaleStartTime Public sale start time in seconds
    /// @param _allowlistPrice Price of the allowlist sale in Avax
    /// @param _salePrice Price of the public sale in Avax
    function initializePhases(
        uint256 _allowlistStartTime,
        uint256 _publicSaleStartTime,
        uint256 _allowlistPrice,
        uint256 _salePrice
    ) external override onlyOwner atPhase(Phase.NotStarted) {
        if (_allowlistStartTime < block.timestamp) {
            revert Launchpeg__InvalidStartTime();
        }
        if (_publicSaleStartTime < _allowlistStartTime) {
            revert Launchpeg__PublicSaleBeforeAllowlist();
        }
        if (_allowlistPrice > _salePrice) {
            revert Launchpeg__InvalidAllowlistPrice();
        }

        salePrice = _salePrice;
        allowlistPrice = _allowlistPrice;

        allowlistStartTime = _allowlistStartTime;
        publicSaleStartTime = _publicSaleStartTime;

        emit Initialized(
            allowlistStartTime,
            publicSaleStartTime,
            allowlistPrice,
            salePrice
        );
    }

    /// @notice Mint NFTs during the allowlist mint
    /// @param _quantity Quantity of NFTs to mint
    function allowlistMint(uint256 _quantity)
        external
        payable
        override
        atPhase(Phase.Allowlist)
    {
        if (_quantity > allowlist[msg.sender]) {
            revert Launchpeg__NotEligibleForAllowlistMint();
        }
        if (
            totalSupply() + _quantity > collectionSize ||
            amountMintedDuringAllowlist + _quantity > amountForAllowlist
        ) {
            revert Launchpeg__MaxSupplyReached();
        }
        allowlist[msg.sender] -= _quantity;
        uint256 totalCost = allowlistPrice * _quantity;

        _mint(msg.sender, _quantity, "", false);
        amountMintedDuringAllowlist += _quantity;
        emit Mint(
            msg.sender,
            _quantity,
            allowlistPrice,
            _totalMinted() - _quantity
        );
        _refundIfOver(totalCost);
    }

    /// @notice Mint NFTs during the public sale
    /// @param _quantity Quantity of NFTs to mint
    function publicSaleMint(uint256 _quantity)
        external
        payable
        override
        isEOA
        atPhase(Phase.PublicSale)
    {
        if (numberMinted(msg.sender) + _quantity > maxPerAddressDuringMint) {
            revert Launchpeg__CanNotMintThisMany();
        }
        if (totalSupply() + _quantity > collectionSize) {
            revert Launchpeg__MaxSupplyReached();
        }
        uint256 total = salePrice * _quantity;

        _mint(msg.sender, _quantity, "", false);
        amountMintedDuringPublicSale += _quantity;
        emit Mint(msg.sender, _quantity, salePrice, _totalMinted() - _quantity);
        _refundIfOver(total);
    }

    /// @notice Returns the current phase
    /// @return phase Current phase
    function currentPhase() public view override returns (Phase) {
        if (
            allowlistStartTime == 0 ||
            publicSaleStartTime == 0 ||
            block.timestamp < allowlistStartTime
        ) {
            return Phase.NotStarted;
        } else if (
            block.timestamp >= allowlistStartTime &&
            block.timestamp < publicSaleStartTime
        ) {
            return Phase.Allowlist;
        }
        return Phase.PublicSale;
    }

    /// @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.
    /// @param _interfaceId InterfaceId to consider. Comes from type(Interface).interfaceId
    /// @return isInterfaceSupported True if the considered interface is supported
    function supportsInterface(bytes4 _interfaceId)
        public
        view
        virtual
        override(BaseLaunchpeg, IERC165Upgradeable)
        returns (bool)
    {
        return
            _interfaceId == type(IFlatLaunchpeg).interfaceId ||
            super.supportsInterface(_interfaceId);
    }
}

File 18 of 23 : LaunchpegErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

error LaunchpegFactory__InvalidImplementation();
error Launchpeg__CanNotMintThisMany();
error Launchpeg__CanOnlyMintMultipleOfMaxBatchSize();
error Launchpeg__EndPriceGreaterThanStartPrice();
error Launchpeg__HasBeenForceRevealed();
error Launchpeg__JoeFeeAlreadyInitialized();
error Launchpeg__InvalidAuctionDropInterval();
error Launchpeg__InvalidStartTime();
error Launchpeg__InvalidBatchRevealSize();
error Launchpeg__InvalidCallbackGasLimit();
error Launchpeg__InvalidCoordinator();
error Launchpeg__InvalidKeyHash();
error Launchpeg__InvalidJoeFeeCollector();
error Launchpeg__InvalidMaxBatchSize();
error Launchpeg__InvalidAllowlistPrice();
error Launchpeg__InvalidProjectOwner();
error Launchpeg__InvalidPercent();
error Launchpeg__InvalidRevealDates();
error Launchpeg__InvalidRoyaltyInfo();
error Launchpeg__IsNotInTheConsumerList();
error Launchpeg__LargerCollectionSizeNeeded();
error Launchpeg__MaxSupplyForDevReached();
error Launchpeg__MaxSupplyReached();
error Launchpeg__AllowlistBeforeAuction();
error Launchpeg__NotEligibleForAllowlistMint();
error Launchpeg__NotEnoughAVAX(uint256 avaxSent);
error Launchpeg__PublicSaleBeforeAllowlist();
error Launchpeg__RevealNextBatchNotAvailable();
error Launchpeg__TransferFailed();
error Launchpeg__Unauthorized();
error Launchpeg__WrongAddressesAndNumSlotsLength();
error Launchpeg__WrongPhase();

File 19 of 23 : VRFConsumerBaseV2Upgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// ------------------------------------------------------------------------------
/// @notice Interface for contracts using VRF randomness
///   Forked from chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol
/// ------------------------------------------------------------------------------

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

abstract contract VRFConsumerBaseV2Upgradeable {
    error OnlyCoordinatorCanFulfill(address have, address want);
    address internal vrfCoordinator;

    /// @notice Initializes the vrf coordinator address
    /// @param _vrfCoordinator address of VRFCoordinator contract
    function setVRFConsumer(address _vrfCoordinator) internal {
        vrfCoordinator = _vrfCoordinator;
    }

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

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

File 20 of 23 : IBaseLaunchpeg.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol";

import "erc721a-upgradeable/contracts/ERC721AUpgradeable.sol";

/// @title IBaseLaunchpeg
/// @author Trader Joe
/// @notice Defines the basic interface of BaseLaunchpeg
interface IBaseLaunchpeg is IERC721Upgradeable, IERC721MetadataUpgradeable {
    enum Phase {
        NotStarted,
        DutchAuction,
        Allowlist,
        PublicSale
    }

    function collectionSize() external view returns (uint256);

    function unrevealedURI() external view returns (string memory);

    function baseURI() external view returns (string memory);

    function amountForDevs() external view returns (uint256);

    function amountForAllowlist() external view returns (uint256);

    function maxBatchSize() external view returns (uint256);

    function maxPerAddressDuringMint() external view returns (uint256);

    function joeFeePercent() external view returns (uint256);

    function joeFeeCollector() external view returns (address);

    function projectOwner() external view returns (address);

    function allowlist(address) external view returns (uint256);

    function amountMintedByDevs() external view returns (uint256);

    function amountMintedDuringAllowlist() external view returns (uint256);

    function amountMintedDuringPublicSale() external view returns (uint256);

    function allowlistStartTime() external view returns (uint256);

    function publicSaleStartTime() external view returns (uint256);

    function initializeJoeFee(uint256 _joeFeePercent, address _joeFeeCollector)
        external;

    function setRoyaltyInfo(address receiver, uint96 feePercent) external;

    function seedAllowlist(
        address[] memory _addresses,
        uint256[] memory _numSlots
    ) external;

    function setBaseURI(string calldata baseURI) external;

    function setUnrevealedURI(string calldata baseURI) external;

    function setProjectOwner(address _projectOwner) external;

    function setVRF(
        address _vrfCoordinator,
        bytes32 _keyHash,
        uint64 _subscriptionId,
        uint32 _callbackGasLimit
    ) external;

    function devMint(uint256 quantity) external;

    function withdrawAVAX(address to) external;

    function revealNextBatch() external;

    function forceReveal() external;

    function hasBatchToReveal() external view returns (bool, uint256);

    function getOwnershipData(uint256 tokenId)
        external
        view
        returns (ERC721AUpgradeable.TokenOwnership memory);

    function numberMinted(address owner) external view returns (uint256);

    function currentPhase() external view returns (Phase);
}

File 21 of 23 : IBatchReveal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @title IBaseLaunchpeg
/// @author Trader Joe
/// @notice Defines the basic interface of BaseLaunchpeg
interface IBatchReveal {
    function revealBatchSize() external view returns (uint256);

    function batchToSeed(uint256) external view returns (uint256);

    function lastTokenRevealed() external view returns (uint256);

    function revealStartTime() external view returns (uint256);

    function revealInterval() external view returns (uint256);

    function useVRF() external view returns (bool);

    function subscriptionId() external view returns (uint64);

    function keyHash() external view returns (bytes32);

    function callbackGasLimit() external view returns (uint32);

    function requestConfirmations() external view returns (uint16);

    function nextBatchToReveal() external view returns (uint256);

    function hasBeenForceRevealed() external view returns (bool);

    function vrfRequestedForBatch(uint256) external view returns (bool);
}

File 22 of 23 : IFlatLaunchpeg.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./IBaseLaunchpeg.sol";

/// @title ILaunchpeg
/// @author Trader Joe
/// @notice Defines the basic interface of FlatLaunchpeg
interface IFlatLaunchpeg is IBaseLaunchpeg {
    struct FlatLaunchpegPrices {
        uint256 salePrice;
        uint256 allowlistPrice;
    }

    function allowlistPrice() external view returns (uint256);

    function salePrice() external view returns (uint256);

    function initialize(
        string memory _name,
        string memory _symbol,
        address _projectOwner,
        address _royaltyReceiver,
        uint256 _maxBatchSize,
        uint256 _collectionSize,
        uint256 _amountForDevs,
        uint256 _amountForAllowlist,
        uint256 _batchRevealSize,
        uint256 _revealStartTime,
        uint256 _revealInterval
    ) external;

    function initializePhases(
        uint256 _allowlistStartTime,
        uint256 _publicSaleStartTime,
        uint256 _allowlistPrice,
        uint256 _salePrice
    ) external;

    function allowlistMint(uint256 _quantity) external payable;

    function publicSaleMint(uint256 _quantity) external payable;
}

File 23 of 23 : ERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
 *
 * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 *
 * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721AUpgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;

    // Compiler will pack this into a single 256bit word.
    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Keeps track of the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
    }

    // Compiler will pack this into a single 256bit word.
    struct AddressData {
        // Realistically, 2**64-1 is more than enough.
        uint64 balance;
        // Keeps track of mint count with minimal overhead for tokenomics.
        uint64 numberMinted;
        // Keeps track of burn count with minimal overhead for tokenomics.
        uint64 numberBurned;
        // For miscellaneous variable(s) pertaining to the address
        // (e.g. number of whitelist mint slots used).
        // If there are multiple variables, please pack them into a uint64.
        uint64 aux;
    }

    // The tokenId of the next token to be minted.
    uint256 internal _currentIndex;

    // The number of tokens burned.
    uint256 internal _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 _ownershipOf implementation for details.
    mapping(uint256 => TokenOwnership) internal _ownerships;

    // Mapping owner address to address data
    mapping(address => AddressData) private _addressData;

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

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

    function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721A_init_unchained(name_, symbol_);
    }

    function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();
    }

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

    /**
     * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
     */
    function totalSupply() public view returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than _currentIndex - _startTokenId() times
        unchecked {
            return _currentIndex - _burnCounter - _startTokenId();
        }
    }

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

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return uint256(_addressData[owner].balance);
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return uint256(_addressData[owner].numberMinted);
    }

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

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

    /**
     * Sets the auxillary 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 {
        _addressData[owner].aux = aux;
    }

    /**
     * Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around in the collection over time.
     */
    function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
        uint256 curr = tokenId;

        unchecked {
            if (_startTokenId() <= curr && curr < _currentIndex) {
                TokenOwnership memory ownership = _ownerships[curr];
                if (!ownership.burned) {
                    if (ownership.addr != address(0)) {
                        return ownership;
                    }
                    // Invariant:
                    // There will always be an ownership that has an address and is not burned
                    // before an ownership that does not have an address and is not burned.
                    // Hence, curr will not underflow.
                    while (true) {
                        curr--;
                        ownership = _ownerships[curr];
                        if (ownership.addr != address(0)) {
                            return ownership;
                        }
                    }
                }
            }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return _ownershipOf(tokenId).addr;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

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

    /**
     * @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, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return '';
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public override {
        address owner = ERC721AUpgradeable.ownerOf(tokenId);
        if (to == owner) revert ApprovalToCurrentOwner();

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

        _approve(to, tokenId, owner);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        if (operator == _msgSender()) revert ApproveToCaller();

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        _transfer(from, to, tokenId);
        if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) {
            revert TransferToNonERC721ReceiverImplementer();
        }
    }

    /**
     * @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 (`_mint`),
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;
    }

    function _safeMint(address to, uint256 quantity) internal {
        _safeMint(to, 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.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal {
        _mint(to, quantity, _data, true);
    }

    /**
     * @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.
     */
    function _mint(
        address to,
        uint256 quantity,
        bytes memory _data,
        bool safe
    ) internal {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();

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

        // Overflows are incredibly unrealistic.
        // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
        // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
        unchecked {
            _addressData[to].balance += uint64(quantity);
            _addressData[to].numberMinted += uint64(quantity);

            _ownerships[startTokenId].addr = to;
            _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);

            uint256 updatedIndex = startTokenId;
            uint256 end = updatedIndex + quantity;

            if (safe && to.isContract()) {
                do {
                    emit Transfer(address(0), to, updatedIndex);
                    if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (updatedIndex != end);
                // Reentrancy protection
                if (_currentIndex != startTokenId) revert();
            } else {
                do {
                    emit Transfer(address(0), to, updatedIndex++);
                } while (updatedIndex != end);
            }
            _currentIndex = updatedIndex;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) private {
        TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

        if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();

        bool isApprovedOrOwner = (_msgSender() == from ||
            isApprovedForAll(from, _msgSender()) ||
            getApproved(tokenId) == _msgSender());

        if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        if (to == address(0)) revert TransferToZeroAddress();

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId, from);

        // 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 {
            _addressData[from].balance -= 1;
            _addressData[to].balance += 1;

            TokenOwnership storage currSlot = _ownerships[tokenId];
            currSlot.addr = to;
            currSlot.startTimestamp = uint64(block.timestamp);

            // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            TokenOwnership storage nextSlot = _ownerships[nextTokenId];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != _currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

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

    /**
     * @dev This is 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 {
        TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

        address from = prevOwnership.addr;

        if (approvalCheck) {
            bool isApprovedOrOwner = (_msgSender() == from ||
                isApprovedForAll(from, _msgSender()) ||
                getApproved(tokenId) == _msgSender());

            if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        }

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

        // Clear approvals from the previous owner
        _approve(address(0), tokenId, from);

        // 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 {
            AddressData storage addressData = _addressData[from];
            addressData.balance -= 1;
            addressData.numberBurned += 1;

            // Keep track of who burned the token, and the timestamp of burning.
            TokenOwnership storage currSlot = _ownerships[tokenId];
            currSlot.addr = from;
            currSlot.startTimestamp = uint64(block.timestamp);
            currSlot.burned = true;

            // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            TokenOwnership storage nextSlot = _ownerships[nextTokenId];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != _currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

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

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

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(
        address to,
        uint256 tokenId,
        address owner
    ) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

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

    /**
     * @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 This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[42] private __gap;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"Launchpeg__CanNotMintThisMany","type":"error"},{"inputs":[],"name":"Launchpeg__CanOnlyMintMultipleOfMaxBatchSize","type":"error"},{"inputs":[],"name":"Launchpeg__HasBeenForceRevealed","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidAllowlistPrice","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidBatchRevealSize","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidCallbackGasLimit","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidCoordinator","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidJoeFeeCollector","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidKeyHash","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidMaxBatchSize","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidPercent","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidProjectOwner","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidRevealDates","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidRoyaltyInfo","type":"error"},{"inputs":[],"name":"Launchpeg__InvalidStartTime","type":"error"},{"inputs":[],"name":"Launchpeg__IsNotInTheConsumerList","type":"error"},{"inputs":[],"name":"Launchpeg__JoeFeeAlreadyInitialized","type":"error"},{"inputs":[],"name":"Launchpeg__LargerCollectionSizeNeeded","type":"error"},{"inputs":[],"name":"Launchpeg__MaxSupplyForDevReached","type":"error"},{"inputs":[],"name":"Launchpeg__MaxSupplyReached","type":"error"},{"inputs":[],"name":"Launchpeg__NotEligibleForAllowlistMint","type":"error"},{"inputs":[{"internalType":"uint256","name":"avaxSent","type":"uint256"}],"name":"Launchpeg__NotEnoughAVAX","type":"error"},{"inputs":[],"name":"Launchpeg__PublicSaleBeforeAllowlist","type":"error"},{"inputs":[],"name":"Launchpeg__RevealNextBatchNotAvailable","type":"error"},{"inputs":[],"name":"Launchpeg__TransferFailed","type":"error"},{"inputs":[],"name":"Launchpeg__Unauthorized","type":"error"},{"inputs":[],"name":"Launchpeg__WrongAddressesAndNumSlotsLength","type":"error"},{"inputs":[],"name":"Launchpeg__WrongPhase","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"anonymous":false,"inputs":[],"name":"AllowlistSeeded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"AvaxWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"BaseURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"feePercent","type":"uint256"}],"name":"DefaultRoyaltySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"DevMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"allowlistStartTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"publicSaleStartTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allowlistPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"feePercent","type":"uint256"},{"indexed":false,"internalType":"address","name":"feeCollector","type":"address"}],"name":"JoeFeeInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"ProjectOwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isActive","type":"bool"}],"name":"PublicSaleStateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"batchNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"batchSeed","type":"uint256"}],"name":"Reveal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"unrevealedURI","type":"string"}],"name":"UnrevealedURISet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_vrfCoordinator","type":"address"},{"indexed":false,"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"_subscriptionId","type":"uint64"},{"indexed":false,"internalType":"uint32","name":"_callbackGasLimit","type":"uint32"}],"name":"VRFSet","type":"event"},{"inputs":[],"name":"BASIS_POINT_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowlist","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"allowlistMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"allowlistPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowlistStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amountForAllowlist","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amountForDevs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amountMintedByDevs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amountMintedDuringAllowlist","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"amountMintedDuringPublicSale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"batchToSeed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callbackGasLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collectionSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentPhase","outputs":[{"internalType":"enum IBaseLaunchpeg.Phase","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"devMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"forceReveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getOwnershipData","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"}],"internalType":"struct ERC721AUpgradeable.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasBatchToReveal","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasBeenForceRevealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_projectOwner","type":"address"},{"internalType":"address","name":"_royaltyReceiver","type":"address"},{"internalType":"uint256","name":"_maxBatchSize","type":"uint256"},{"internalType":"uint256","name":"_collectionSize","type":"uint256"},{"internalType":"uint256","name":"_amountForDevs","type":"uint256"},{"internalType":"uint256","name":"_amountForAllowlist","type":"uint256"},{"internalType":"uint256","name":"_batchRevealSize","type":"uint256"},{"internalType":"uint256","name":"_revealStartTime","type":"uint256"},{"internalType":"uint256","name":"_revealInterval","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_joeFeePercent","type":"uint256"},{"internalType":"address","name":"_joeFeeCollector","type":"address"}],"name":"initializeJoeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allowlistStartTime","type":"uint256"},{"internalType":"uint256","name":"_publicSaleStartTime","type":"uint256"},{"internalType":"uint256","name":"_allowlistPrice","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"initializePhases","outputs":[],"stateMutability":"nonpayable","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":"joeFeeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"joeFeePercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"keyHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTokenRevealed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBatchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerAddressDuringMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextBatchToReveal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"numberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"projectOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"publicSaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicSaleStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestConfirmations","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revealBatchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revealInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revealNextBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","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":"nonpayable","type":"function"},{"inputs":[],"name":"salePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"uint256[]","name":"_numNfts","type":"uint256[]"}],"name":"seedAllowlist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_projectOwner","type":"address"}],"name":"setProjectOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint96","name":"_feePercent","type":"uint96"}],"name":"setRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_unrevealedURI","type":"string"}],"name":"setUnrevealedURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vrfCoordinator","type":"address"},{"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"internalType":"uint64","name":"_subscriptionId","type":"uint64"},{"internalType":"uint32","name":"_callbackGasLimit","type":"uint32"}],"name":"setVRF","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"subscriptionId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unrevealedURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"useVRF","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vrfRequestedForBatch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawAVAX","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526000609b5534801561001557600080fd5b506148ae806100256000396000f3fe6080604052600436106104055760003560e01c8063715018a611610213578063bd817f2b11610123578063d9a6f705116100ab578063f2fde38b1161007a578063f2fde38b14610c20578063f431919514610c40578063f51f96dd14610c56578063fbe1aa5114610c6d578063fe2c7fee14610c8457600080fd5b8063d9a6f70514610baa578063dc33e68114610bc0578063e985e9c514610be0578063ecbbfea314610c0057600080fd5b8063c87b56dd116100f2578063c87b56dd14610b1d578063cc0bef8414610b3d578063d0061f8814610b53578063d62b630314610b73578063d66f3a7914610b8a57600080fd5b8063bd817f2b14610aae578063c180526a14610ade578063c5482fe314610af1578063c81e156e14610b0857600080fd5b8063963331d8116101a6578063a7cd52cb11610175578063a7cd52cb14610a05578063b05863d514610a33578063b0fb162f14610a53578063b3ab66b014610a7b578063b88d4fde14610a8e57600080fd5b8063963331d81461098d578063a22cb465146109a4578063a2416f74146109c4578063a4475ce4146109e457600080fd5b80638da5cb5b116101e25780638da5cb5b146108ed57806390967a521461090b5780639231ab2a1461092257806395d89b411461097857600080fd5b8063715018a614610874578063777c90911461088957806379fecd17146108b65780638bc35c2f146108d657600080fd5b80632913daa0116103195780635bb21376116102a15780636352211e116102705780636352211e146107f35780636bb7b1d9146108135780636c0360eb1461082a5780637035bf181461083f57806370a082311461085457600080fd5b80635bb21376146107905780635c7034af146107b157806361728f39146107c8578063622f1c47146107de57600080fd5b80633d5ece85116102e85780633d5ece851461070c57806342842e0e1461072257806345c0f5331461074257806355f804b31461075957806359d7bc4d1461077957600080fd5b80632913daa01461067f5780632a55205a14610696578063375a069a146106d55780633cc4cadb146106f557600080fd5b806309c1ba2e1161039c5780631fe543e31161036b5780631fe543e3146105dd5780632192f043146105fd57806323b872dd14610617578063247cd8ad1461063757806324f746971461064d57600080fd5b806309c1ba2e146105435780630b5648101461058057806318160ddd146105a45780631c0310a5146105bd57600080fd5b806306038341116103d857806306038341146104af57806306fdde03146104c9578063081812fc146104eb578063095ea7b31461052357600080fd5b806301ffc9a71461040a57806302fa7c471461043f57806303851c2814610461578063055ad42e1461048d575b600080fd5b34801561041657600080fd5b5061042a610425366004613f0f565b610ca4565b60405190151581526020015b60405180910390f35b34801561044b57600080fd5b5061045f61045a366004613e76565b610ccf565b005b34801561046d57600080fd5b50610476610d84565b604080519215158352602083019190915201610436565b34801561049957600080fd5b506104a2610da4565b6040516104369190614462565b3480156104bb57600080fd5b50609f5461042a9060ff1681565b3480156104d557600080fd5b506104de610df7565b604051610436919061448a565b3480156104f757600080fd5b5061050b61050636600461414c565b610e89565b6040516001600160a01b039091168152602001610436565b34801561052f57600080fd5b5061045f61053e366004613e4a565b610ecd565b34801561054f57600080fd5b50609f546105689061010090046001600160401b031681565b6040516001600160401b039091168152602001610436565b34801561058c57600080fd5b5061059660995481565b604051908152602001610436565b3480156105b057600080fd5b5060665460655403610596565b3480156105c957600080fd5b5061045f6105d8366004613cae565b610f5b565b3480156105e957600080fd5b5061045f6105f83660046141a3565b61114e565b34801561060957600080fd5b5060a35461042a9060ff1681565b34801561062357600080fd5b5061045f610632366004613d04565b61119c565b34801561064357600080fd5b50610596609e5481565b34801561065957600080fd5b5060a15461066a9063ffffffff1681565b60405163ffffffff9091168152602001610436565b34801561068b57600080fd5b5061059661013e5481565b3480156106a257600080fd5b506106b66106b1366004614246565b6111a7565b604080516001600160a01b039093168352602083019190915201610436565b3480156106e157600080fd5b5061045f6106f036600461414c565b611257565b34801561070157600080fd5b506105966101475481565b34801561071857600080fd5b5061059660a25481565b34801561072e57600080fd5b5061045f61073d366004613d04565b6113b1565b34801561074e57600080fd5b5061059661013b5481565b34801561076557600080fd5b5061045f610774366004613f49565b6113cc565b34801561078557600080fd5b506105966101495481565b34801561079c57600080fd5b506101415461050b906001600160a01b031681565b3480156107bd57600080fd5b506105966101465481565b3480156107d457600080fd5b5061059660a05481565b3480156107ea57600080fd5b5061045f611441565b3480156107ff57600080fd5b5061050b61080e36600461414c565b611495565b34801561081f57600080fd5b5061059661014a5481565b34801561083657600080fd5b506104de6114a7565b34801561084b57600080fd5b506104de611536565b34801561086057600080fd5b5061059661086f366004613cae565b611544565b34801561088057600080fd5b5061045f611592565b34801561089557600080fd5b506105966108a436600461414c565b609a6020526000908152604090205481565b3480156108c257600080fd5b5061045f6108d1366004613fba565b6115c6565b3480156108e257600080fd5b5061059661013f5481565b3480156108f957600080fd5b5060a5546001600160a01b031661050b565b34801561091757600080fd5b5061059661014b5481565b34801561092e57600080fd5b5061094261093d36600461414c565b6116b0565b6040805182516001600160a01b031681526020808401516001600160401b03169082015291810151151590820152606001610436565b34801561098457600080fd5b506104de6116d6565b34801561099957600080fd5b506105966101485481565b3480156109b057600080fd5b5061045f6109bf366004613dc4565b6116e5565b3480156109d057600080fd5b5061045f6109df366004613cae565b61177b565b3480156109f057600080fd5b506101425461050b906001600160a01b031681565b348015610a1157600080fd5b50610596610a20366004613cae565b6101456020526000908152604090205481565b348015610a3f57600080fd5b5061045f610a4e366004613ea4565b611817565b348015610a5f57600080fd5b50610a68600381565b60405161ffff9091168152602001610436565b61045f610a8936600461414c565b61190f565b348015610a9a57600080fd5b5061045f610aa9366004613d45565b611a87565b348015610aba57600080fd5b5061042a610ac936600461414c565b60a46020526000908152604090205460ff1681565b61045f610aec36600461414c565b611ad8565b348015610afd57600080fd5b506105966101405481565b348015610b1457600080fd5b5061045f611c3a565b348015610b2957600080fd5b506104de610b3836600461414c565b611c6c565b348015610b4957600080fd5b50610596609d5481565b348015610b5f57600080fd5b5061045f610b6e366004614268565b611d4a565b348015610b7f57600080fd5b5061059661013d5481565b348015610b9657600080fd5b5061045f610ba5366004613df7565b611e79565b348015610bb657600080fd5b5061059661271081565b348015610bcc57600080fd5b50610596610bdb366004613cae565b6121ab565b348015610bec57600080fd5b5061042a610bfb366004613ccb565b6121d9565b348015610c0c57600080fd5b5061045f610c1b36600461417e565b612207565b348015610c2c57600080fd5b5061045f610c3b366004613cae565b612302565b348015610c4c57600080fd5b50610596609b5481565b348015610c6257600080fd5b5061059661014c5481565b348015610c7957600080fd5b5061059661013c5481565b348015610c9057600080fd5b5061045f610c9f366004613f49565b61239d565b60006001600160e01b03198216635f2d056560e11b1480610cc95750610cc982612406565b92915050565b60a5546001600160a01b03163314610d025760405162461bcd60e51b8152600401610cf990614522565b60405180910390fd5b6109c4816001600160601b03161115610d2e576040516306f644f160e31b815260040160405180910390fd5b610d38828261243e565b6040516001600160601b03821681526001600160a01b038316907fd85b7816dca44c313f0fdadd9567f99f3620a2fac7c21a8a7872e1ac4d10fe55906020015b60405180910390a25050565b600080610d9c610d976066546065540390565b61253c565b915091509091565b60006101495460001480610db9575061014a54155b80610dc657506101495442105b15610dd15750600090565b610149544210158015610de6575061014a5442105b15610df15750600290565b50600390565b606060678054610e0690614739565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3290614739565b8015610e7f5780601f10610e5457610100808354040283529160200191610e7f565b820191906000526020600020905b815481529060010190602001808311610e6257829003601f168201915b5050505050905090565b6000610e94826125c1565b610eb1576040516333d1c03960e21b815260040160405180910390fd5b506000908152606b60205260409020546001600160a01b031690565b6000610ed882611495565b9050806001600160a01b0316836001600160a01b03161415610f0d5760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590610f2d5750610f2b81336121d9565b155b15610f4b576040516367d9dca160e11b815260040160405180910390fd5b610f568383836125ed565b505050565b60a5546001600160a01b03163314610f855760405162461bcd60e51b8152600401610cf990614522565b600260d7541415610fd85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610cf9565b600260d75561014054479060009081901561108d576127106101405484610fff9190614670565b611009919061465c565b915061101582846146df565b610141546040519194506001600160a01b0316908390600081818185875af1925050503d8060008114611064576040519150601f19603f3d011682016040523d82523d6000602084013e611069565b606091505b5050809150508061108d57604051633aa9e60d60e21b815260040160405180910390fd5b6040516001600160a01b038516908490600081818185875af1925050503d80600081146110d6576040519150601f19603f3d011682016040523d82523d6000602084013e6110db565b606091505b505080915050806110ff57604051633aa9e60d60e21b815260040160405180910390fd5b60408051848152602081018490526001600160a01b038616917f12eb5d7ccd4ce398edc94007dfbaa22fa2ac8775a3633530f36053ad765262f4910160405180910390a25050600160d7555050565b6000546001600160a01b0316331461118e5760005460405163073e64fd60e21b81523360048201526001600160a01b039091166024820152604401610cf9565b6111988282612649565b5050565b610f56838383612737565b600082815261010a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161121e575060408051808201909152610109546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061123d906001600160601b031687614670565b611247919061465c565b91519350909150505b9250929050565b610142546001600160a01b0316331461128357604051633059e46160e21b815260040160405180910390fd5b61013b54816112956066546065540390565b61129f9190614644565b11156112be57604051631eddc6a360e11b815260040160405180910390fd5b61013c5481610146546112d19190614644565b11156112f05760405163011310dd60e31b815260040160405180910390fd5b61013e546112fe908261478f565b1561131c57604051633489d12560e01b815260040160405180910390fd5b806101465461132b9190614644565b6101465561013e54600090611340908361465c565b905060005b8181101561137e5761136c3361013e54604051806020016040528060008152506000612925565b8061137681614774565b915050611345565b5060405182815233907f7d8400f0e58ae2e14f85b63f3afb0ca5b29328d8f48046b205fc7f174cf9b5ed90602001610d78565b610f5683838360405180602001604052806000815250611a87565b60a5546001600160a01b031633146113f65760405162461bcd60e51b8152600401610cf990614522565b6114036101438383613adb565b507ff9c7803e94e0d3c02900d8a90893a6d5e90dd04d32a4cfe825520f82bf9f32f6610143604051611435919061449d565b60405180910390a15050565b32331461146157604051633059e46160e21b815260040160405180910390fd5b6114766114716066546065540390565b612ae7565b6114935760405163fc58cf3f60e01b815260040160405180910390fd5b565b60006114a082612c5c565b5192915050565b61014380546114b590614739565b80601f01602080910402602001604051908101604052809291908181526020018280546114e190614739565b801561152e5780601f106115035761010080835404028352916020019161152e565b820191906000526020600020905b81548152906001019060200180831161151157829003601f168201915b505050505081565b61014480546114b590614739565b60006001600160a01b03821661156d576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152606a60205260409020546001600160401b031690565b60a5546001600160a01b031633146115bc5760405162461bcd60e51b8152600401610cf990614522565b6114936000612d76565b600054600160a81b900460ff166115ea57600054600160a01b900460ff16156115ee565b303b155b6116515760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610cf9565b600054600160a81b900460ff1615801561167b576000805461ffff60a01b191661010160a01b1790555b61168e8c8c8c8c8c8c8c8c8c8c8c612dc8565b80156116a2576000805460ff60a81b191690555b505050505050505050505050565b6040805160608101825260008082526020820181905291810191909152610cc982612c5c565b606060688054610e0690614739565b6001600160a01b03821633141561170f5760405163b06307db60e01b815260040160405180910390fd5b336000818152606c602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60a5546001600160a01b031633146117a55760405162461bcd60e51b8152600401610cf990614522565b6001600160a01b0381166117cc576040516331ae7ba360e21b815260040160405180910390fd5b61014280546001600160a01b0319166001600160a01b0383169081179091556040517ff9683e9ced97b7e1d517c5b24e9d1f37f9a0ab14c4865055aad181c8c68a689d90600090a250565b60a5546001600160a01b031633146118415760405162461bcd60e51b8152600401610cf990614522565b8281811461186257604051638d62a9d560e01b815260040160405180910390fd5b60005b818110156118de5783838281811061187f5761187f6147e5565b90506020020135610145600088888581811061189d5761189d6147e5565b90506020020160208101906118b29190613cae565b6001600160a01b03168152602081019190915260400160002055806118d681614774565b915050611865565b506040517f0df27beb8d16f5e61d125286ba69a986a702ac83921bb1864629ca5e662e84d490600090a15050505050565b32331461192f57604051633059e46160e21b815260040160405180910390fd5b60038061193a610da4565b600381111561194b5761194b6147cf565b14611969576040516338df794b60e01b815260040160405180910390fd5b61013f5482611977336121ab565b6119819190614644565b11156119a0576040516335e62b7b60e21b815260040160405180910390fd5b61013b54826119b26066546065540390565b6119bc9190614644565b11156119db57604051631eddc6a360e11b815260040160405180910390fd5b60008261014c546119ec9190614670565b9050611a0a3384604051806020016040528060008152506000612925565b826101486000828254611a1d9190614644565b909155505061014c5433907fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb90859081611a5660655490565b611a6091906146df565b6040805193845260208401929092529082015260600160405180910390a2610f5681612f20565b611a92848484612737565b6001600160a01b0383163b15158015611ab45750611ab284848484612fbb565b155b15611ad2576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b600280611ae3610da4565b6003811115611af457611af46147cf565b14611b12576040516338df794b60e01b815260040160405180910390fd5b3360009081526101456020526040902054821115611b43576040516390e50aa560e01b815260040160405180910390fd5b61013b5482611b556066546065540390565b611b5f9190614644565b1180611b7b575061013d548261014754611b799190614644565b115b15611b9957604051631eddc6a360e11b815260040160405180910390fd5b336000908152610145602052604081208054849290611bb99084906146df565b909155505061014b54600090611bd0908490614670565b9050611bee3384604051806020016040528060008152506000612925565b826101476000828254611c019190614644565b909155505061014b5433907fb4c03061fb5b7fed76389d5af8f2e0ddb09f8c70d1333abbb62582835e10accb90859081611a5660655490565b60a5546001600160a01b03163314611c645760405162461bcd60e51b8152600401610cf990614522565b6114936130b3565b6060609b548210611d0a576101448054611c8590614739565b80601f0160208091040260200160405190810160405280929190818152602001828054611cb190614739565b8015611cfe5780601f10611cd357610100808354040283529160200191611cfe565b820191906000526020600020905b815481529060010190602001808311611ce157829003601f168201915b50505050509050919050565b610143611d1e611d1984613137565b6131f7565b604051602001611d2f9291906143a2565b6040516020818303038152906040529050919050565b919050565b60a5546001600160a01b03163314611d745760405162461bcd60e51b8152600401610cf990614522565b600080611d7f610da4565b6003811115611d9057611d906147cf565b14611dae576040516338df794b60e01b815260040160405180910390fd5b42851015611dcf57604051639db169d760e01b815260040160405180910390fd5b84841015611df0576040516335bcfe2b60e21b815260040160405180910390fd5b81831115611e1157604051631da61f9760e11b815260040160405180910390fd5b61014c82905561014b83905561014985905561014a8490556040805186815260208101869052908101849052606081018390527f21adc90360bc280b314eb6502b95564cc7180b3d7cdb300b03a8a2f41de14f3e906080015b60405180910390a15050505050565b60a5546001600160a01b03163314611ea35760405162461bcd60e51b8152600401610cf990614522565b6001600160a01b038416611eca5760405163148b036560e31b815260040160405180910390fd5b600080856001600160a01b0316620122916040518163ffffffff1660e01b815260040160006040518083038186803b158015611f0557600080fd5b505afa158015611f19573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f41919081019061407f565b92509250508163ffffffff168363ffffffff161180611f675750614e208363ffffffff16105b15611f855760405163386883d560e21b815260040160405180910390fd5b6000805b8251811015611fce5786838281518110611fa557611fa56147e5565b60200260200101511415611fbc5760019150611fce565b80611fc681614774565b915050611f89565b5080611fed5760405163f0471d8160e01b815260040160405180910390fd5b60405163523e3b4b60e11b81526001600160401b03861660048201526000906001600160a01b0389169063a47c76969060240160006040518083038186803b15801561203857600080fd5b505afa15801561204c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612074919081019061429a565b93505050506000805b82518110156120d457306001600160a01b03168382815181106120a2576120a26147e5565b60200260200101516001600160a01b031614156120c257600191506120d4565b806120cc81614774565b91505061207d565b50806120f357604051637af8935960e01b815260040160405180910390fd5b609f8054600080546001600160a01b038d166001600160a01b0319909116811790915560a08b90556001600160401b038a16610100810268ffffffffffffffffff199093169290921760011790925560a1805463ffffffff8a1663ffffffff19909116811790915560408051938452602084018c9052838101929092526060830152517ff3f5a94accd1162546526b6c953c564c76d28a3513d2f9a1ce52df04dff6b9b09181900360800190a1505050505050505050565b6001600160a01b0381166000908152606a6020526040812054600160401b90046001600160401b0316610cc9565b6001600160a01b039182166000908152606c6020908152604080832093909416825291909152205460ff1690565b60a5546001600160a01b031633146122315760405162461bcd60e51b8152600401610cf990614522565b610141546001600160a01b03161561225c576040516345db6e6960e11b815260040160405180910390fd5b61271082111561227f576040516346b7d95d60e11b815260040160405180910390fd5b6001600160a01b0381166122a657604051631a1b629760e21b815260040160405180910390fd5b61014082905561014180546001600160a01b0319166001600160a01b0383169081179091556040805184815260208101929092527fd7d086964f00d2604a80288c460231fe9cfc8e9605e838d49017401111f63adb9101611435565b60a5546001600160a01b0316331461232c5760405162461bcd60e51b8152600401610cf990614522565b6001600160a01b0381166123915760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610cf9565b61239a81612d76565b50565b60a5546001600160a01b031633146123c75760405162461bcd60e51b8152600401610cf990614522565b6123d46101448383613adb565b507f4012c6d278d4b460acbc560e9fa4425e187c3b40c848b8dfa248139729efee43610144604051611435919061449d565b6000612411826132f4565b80612420575061242082613334565b8061242f575061242f82613359565b80610cc95750610cc982613334565b6127106001600160601b03821611156124ac5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610cf9565b6001600160a01b0382166125025760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610cf9565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b9091021761010955565b6000806000609954609b5481612554576125546147b9565b049050609e54816125659190614670565b609d546125729190614644565b42108061258d5750609954609b5461258a9190614644565b84105b806125a65750600081815260a4602052604090205460ff165b156125b657600094909350915050565b600194909350915050565b600060655482108015610cc9575050600090815260696020526040902054600160e01b900460ff161590565b6000828152606b602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60a35460ff161561266d576040516390d5f04560e01b815260040160405180910390fd5b60a280546000918261267e83614774565b9091555060995490915060006126948284614670565b6097546126a191906146df565b846000815181106126b4576126b46147e5565b60200260200101516126c6919061478f565b6000848152609a60205260408120829055609b805492935084929091906126ee908490614644565b90915550506000838152609a6020908152604091829020548251868152918201527fc172d6f677c5cb603b93b418c5bbd19afeb3dc6d48a2c4b658254bdae7203b549101611e6a565b600061274282612c5c565b9050836001600160a01b031681600001516001600160a01b0316146127795760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480612797575061279785336121d9565b806127b25750336127a784610e89565b6001600160a01b0316145b9050806127d257604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0384166127f957604051633a954ecd60e21b815260040160405180910390fd5b612805600084876125ed565b6001600160a01b038581166000908152606a60209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652606990945282852080546001600160e01b031916909417600160a01b429092169190910217835587018084529220805491939091166128d95760655482146128d957805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b6065546001600160a01b03851661294e57604051622e076360e81b815260040160405180910390fd5b8361296c5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b0385166000818152606a6020908152604080832080546001600160801b031981166001600160401b038083168c018116918217600160401b67ffffffffffffffff1990941690921783900481168c01811690920217909155858452606990925290912080546001600160e01b031916909217600160a01b429092169190910217905580808501838015612a0f57506001600160a01b0387163b15155b15612a98575b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4612a606000888480600101955088612fbb565b612a7d576040516368d2bf6b60e11b815260040160405180910390fd5b80821415612a15578260655414612a9357600080fd5b612ade565b5b6040516001830192906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480821415612a99575b5060655561291e565b6000806000612af58461253c565b9250905080612b08575060009392505050565b609f5460ff1615612be75760005460a054609f5460a1546040516305d3b1d360e41b815260048101939093526101009091046001600160401b031660248301526003604483015263ffffffff166064820152600160848201526001600160a01b0390911690635d3b1d309060a401602060405180830381600087803b158015612b9057600080fd5b505af1158015612ba4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc89190614165565b50600082815260a460205260409020805460ff19166001179055612c52565b609954609b6000828254612bfb9190614644565b90915550612c0a90508261336f565b6000828152609a6020908152604091829020548251858152918201527fc172d6f677c5cb603b93b418c5bbd19afeb3dc6d48a2c4b658254bdae7203b54910160405180910390a15b5060019392505050565b604080516060810182526000808252602082018190529181019190915281606554811015612d5d57600081815260696020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290612d5b5780516001600160a01b031615612cf2579392505050565b5060001901600081815260696020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215612d56579392505050565b612cf2565b505b604051636f96cda160e11b815260040160405180910390fd5b60a580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054600160a81b900460ff16612df15760405162461bcd60e51b8152600401610cf990614557565b612df9613413565b612e01613444565b612e09613475565b612e138b8b61349e565b612e1d83876134d1565b6001600160a01b038916612e44576040516331ae7ba360e21b815260040160405180910390fd5b85612e4f8587614644565b1115612e6e57604051631a231d4360e21b815260040160405180910390fd5b85871115612e8f57604051631ddf40b160e01b815260040160405180910390fd5b612e9c426283d600614644565b821180612eab5750620d2f0081115b15612ec957604051636de655ff60e01b815260040160405180910390fd5b61014280546001600160a01b0319166001600160a01b038b16179055612ef1886101f461243e565b61013e87905561013b9590955561013f959095555061013c9190915561013d55609d91909155609e5550505050565b80341015612f4357604051639968ec3d60e01b8152346004820152602401610cf9565b8034111561239a57600033612f5883346146df565b604051600081818185875af1925050503d8060008114612f94576040519150601f19603f3d011682016040523d82523d6000602084013e612f99565b606091505b505090508061119857604051633aa9e60d60e21b815260040160405180910390fd5b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612ff0903390899088908890600401614425565b602060405180830381600087803b15801561300a57600080fd5b505af192505050801561303a575060408051601f3d908101601f1916820190925261303791810190613f2c565b60015b613095573d808015613068576040519150601f19603f3d011682016040523d82523d6000602084013e61306d565b606091505b50805161308d576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6000609954609b54816130c8576130c86147b9565b609954609b805490910190550490506130e08161336f565b60a3805460ff191660011790556000818152609a6020908152604091829020548251848152918201527fc172d6f677c5cb603b93b418c5bbd19afeb3dc6d48a2c4b658254bdae7203b54910160405180910390a150565b60008060995483613148919061465c565b90506000609c546001600160401b03811115613166576131666147fb565b6040519080825280602002602001820160405280156131ab57816020015b60408051808201909152600080825260208201528152602001906001900390816131845790505b5090506131b782613581565b6000838152609a602052604081205460995492935090916131d8908761478f565b6131e29190614644565b90506131ee818361364c565b95945050505050565b60608161321b5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613245578061322f81614774565b915061323e9050600a8361465c565b915061321f565b6000816001600160401b0381111561325f5761325f6147fb565b6040519080825280601f01601f191660200182016040528015613289576020820181803683370190505b5090505b84156130ab5761329e6001836146df565b91506132ab600a8661478f565b6132b6906030614644565b60f81b8183815181106132cb576132cb6147e5565b60200101906001600160f81b031916908160001a9053506132ed600a8661465c565b945061328d565b60006001600160e01b031982166380ac58cd60e01b148061332557506001600160e01b03198216635b5e139f60e01b145b80610cc95750610cc982613359565b60006001600160e01b0319821663152a902d60e11b1480610cc95750610cc9826132f4565b6001600160e01b0319166301ffc9a760e01b1490565b6000333a4342446133816001846146df565b604080516001600160a01b0390971660208801528601949094526060850192909252608084015260a08301524060c08201523060e0820152610100016040516020818303038152906040528051906020012060001c9050609954826133e69190614670565b6097546133f391906146df565b6133fd908261478f565b6000928352609a60205260409092209190915550565b600054600160a81b900460ff1661343c5760405162461bcd60e51b8152600401610cf990614557565b6114936137a1565b600054600160a81b900460ff1661346d5760405162461bcd60e51b8152600401610cf990614557565b6114936137d3565b600054600160a81b900460ff166114935760405162461bcd60e51b8152600401610cf990614557565b600054600160a81b900460ff166134c75760405162461bcd60e51b8152600401610cf990614557565b6111988282613803565b600054600160a81b900460ff166134fa5760405162461bcd60e51b8152600401610cf990614557565b613504828261478f565b15158061350f575081155b8061351957508082115b1561353757604051636d0ca73b60e11b815260040160405180910390fd5b6099829055609781905561354b828261465c565b613556906002614670565b609c5560988054600f9290920b6001600160801b03166001600160801b031990921691909117905550565b60606000609c546001600160401b0381111561359f5761359f6147fb565b6040519080825280602002602001820160405280156135e457816020015b60408051808201909152600080825260208201528152602001906001900390816135bd5790505b5090506000805b84811015613643576000818152609a602052604081205461360c908561364c565b905060006099548261361e91906145f5565b905061362c8583838761385d565b93505050808061363b90614774565b9150506135eb565b50909392505050565b60008281805b60028110156137845760005b609c5481101561373357600086828151811061367c5761367c6147e5565b6020026020010151600001519050600087838151811061369e5761369e6147e5565b602002602001015160200151905081600f0b85600f0b121561370c5760006136c687876145f5565b905082600f0b81600f0b12156136ed576001600160801b03169650610cc995505050505050565b6136f7868461468f565b613701908861468f565b96508195505061371e565b80600f0b85600f0b121561371e578094505b5050808061372b90614774565b91505061365e565b50609854600f90810b900b61374884846145f5565b600f0b1261377257609854613761908390600f0b61468f565b61376b908461468f565b9250600091505b8061377c81614774565b915050613652565b5061378f82826145f5565b6001600160801b031695945050505050565b600054600160a81b900460ff166137ca5760405162461bcd60e51b8152600401610cf990614557565b61149333612d76565b600054600160a81b900460ff166137fc5760405162461bcd60e51b8152600401610cf990614557565b600160d755565b600054600160a81b900460ff1661382c5760405162461bcd60e51b8152600401610cf990614557565b815161383f906067906020850190613b5f565b508051613853906068906020840190613b5f565b5060006065555050565b600081815b838110156139b957600087828151811061387e5761387e6147e5565b602002602001015160000151905060008883815181106138a0576138a06147e5565b602002602001015160200151905081600f0b88600f0b1280156138c257508584145b156138cb578293505b81600f0b88600f0b1280156138e5575081600f0b87600f0b135b80613907575087600f0b82600f0b13158015613907575080600f0b87600f0b13155b80613927575080600f0b88600f0b128015613927575080600f0b87600f0b135b156139a4576000613938898961468f565b90506139448984613abd565b9850613950838361468f565b61395a828b6145f5565b61396491906145f5565b97506040518060400160405280600019600f0b8152602001600019600f0b8152508a8581518110613997576139976147e5565b6020026020010181905250505b505080806139b190614774565b915050613862565b50825b81811115613a1857866139d06001836146df565b815181106139e0576139e06147e5565b60200260200101518782815181106139fa576139fa6147e5565b60200260200101819052508080613a1090614722565b9150506139bc565b5060408051808201909152600f86810b82526098546020830191613a3e9188910b613abd565b600f0b815250868281518110613a5657613a566147e5565b60200260200101819052508280613a6c90614774565b609854909450600f90810b810b9086900b13159050613ab357609854613aa4908790600090613a9e90600f0b8861468f565b8661385d565b5082613aaf81614774565b9350505b5090949350505050565b600081600f0b83600f0b12613ad25781613ad4565b825b9392505050565b828054613ae790614739565b90600052602060002090601f016020900481019282613b095760008555613b4f565b82601f10613b225782800160ff19823516178555613b4f565b82800160010185558215613b4f579182015b82811115613b4f578235825591602001919060010190613b34565b50613b5b929150613bd3565b5090565b828054613b6b90614739565b90600052602060002090601f016020900481019282613b8d5760008555613b4f565b82601f10613ba657805160ff1916838001178555613b4f565b82800160010185558215613b4f579182015b82811115613b4f578251825591602001919060010190613bb8565b5b80821115613b5b5760008155600101613bd4565b60006001600160401b03831115613c0157613c016147fb565b613c14601f8401601f19166020016145a2565b9050828152838383011115613c2857600080fd5b828260208301376000602084830101529392505050565b8035611d4581614811565b60008083601f840112613c5c57600080fd5b5081356001600160401b03811115613c7357600080fd5b6020830191508360208260051b850101111561125057600080fd5b600082601f830112613c9f57600080fd5b613ad483833560208501613be8565b600060208284031215613cc057600080fd5b8135613ad481614811565b60008060408385031215613cde57600080fd5b8235613ce981614811565b91506020830135613cf981614811565b809150509250929050565b600080600060608486031215613d1957600080fd5b8335613d2481614811565b92506020840135613d3481614811565b929592945050506040919091013590565b60008060008060808587031215613d5b57600080fd5b8435613d6681614811565b93506020850135613d7681614811565b92506040850135915060608501356001600160401b03811115613d9857600080fd5b8501601f81018713613da957600080fd5b613db887823560208401613be8565b91505092959194509250565b60008060408385031215613dd757600080fd5b8235613de281614811565b915060208301358015158114613cf957600080fd5b60008060008060808587031215613e0d57600080fd5b8435613e1881614811565b9350602085013592506040850135613e2f8161484e565b91506060850135613e3f8161483c565b939692955090935050565b60008060408385031215613e5d57600080fd5b8235613e6881614811565b946020939093013593505050565b60008060408385031215613e8957600080fd5b8235613e9481614811565b91506020830135613cf981614863565b60008060008060408587031215613eba57600080fd5b84356001600160401b0380821115613ed157600080fd5b613edd88838901613c4a565b90965094506020870135915080821115613ef657600080fd5b50613f0387828801613c4a565b95989497509550505050565b600060208284031215613f2157600080fd5b8135613ad481614826565b600060208284031215613f3e57600080fd5b8151613ad481614826565b60008060208385031215613f5c57600080fd5b82356001600160401b0380821115613f7357600080fd5b818501915085601f830112613f8757600080fd5b813581811115613f9657600080fd5b866020828501011115613fa857600080fd5b60209290920196919550909350505050565b60008060008060008060008060008060006101608c8e031215613fdc57600080fd5b6001600160401b03808d351115613ff257600080fd5b613fff8e8e358f01613c8e565b9b508060208e0135111561401257600080fd5b506140238d60208e01358e01613c8e565b995061403160408d01613c3f565b985061403f60608d01613c3f565b9a9d999c50979a60808101359960a0820135995060c0820135985060e0820135975061010082013596506101208201359550610140909101359350915050565b60008060006060848603121561409457600080fd5b835161ffff811681146140a657600080fd5b809350506020808501516140b98161483c565b60408601519093506001600160401b038111156140d557600080fd5b8501601f810187136140e657600080fd5b80516140f96140f4826145d2565b6145a2565b8082825284820191508484018a868560051b870101111561411957600080fd5b600094505b8385101561413c57805183526001949094019391850191850161411e565b5080955050505050509250925092565b60006020828403121561415e57600080fd5b5035919050565b60006020828403121561417757600080fd5b5051919050565b6000806040838503121561419157600080fd5b823591506020830135613cf981614811565b600080604083850312156141b657600080fd5b823591506020808401356001600160401b038111156141d457600080fd5b8401601f810186136141e557600080fd5b80356141f36140f4826145d2565b80828252848201915084840189868560051b870101111561421357600080fd5b600094505b83851015614236578035835260019490940193918501918501614218565b5080955050505050509250929050565b6000806040838503121561425957600080fd5b50508035926020909101359150565b6000806000806080858703121561427e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600080608085870312156142b057600080fd5b84516142bb81614863565b809450506020808601516142ce8161484e565b60408701519094506142df81614811565b60608701519093506001600160401b038111156142fb57600080fd5b8601601f8101881361430c57600080fd5b805161431a6140f4826145d2565b8082825284820191508484018b868560051b870101111561433a57600080fd5b600094505b8385101561436657805161435281614811565b83526001949094019391850191850161433f565b50979a9699509497505050505050565b6000815180845261438e8160208601602086016146f6565b601f01601f19169290920160200192915050565b60008084546143b081614739565b600182811680156143c857600181146143d957614408565b60ff19841687528287019450614408565b8860005260208060002060005b858110156143ff5781548a8201529084019082016143e6565b50505082870194505b50505050835161441c8183602088016146f6565b01949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061445890830184614376565b9695505050505050565b602081016004831061448457634e487b7160e01b600052602160045260246000fd5b91905290565b602081526000613ad46020830184614376565b60006020808352600084546144b181614739565b808487015260406001808416600081146144d257600181146144e657614514565b60ff19851689840152606089019550614514565b896000528660002060005b8581101561450c5781548b82018601529083019088016144f1565b8a0184019650505b509398975050505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b604051601f8201601f191681016001600160401b03811182821017156145ca576145ca6147fb565b604052919050565b60006001600160401b038211156145eb576145eb6147fb565b5060051b60200190565b600081600f0b83600f0b600082128260016001607f1b030382138115161561461f5761461f6147a3565b8260016001607f1b031903821281161561463b5761463b6147a3565b50019392505050565b60008219821115614657576146576147a3565b500190565b60008261466b5761466b6147b9565b500490565b600081600019048311821515161561468a5761468a6147a3565b500290565b600081600f0b83600f0b600081128160016001607f1b0319018312811516156146ba576146ba6147a3565b8160016001607f1b030183138116156146d5576146d56147a3565b5090039392505050565b6000828210156146f1576146f16147a3565b500390565b60005b838110156147115781810151838201526020016146f9565b83811115611ad25750506000910152565b600081614731576147316147a3565b506000190190565b600181811c9082168061474d57607f821691505b6020821081141561476e57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415614788576147886147a3565b5060010190565b60008261479e5761479e6147b9565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461239a57600080fd5b6001600160e01b03198116811461239a57600080fd5b63ffffffff8116811461239a57600080fd5b6001600160401b038116811461239a57600080fd5b6001600160601b038116811461239a57600080fdfea2646970667358221220d23e2ee8d8264019cd03b85f59ee3719b144e17aa667d697f13584237a3f7e3564736f6c63430008060033

Loading