Contract 0x4edc5406fbd68a0863a72de411e656a3c70cb341 2

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x96853e8650dcc5b8e56fb0091ff6cf2bfc0841ff9598910d5cc8bef939fba097Reveal281145992023-03-31 0:51:354 mins ago0x196d1de512a8b696e41a4a2f1989eaa586faf8b2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003897302 26.5
0x770bef4715ce73c0b0a0c058bf9896df5d32abda45162d4d21fb7d7df08c0181Reveal281116432023-03-30 23:11:561 hr 44 mins ago0x196d1de512a8b696e41a4a2f1989eaa586faf8b2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003539022 26.5
0xb85ba58744f961f7a833e162b2314e34b89d0648875ff646a8683a8a0980eee4Reveal281116102023-03-30 23:10:501 hr 45 mins ago0x196d1de512a8b696e41a4a2f1989eaa586faf8b2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.0048196875 26.5
0x0afa170593506f6bc2ba01a614e1875cc40649a6f1ca8cf99b6f42a712523c8cReveal281112922023-03-30 23:00:141 hr 55 mins ago0x6954f7add88b0c0a2761a5dd0a56913df88894c8 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003539022 26.5
0x03b2354df8a81cc311d1d1ec9eb0f2d3d8d67c2711efea0ce931230a493355c0Reveal281110652023-03-30 22:52:282 hrs 3 mins ago0x196d1de512a8b696e41a4a2f1989eaa586faf8b2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003513476 26.5
0x68d0a95b62c510baec5432205bfca2d36c101e15468258c10c91aba146d76ba9Reveal281098532023-03-30 22:11:382 hrs 44 mins ago0x196d1de512a8b696e41a4a2f1989eaa586faf8b2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003999963 26.5
0x9a2366cf87578cf3aca6045f603652abf915e4cc78ef7f75629386b252ea7398Reveal281098292023-03-30 22:10:502 hrs 45 mins ago0x196d1de512a8b696e41a4a2f1989eaa586faf8b2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003513476 26.5
0xdfb4960373dffd2c7b9beef11ac29eb12ec9efc14c75f885948d56d6172cd7fdReveal281091892023-03-30 21:49:153 hrs 6 mins ago0xac0d266639e41a4a3149f58f8d7ba8f31fe8c5df IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.0043102617 32.275000001
0xf8ae1457756b0c94f8a36c9e6d71b2ecfe6d35424c287d7eee50d3c74278bb2dReveal281091452023-03-30 21:47:483 hrs 8 mins ago0x196d1de512a8b696e41a4a2f1989eaa586faf8b2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.00473790255 28.6375
0xfad132127ccf4d11c7d9a72043142321e982b91941558271a8419e0a0e75963fReveal281076482023-03-30 21:07:563 hrs 48 mins ago0x196d1de512a8b696e41a4a2f1989eaa586faf8b2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.004630898485 31.488144842
0x05292bf237a7c3e007ad14414094ff442aea4701783b37f7767a048eb7723658Reveal281066952023-03-30 20:43:464 hrs 12 mins ago0x196d1de512a8b696e41a4a2f1989eaa586faf8b2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003948871 26.5
0x3bd189f9382de8399737267b4f75b06ab3e64b8e908f03fcb75e1d34a17c9461Reveal281056302023-03-30 20:07:454 hrs 48 mins ago0x1e2ca759bf8d1c9e81aac927dcd0cee2165764f1 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003539022 26.5
0xd09b005278e3fd8be2e6de9abc58e2bcd51ab95d861a2aa14153dc0e01ae99aaReveal281023162023-03-30 18:17:546 hrs 38 mins ago0x62cfcd9b95c0fa404bcd14d6163bc6d84003904c IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.0039486325 26.5
0xcaeccdd5f6c5fbf9d7a0c943b6b235e896b91adc243cb078fdeebed16f9ab14bReveal280985452023-03-30 16:12:458 hrs 43 mins ago0x3dd4e2266e51da610667e38b91b5488a5ed46250 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003314625
0xb4f173e1962cc56073de12f53a89904bf3e18b19e162f9c72d152028a2ad9d60Reveal280967482023-03-30 15:12:149 hrs 43 mins ago0x701535837de15a6d56441744c2016eba327af725 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003513476 26.5
0x470eb589e0d3f456c906e5b668dca6e1788c0c73f277ac0d4f25ed0c027b91bcReveal280958952023-03-30 14:43:3010 hrs 12 mins ago0xf5a8e7746c641794d8b96cbe745a7c672c36fc00 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.005305936 26.5
0xb82f2e2eb4be5047cb746a9f1c278467fd63c35c6970b114763114732c661cdaReveal280955882023-03-30 14:33:1110 hrs 22 mins ago0x0e6f958084827f4750f168902470d2e0f210b613 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.0034876915 26.5
0x60627611e692ce2a4d19dc0ca6490779b18edc64c525c5d3b8e24ad4b23cd07cReveal280953762023-03-30 14:25:5810 hrs 30 mins ago0x35762a6326c35d36d7d1b579a15af1cd166e8cfb IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003609431675 27.425
0x6cd62bcb936db0c0a8d87fe4c7432c4630e79add0c876022f6f98e362b385002Reveal280942652023-03-30 13:48:4511 hrs 7 mins ago0xe447c21dc23867e3752489c9f108efeddbf9f9c2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003897302 26.5
0xac240b37a773b0fff5bbdfd8923c7a8d6a538702b514a7486b87e03411b1faf5Reveal280844872023-03-30 8:18:3216 hrs 37 mins ago0x8ec65f179ccbe57bf3ab4e8fa3cb340786785a82 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.0034876915 26.5
0x84373521897f04769cb665aebc9c022816e1466ada3cc8b20d2e70813181b55fReveal280738292023-03-30 2:18:0922 hrs 37 mins ago0xe447c21dc23867e3752489c9f108efeddbf9f9c2 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.0034876915 26.5
0xd3db773763e0ff0c0d9ecf3bb42f74a02ea9ef3528f3d4e93361d7c4641f1f85Reveal280660582023-03-29 21:54:131 day 3 hrs ago0xf560749505363a439181e7f462795c92a44f1d7c IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003513476 26.5
0xf5df598831dc1b26937c931aa3b8c31c1ec2d6bf0338461b66407736e68fb2baReveal280660412023-03-29 21:53:381 day 3 hrs ago0xf560749505363a439181e7f462795c92a44f1d7c IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.0034876915 26.5
0xa09430c383aeb68a30cdd56100bcb0be68dd1bf97aeeab2b2f613bdf80aeca2aReveal280643832023-03-29 20:57:351 day 3 hrs ago0x35762a6326c35d36d7d1b579a15af1cd166e8cfb IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.0034876915 26.5
0xc881ef734ce7bd6426880a182caa003ef573d47d42d3e30f2708e55612aff829Reveal280552852023-03-29 15:46:471 day 9 hrs ago0x701535837de15a6d56441744c2016eba327af725 IN  0x4edc5406fbd68a0863a72de411e656a3c70cb3410 AVAX0.003609431675 27.425
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Revealer

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 2 of 18 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

    /**
     * @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) {
        _requireMinted(tokenId);

        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 overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner or approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_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 {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

        _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 {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @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.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @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`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _ownerOf(tokenId) != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

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

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId, 1);

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * 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
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

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

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a 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 _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256, /* firstTokenId */
        uint256 batchSize
    ) internal virtual {
        if (batchSize > 1) {
            if (from != address(0)) {
                _balances[from] -= batchSize;
            }
            if (to != address(0)) {
                _balances[to] += batchSize;
            }
        }
    }

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}
}

File 3 of 18 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @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`.
     *
     * 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;

    /**
     * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

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

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

File 4 of 18 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (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 IERC721Receiver {
    /**
     * @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 `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @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 6 of 18 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 8 of 18 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

File 9 of 18 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

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

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

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

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

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

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

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

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

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

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

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

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

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 12 of 18 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 15 of 18 : APAsoulbound.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "../lib/openzeppelin-contracts/contracts/access/Ownable.sol";
import "../lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";

contract APAsoulbound is Ownable, ERC721 {
    uint256 public TotalSupply;
    mapping(address => bool) public IsAdmin;
    ERC721 public immutable APA_CONTRACT;

    error TokenIsSoulbound();
    error Unauthorized();

    constructor(string memory name_, string memory symbol_, address _apaAddress) ERC721(name_, symbol_) Ownable()
    {
        APA_CONTRACT = ERC721(_apaAddress);
    }

    function setAdmin (address _adminAddress, bool _permission) external onlyOwner {
        IsAdmin[_adminAddress] = _permission;
    }

    function mint(uint _tokenID, address _recipent) external {
        if(!IsAdmin[msg.sender]) revert Unauthorized();

        TotalSupply++;
        _mint(_recipent, _tokenID);
    }

    function batchMint(uint [] calldata _tokenIDS,  address _recipent) external {
        if(!IsAdmin[msg.sender]) revert Unauthorized();
        uint256 length = _tokenIDS.length;
        for (uint index ; index < length; ) {
            TotalSupply++;
            _mint(_recipent, _tokenIDS[index]);

            unchecked {
                ++index;
            }
        }
    }

    function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize) internal override(ERC721){
        if (from != address(0)) revert TokenIsSoulbound();
        super._beforeTokenTransfer(from, to, tokenId, batchSize);
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        return APA_CONTRACT.tokenURI(tokenId);
    }
        
 }

File 16 of 18 : GoldenToken.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {MerkleProof} from "../lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol";
import {Ownable} from "../lib/openzeppelin-contracts/contracts/access/Ownable.sol";
import {ERC721} from "../lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";
import "../lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol";
import "./APAsoulbound.sol";


interface ApaRarity {
    function getRaritiesBatch(uint[] calldata tokenIds) external view returns (uint[] memory rarities);
    function getRarity(uint tokenId) external view returns (uint);

}

contract GoldenToken is Ownable, ERC721 {
    ERC721 public immutable APA_CONTRACT;
    ApaRarity public immutable APA_RARITY;
    APAsoulbound public immutable APA_SOULBOUND;
    uint256 public immutable COLLECTION_SIZE = 10000;
    uint256 immutable NULL_TOKENID = 10047;
    uint256 immutable FIESTA_TOKEN = 5;
    uint256 public immutable PUBLIC_MAX_MINTABLE_PER_TX = 5;

    bool public OpenApaBurning;
    bool public OpenWhitelistSale;
    uint256 public WhitelistSaleStartDate;
    uint256 public publicTicketSaleCost;
    uint256 public WhitelistPeriod;

    bytes32 public wlMerkleRoot;
    mapping(address => uint256) public wlRedeemed;


    uint256 public nextTokenId;
    address public exchanger;
    mapping(uint256 => uint256) public tokenRarity;
    string public baseURI;

    error Unauthorized();
    error TicketsMintedOut();
    error CostsNotCovered();
    error PublicSaleHasntStarted();
    error WhitelistSaleHasntStarted();
    error AlreadyClaimed();
    error MaxMintLimitExceeded();
    event GoldenTokenClaimed(uint apaTokenId, uint rarity, uint goldenTokenId);

    constructor(string memory name_, string memory symbol_, address _apaAddress, address _apaRarityAddress,  address _apaSoulboundAddress)
        ERC721(name_, symbol_)
    {
        APA_CONTRACT = ERC721(_apaAddress);
        WhitelistPeriod = 2 hours ;
        publicTicketSaleCost = 999;
        APA_RARITY = ApaRarity(_apaRarityAddress);
        APA_SOULBOUND = APAsoulbound(_apaSoulboundAddress);
    }

    modifier burnAllowed {
      require(OpenApaBurning);
      _;
    }

    function setExchanger(address newExchanger) public onlyOwner {
        exchanger = newExchanger;
    }

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

    function authorizeAPABurning(bool _allow) external onlyOwner {
        OpenApaBurning = _allow;
    }

    function authorizeWhitelistSale(bool _allow) external onlyOwner {
        OpenWhitelistSale = _allow;
        if (_allow == true) {
            OpenApaBurning = false;
            WhitelistSaleStartDate = block.timestamp;
        }
    }

    function setPublicTicketSaleCost(uint256 _ticketCost) external onlyOwner {
        publicTicketSaleCost = _ticketCost;
    }

    function setWhitelistPeriod(uint256 _period) external onlyOwner {
        WhitelistPeriod = _period;
    }

    function setWhitelistMerkleRoot (bytes32 _merkleRoot) external onlyOwner {
        wlMerkleRoot = _merkleRoot;
    }

    function withdraw (address payable recipient) external onlyOwner {
        recipient.transfer(address(this).balance);
    }

    function adminMint (address _recipient, uint256 _tokenType, uint256 _amount) external onlyOwner {
        if (_amount + nextTokenId > COLLECTION_SIZE) {
            revert TicketsMintedOut();
        }

        for (uint index ; index < _amount; ) {
            _mint(_recipient, nextTokenId);
            tokenRarity[nextTokenId] = _tokenType; // fiesta
            unchecked {
                ++index;
            }
            emit GoldenTokenClaimed(NULL_TOKENID, _tokenType, nextTokenId++);
        }
    }

    function emergencyRescue(uint[] calldata tokenIds, address _target) external onlyOwner {
        uint len = tokenIds.length;
        for(uint i; i < len;) {
            APA_CONTRACT.transferFrom(address(this),_target,tokenIds[i]);
            unchecked {
                ++i;
            }
        }    
    }


    function getGoldenTokenWithApaOnChainRarity(uint256 tokenId, bool _mintSoulbound) external burnAllowed{
        APA_CONTRACT.transferFrom(msg.sender, address(this), tokenId);
        _mint(msg.sender, nextTokenId);
        if (_mintSoulbound) {
            APA_SOULBOUND.mint(tokenId, msg.sender);
        }
        uint rarity = APA_RARITY.getRarity(tokenId);
        tokenRarity[nextTokenId] = rarity;
        emit GoldenTokenClaimed(tokenId,rarity,nextTokenId++);
    }

    function getGoldenTokenWithApaOnChainRarityMultiple(uint256[] calldata tokenIds, bool _mintSoulbound)
        external burnAllowed
    {
        uint256 tokenIdLen = tokenIds.length;
        uint[] memory rarities = APA_RARITY.getRaritiesBatch(tokenIds);
        for (uint256 i; i < tokenIdLen;) {
            uint256 tokenId = tokenIds[i];
            uint256 rarity = rarities[i];
            APA_CONTRACT.transferFrom(msg.sender, address(this), tokenId);
            _mint(msg.sender, nextTokenId);
            tokenRarity[nextTokenId] = rarity;
            unchecked {
                ++i;
            }
            emit GoldenTokenClaimed(tokenId, rarity, nextTokenId++);
        }

        if (_mintSoulbound) {
                APA_SOULBOUND.batchMint(tokenIds, msg.sender);
        }
    }

    function getGoldenTokenWithAvaxPublic(uint256 _amount) external payable {
        if (_amount > PUBLIC_MAX_MINTABLE_PER_TX ) { 
            revert MaxMintLimitExceeded();
        }
        if (block.timestamp <  WhitelistSaleStartDate + WhitelistPeriod) {
            revert PublicSaleHasntStarted();
        }

        if (msg.value < publicTicketSaleCost * _amount) {
            revert CostsNotCovered();
        }

        if (_amount + nextTokenId > COLLECTION_SIZE) {
            revert TicketsMintedOut();
        }
        for (uint index ; index < _amount; ) {
            _mint(msg.sender, nextTokenId);
            tokenRarity[nextTokenId] = FIESTA_TOKEN; // fiesta
            unchecked {
                ++index;
            }
            emit GoldenTokenClaimed(NULL_TOKENID,FIESTA_TOKEN,nextTokenId++);
        }
    }

    function getGoldenTokenWithAvaxWhitelist(uint256 _amount, uint256 _totalGiven, bytes32[] calldata _proof ) external payable{
        if (!OpenWhitelistSale) {
            revert WhitelistSaleHasntStarted();
        }

        if (msg.value < publicTicketSaleCost * _amount) {
            revert CostsNotCovered();
        }

        if (wlRedeemed[msg.sender] + _amount > _totalGiven) {
            revert AlreadyClaimed();
        }

        if (_amount + nextTokenId > COLLECTION_SIZE) {
            revert Unauthorized();
        }

        if (!MerkleProof.verify(_proof, wlMerkleRoot, keccak256(abi.encodePacked(msg.sender, _totalGiven)))) {
            revert Unauthorized();
        }

        wlRedeemed[msg.sender] += _amount;
        for (uint index ; index < _amount; ) {
            _mint(msg.sender, nextTokenId);
            tokenRarity[nextTokenId] = FIESTA_TOKEN; // fiesta
            unchecked {
                ++index;
            }
            emit GoldenTokenClaimed(NULL_TOKENID,FIESTA_TOKEN,nextTokenId++);
        }
    }


    function exchange(uint256 tokenId) external {
        if (msg.sender != exchanger) revert Unauthorized();
        _burn(tokenId);
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        uint256 rarity = tokenRarity[tokenId];
        return string(bytes.concat(bytes(baseURI), bytes(_toString(rarity))));
    }

    function _toString(uint256 value) internal pure returns (string memory) {
        //slither-disable-next-line incorrect-equality
        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;
            //slither-disable-next-line weak-prng
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }
}

File 17 of 18 : OOPArevealer.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "../lib/openzeppelin-contracts/contracts/access/Ownable.sol";
import "./GoldenToken.sol";
import "./VRFConsumer.sol";





interface OOPA {
   function reveal(address _to, uint256 _tokenId) external;
   function batchReval(address _to, uint256[] calldata _tokenIds) external;
   function setRevealer(address _revealerAddress) external;
}

contract Revealer is Ownable, VRFConsumerBaseV2,VRFConsumer {
GoldenToken public immutable GOLDEN_TOKEN_CONTRACT;
OOPA public immutable OOPA_CONTRACT;

uint32 constant YACHT_TOKEN = 4;
uint32 constant CABANA_TOKEN = 3;
uint32 constant SURF_TOKEN = 2;
uint32 constant CORAL_TOKEN = 1;
uint32 constant BEACH_TOKEN = 0;

uint32 constant public BEACH_TOKEN_TOTAL_AMOUNT = 3400;
uint32 constant public CORAL_TOKEN_TOTAL_AMOUNT = 2280;
uint32 constant public SURF_TOKEN_TOTAL_AMOUNT = 1600;
uint32 constant public CABANA_TOKEN_TOTAL_AMOUNT = 700;
uint32 constant public YACHT_TOKEN_TOTAL_AMOUNT = 20;
uint32 constant BATCH_REVEAL_CAP = 10;

uint32 constant public BEACH_OFFSET = 0;
uint32 constant public CORAL_OFFSET = BEACH_OFFSET + BEACH_TOKEN_TOTAL_AMOUNT;
uint32 constant public SURF_OFFSET = CORAL_OFFSET + CORAL_TOKEN_TOTAL_AMOUNT;
uint32 constant public CABANA_OFFSET = SURF_OFFSET + SURF_TOKEN_TOTAL_AMOUNT;
uint32 constant public YACHT_OFFSET = CABANA_OFFSET + CABANA_TOKEN_TOTAL_AMOUNT;

struct tokenRanges {
    uint32 beachRange;
    uint32 coralRange;
    uint32 surfRange;
    uint32 cabanaRange;
    uint32 yachtRange;
}

tokenRanges goldeTokenRange = tokenRanges (BEACH_TOKEN_TOTAL_AMOUNT, CORAL_TOKEN_TOTAL_AMOUNT, SURF_TOKEN_TOTAL_AMOUNT, CABANA_TOKEN_TOTAL_AMOUNT, YACHT_TOKEN_TOTAL_AMOUNT );

bool allowReveal;
uint256 revealed;

struct Request {
    address userAddress;
    RevealTokenCount goldenTokenCount;
}

struct RevealTokenCount {
    uint32 beachCount;
    uint32 coralCount;
    uint32 surfCount;
    uint32 cabanaCount;
    uint32 yachtCount;
    uint32 totalCount;
}


mapping(uint256 => Request) private PlayerRequest;
mapping (uint256 => uint256) private mintMap;


error TooManyTokens();
error Unauthorized();
event TokenRevealed(uint256[] tokenTypes, address minter);
 

constructor(address _goldenTokenAddress, address _oopaAddress, uint64 subscriptionId) VRFConsumer(subscriptionId) Ownable()
{
    GOLDEN_TOKEN_CONTRACT = GoldenToken(_goldenTokenAddress);
    OOPA_CONTRACT = OOPA(_oopaAddress);

}

function adminAllowReveal (bool _allow) public onlyOwner {
    allowReveal = _allow;
}

function reveal (uint [] calldata _tokenIds) public {

    if (_tokenIds.length > BATCH_REVEAL_CAP ) {
        revert TooManyTokens();
    }

    uint requestId = COORDINATOR.requestRandomWords(
        keyHash,
        s_subscriptionId,
        requestConfirmations,
        callbackGasLimit,
        numWords
       );

    RevealTokenCount memory requestTokenCount;

    for (uint index = 0; index < _tokenIds.length; ) {
        
        if(GOLDEN_TOKEN_CONTRACT.ownerOf(_tokenIds[index]) != msg.sender) {
            revert Unauthorized();
        }

        if (GOLDEN_TOKEN_CONTRACT.tokenRarity(_tokenIds[index]) == BEACH_TOKEN) {
            requestTokenCount.beachCount++;
        } else if (GOLDEN_TOKEN_CONTRACT.tokenRarity(_tokenIds[index]) == CORAL_TOKEN) {
            requestTokenCount.coralCount++;
        } else if (GOLDEN_TOKEN_CONTRACT.tokenRarity(_tokenIds[index]) == SURF_TOKEN) {
            requestTokenCount.surfCount++;
        } else if (GOLDEN_TOKEN_CONTRACT.tokenRarity(_tokenIds[index]) == CABANA_TOKEN) {
            requestTokenCount.cabanaCount++;
        } else { // YACHT_TOKEN
            requestTokenCount.yachtCount++;
        }
        requestTokenCount.totalCount++;

        GOLDEN_TOKEN_CONTRACT.exchange(_tokenIds[index]);

        unchecked {
            ++index;
        }

    }
    Request memory request = Request(msg.sender, requestTokenCount);
    PlayerRequest[requestId] = request;
}


function fulfillRandomWords(uint256 requestId , uint256[] memory randomWords) internal override {

    Request memory request = PlayerRequest[requestId];
    uint256 randomNumber = randomWords[0];
    uint256 [] memory tokenList = new uint256[](request.goldenTokenCount.totalCount);
    uint beachCount = request.goldenTokenCount.beachCount;
    uint coralCount = request.goldenTokenCount.coralCount;
    uint surfCount = request.goldenTokenCount.surfCount;
    uint cabanaCount = request.goldenTokenCount.cabanaCount;
    uint yachtCount = request.goldenTokenCount.yachtCount;
    uint offset;


    for ( uint index; index < beachCount; ) {

        randomNumber = randomNumber >> (8 * index);
        uint tokenId = getTokenId(BEACH_TOKEN,randomNumber);
        tokenList[index + offset] = tokenId;
        unchecked {
            ++index;
        }
    }
    offset += beachCount;
    for ( uint index; index < coralCount; ) {

        randomNumber = randomNumber >> (8 * index);
        uint tokenId = getTokenId(CORAL_TOKEN,randomNumber);
        tokenList[index + offset] = tokenId;
        unchecked {
            ++index;
        }
    }
    offset += coralCount;
    for ( uint index; index < surfCount; ) {

        randomNumber = randomNumber >> (8 * index);
        uint tokenId = getTokenId(SURF_TOKEN,randomNumber);
        tokenList[index + offset] = tokenId;
        unchecked {
            ++index;
        }
    }
    offset += surfCount;
    for ( uint index; index < cabanaCount; ) {

        randomNumber = randomNumber >> (8 * index);
        uint tokenId = getTokenId(CABANA_TOKEN,randomNumber);
        tokenList[index + offset] = tokenId;
        unchecked {
            ++index;
        }
    }
    offset += cabanaCount;
    for ( uint index; index < yachtCount; ) {

        randomNumber = randomNumber >> (8 * index);
        uint tokenId = getTokenId(YACHT_TOKEN,randomNumber);
        tokenList[index + offset] = tokenId;
        unchecked {
            ++index;
        }
    }
    OOPA_CONTRACT.batchReval(request.userAddress, tokenList);
    delete PlayerRequest[requestId];
    emit TokenRevealed(tokenList, request.userAddress);
}

function getRangeAndOffsetForTokenRarity(uint256 rarity) internal returns (uint offset, uint range) {

    tokenRanges memory gtRange =  goldeTokenRange;

    if (rarity == BEACH_TOKEN) {
        goldeTokenRange.beachRange--;
        return (BEACH_OFFSET, gtRange.beachRange);
    }
    else if(rarity == CORAL_TOKEN) {
        goldeTokenRange.coralRange--;
        return(CORAL_OFFSET, gtRange.coralRange);
    }
    else if(rarity == SURF_TOKEN) {
        goldeTokenRange.surfRange--;
        return(SURF_OFFSET, gtRange.surfRange);
    }
    else if(rarity == CABANA_TOKEN) {
        goldeTokenRange.cabanaRange--;
        return(CABANA_OFFSET, gtRange.cabanaRange);
    }
    else {
        goldeTokenRange.yachtRange--;
        return(YACHT_OFFSET, gtRange.yachtRange);
    }
}

function getTokenId(uint256 rarity, uint256 seed) internal returns (uint){
    uint offset;
    uint range;
    (offset, range) = getRangeAndOffsetForTokenRarity(rarity);

    uint256 rndIndex = (seed % range) + offset;

    uint tokenNumber;

    if (mintMap[rndIndex] == 0) {
        tokenNumber = rndIndex;
    }
    else {
        tokenNumber = mintMap[rndIndex];
    }

    uint lastIndex = offset + range - 1;
    uint lastElement = mintMap[lastIndex]; 

    if(lastElement == 0)
    {
        mintMap[rndIndex] = lastIndex;
    }
    else {
        mintMap[rndIndex] = lastElement;
        delete mintMap[lastIndex];
    }

    return tokenNumber;

}




}

File 18 of 18 : VRFConsumer.sol
// SPDX-License-Identifier: MIT
// An example of a consumer contract that relies on a subscription for funding.
pragma solidity ^0.8.17;

import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";

abstract contract VRFConsumer is VRFConsumerBaseV2 {
    VRFCoordinatorV2Interface immutable COORDINATOR;

    // Your subscription ID.
    uint64 immutable s_subscriptionId;

    // Rinkeby coordinator. For other networks,
    // see https://docs.chain.link/docs/vrf-contracts/#configurations
    //address constant vrfCoordinatorFuji_ = 0x78a0D48cC87Ea0444e521475FCbE84A799090D75;
    // TODO REPLACE WITH THE ACTUAL FUJI COORDINATOR
    //address constant vrfCoordinatorFuji_ = 0x2eD832Ba664535e5886b75D64C46EB9a228C2610 ;
    //address constant vrfCoordinatorAVAXMOCK = 0x82C5fA45Fc036c26C67d6c8FDb0e83c36dFc7aC9;
    address constant vrfCoordinatorAVAX = 0xd5D517aBE5cF79B7e95eC98dB0f0277788aFF634;
    // 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 constant keyHash = 0x83250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d;

    // 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 constant callbackGasLimit = 1200000;

    // The default is 3, but you can set this higher.
    uint16 constant requestConfirmations = 1;

    // For this example, retrieve 2 random values in one request.
    // Cannot exceed VRFCoordinatorV2.MAX_NUM_WORDS.
    uint32 constant numWords = 1;

    event randomWordGenerated(uint256);

    constructor(uint64 subscriptionId) VRFConsumerBaseV2(vrfCoordinatorAVAX) {
        COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinatorAVAX);
        s_subscriptionId = subscriptionId;
    }
}

Settings
{
  "remappings": [
    "@chainlink/=node_modules/@chainlink/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"address","name":"_goldenTokenAddress","type":"address"},{"internalType":"address","name":"_oopaAddress","type":"address"},{"internalType":"uint64","name":"subscriptionId","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"inputs":[],"name":"TooManyTokens","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"tokenTypes","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"minter","type":"address"}],"name":"TokenRevealed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"randomWordGenerated","type":"event"},{"inputs":[],"name":"BEACH_OFFSET","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BEACH_TOKEN_TOTAL_AMOUNT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CABANA_OFFSET","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CABANA_TOKEN_TOTAL_AMOUNT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CORAL_OFFSET","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CORAL_TOKEN_TOTAL_AMOUNT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GOLDEN_TOKEN_CONTRACT","outputs":[{"internalType":"contract GoldenToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OOPA_CONTRACT","outputs":[{"internalType":"contract OOPA","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SURF_OFFSET","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SURF_TOKEN_TOTAL_AMOUNT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YACHT_OFFSET","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YACHT_TOKEN_TOTAL_AMOUNT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_allow","type":"bool"}],"name":"adminAllowReveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101c0604052610d48610120526108e861014052610640610160526102bc6101805260146101a052600180546001600160a01b0319167014000002bc00000640000008e800000d481790553480156200005757600080fd5b5060405162001d4338038062001d438339810160408190526200007a916200014e565b8073d5d517abe5cf79b7e95ec98db0f0277788aff6346200009b33620000e1565b6001600160a01b0390811660805273d5d517abe5cf79b7e95ec98db0f0277788aff63460a0526001600160401b0390911660c05292831660e052501661010052620001a8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200014957600080fd5b919050565b6000806000606084860312156200016457600080fd5b6200016f8462000131565b92506200017f6020850162000131565b60408501519092506001600160401b03811681146200019d57600080fd5b809150509250925092565b60805160a05160c05160e05161010051611b1e620002256000396000818161025b01526110c601526000818161014001528181610599015281816106b101528181610786015281816108510152818161091c0152610a1801526000610496015260006104d70152600081816102a801526103100152611b1e6000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c806384d83156116100b25780639ef2202411610081578063c8aeaf4c11610066578063c8aeaf4c1461024d578063d63db33314610256578063f2fde38b1461027d57600080fd5b80639ef2202414610231578063b93f208a1461023a57600080fd5b806384d83156146101fb5780638da5cb5b146102035780638e7e65cf1461022157806399f1b7d31461022957600080fd5b80633be31fe01161010957806356adc403116100ee57806356adc403146101d857806366d23226146101eb578063715018a6146101f357600080fd5b80633be31fe0146101c75780633e5313c8146101cf57600080fd5b80630229b9601461013b57806302794bc91461018c5780630c741c95146101a95780631fe543e3146101b2575b600080fd5b6101627f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610194601481565b60405163ffffffff9091168152602001610183565b6101946102bc81565b6101c56101c03660046116e8565b610290565b005b610194600081565b61019461064081565b6101c56101e63660046117d0565b610350565b610194610389565b6101c56103b3565b6101946103c7565b60005473ffffffffffffffffffffffffffffffffffffffff16610162565b6101946103e7565b6101946103f7565b6101946108e881565b6101c56102483660046117f9565b610404565b610194610d4881565b6101627f000000000000000000000000000000000000000000000000000000000000000081565b6101c561028b366004611890565b610c6d565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610342576040517f1cf993f400000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044015b60405180910390fd5b61034c8282610d24565b5050565b6103586111d3565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b6106406108e861039c610d4860006118dc565b6103a691906118dc565b6103b091906118dc565b81565b6103bb6111d3565b6103c56000611254565b565b6102bc6106406108e86103dd610d4860006118dc565b61039c91906118dc565b6108e86103a6610d4860006118dc565b6103b0610d4860006118dc565b600a81111561043f576040517f748e67b200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f5d3b1d300000000000000000000000000000000000000000000000000000000081527f83250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d600482015267ffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016602482015260016044820181905262124f80606483015260848201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690635d3b1d309060a4016020604051808303816000875af1158015610535573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105599190611900565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529192505b83811015610ab157337f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16636352211e8787858181106105e5576105e5611919565b905060200201356040518263ffffffff1660e01b815260040161060a91815260200190565b602060405180830381865afa158015610627573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064b9190611948565b73ffffffffffffffffffffffffffffffffffffffff1614610698576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663afb0a3698787858181106106e8576106e8611919565b905060200201356040518263ffffffff1660e01b815260040161070d91815260200190565b602060405180830381865afa15801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e9190611900565b0361076d5781518261075f82611965565b63ffffffff169052506109e8565b600173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663afb0a3698787858181106107bd576107bd611919565b905060200201356040518263ffffffff1660e01b81526004016107e291815260200190565b602060405180830381865afa1580156107ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108239190611900565b03610838576020820180519061075f82611965565b600273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663afb0a36987878581811061088857610888611919565b905060200201356040518263ffffffff1660e01b81526004016108ad91815260200190565b602060405180830381865afa1580156108ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ee9190611900565b03610903576040820180519061075f82611965565b600373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001663afb0a36987878581811061095357610953611919565b905060200201356040518263ffffffff1660e01b815260040161097891815260200190565b602060405180830381865afa158015610995573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b99190611900565b036109ce576060820180519061075f82611965565b608082018051906109de82611965565b63ffffffff169052505b60a082018051906109f882611965565b63ffffffff1690525073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000166353556559868684818110610a4f57610a4f611919565b905060200201356040518263ffffffff1660e01b8152600401610a7491815260200190565b600060405180830381600087803b158015610a8e57600080fd5b505af1158015610aa2573d6000803e3d6000fd5b5050505080600101905061058e565b50604080518082018252338152602080820193845260009485526004815293829020905181547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178155915180516001909301805494820151928201516060830151608084015160a09094015163ffffffff9687167fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009098169790971764010000000095871695909502949094177fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff1668010000000000000000918616919091027fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff16176c0100000000000000000000000093851693909302929092177fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff16700100000000000000000000000000000000918416919091027fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff16177401000000000000000000000000000000000000000092909316919091029190911790555050565b610c756111d3565b73ffffffffffffffffffffffffffffffffffffffff8116610d18576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610339565b610d2181611254565b50565b600082815260046020908152604080832081518083018352815473ffffffffffffffffffffffffffffffffffffffff168152825160c08101845260019092015463ffffffff808216845264010000000082048116848701526801000000000000000082048116948401949094526c0100000000000000000000000081048416606084015270010000000000000000000000000000000081048416608084015274010000000000000000000000000000000000000000900490921660a082015291810191909152825190919083908290610dff57610dff611919565b602002602001015190506000826020015160a0015163ffffffff1667ffffffffffffffff811115610e3257610e326116b9565b604051908082528060200260200182016040528015610e5b578160200160208202803683370190505b506020808501518051918101516040820151606083015160809093015194955063ffffffff938416949184169390811692811691166000805b86811015610eea57610ea7816008611988565b9890981c976000610eb8818b6112c9565b90508089610ec6858561199f565b81518110610ed657610ed6611919565b602090810291909101015250600101610e94565b50610ef5868261199f565b905060005b85811015610f5157610f0d816008611988565b9890981c976000610f1f60018b6112c9565b90508089610f2d858561199f565b81518110610f3d57610f3d611919565b602090810291909101015250600101610efa565b50610f5c858261199f565b905060005b84811015610fb857610f74816008611988565b9890981c976000610f8660028b6112c9565b90508089610f94858561199f565b81518110610fa457610fa4611919565b602090810291909101015250600101610f61565b50610fc3848261199f565b905060005b8381101561101f57610fdb816008611988565b9890981c976000610fed60038b6112c9565b90508089610ffb858561199f565b8151811061100b5761100b611919565b602090810291909101015250600101610fc8565b5061102a838261199f565b905060005b8281101561108657611042816008611988565b9890981c97600061105460048b6112c9565b90508089611062858561199f565b8151811061107257611072611919565b60209081029190910101525060010161102f565b5088516040517ff0e5ccfd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169163f0e5ccfd916110fc91908b906004016119ed565b600060405180830381600087803b15801561111657600080fd5b505af115801561112a573d6000803e3d6000fd5b50505060008c8152600460205260409081902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016815560010180547fffffffffffffffff0000000000000000000000000000000000000000000000001690558a5190517f4916c3603bdabfb46d63c938debed5a7b816f122217edf95fde591ad357ad8d792506111be918a91611a24565b60405180910390a15050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610339565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060006112d785611393565b90925090506000826112e98387611a5c565b6112f3919061199f565b600081815260056020526040812054919250908103611313575080611324565b506000818152600560205260409020545b60006001611332858761199f565b61133c9190611a97565b60008181526005602052604081205491925081900361136b576000848152600560205260409020829055611384565b6000848152600560205260408082208390558382528120555b50909450505050505b92915050565b6040805160a08101825260015463ffffffff80821683526401000000008204811660208401526801000000000000000082048116938301939093526c010000000000000000000000008104831660608301527001000000000000000000000000000000009004909116608082015260009081908361144e576001805463ffffffff1690600061142183611aaa565b82546101009290920a63ffffffff8181021990931691831602179091559151600096921694509092505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84016114d95760018054640100000000900463ffffffff1690600461149383611aaa565b91906101000a81548163ffffffff021916908363ffffffff16021790555050610d4860006114c191906118dc565b60209091015163ffffffff9182169591169350915050565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe8401611575576001805468010000000000000000900463ffffffff1690600861152283611aaa565b91906101000a81548163ffffffff021916908363ffffffff160217905550506108e8610d48600061155391906118dc565b61155d91906118dc565b60409091015163ffffffff9182169591169350915050565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd840161162257600180546c01000000000000000000000000900463ffffffff1690600c6115c283611aaa565b91906101000a81548163ffffffff021916908363ffffffff160217905550506106406108e8610d4860006115f691906118dc565b61160091906118dc565b61160a91906118dc565b60609091015163ffffffff9182169591169350915050565b60018054700100000000000000000000000000000000900463ffffffff1690601061164c83611aaa565b91906101000a81548163ffffffff021916908363ffffffff160217905550506102bc6106406108e8610d48600061168391906118dc565b61168d91906118dc565b61169791906118dc565b6116a191906118dc565b60809091015163ffffffff9182169591169350915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156116fb57600080fd5b8235915060208084013567ffffffffffffffff8082111561171b57600080fd5b818601915086601f83011261172f57600080fd5b813581811115611741576117416116b9565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715611784576117846116b9565b6040529182528482019250838101850191898311156117a257600080fd5b938501935b828510156117c0578435845293850193928501926117a7565b8096505050505050509250929050565b6000602082840312156117e257600080fd5b813580151581146117f257600080fd5b9392505050565b6000806020838503121561180c57600080fd5b823567ffffffffffffffff8082111561182457600080fd5b818501915085601f83011261183857600080fd5b81358181111561184757600080fd5b8660208260051b850101111561185c57600080fd5b60209290920196919550909350505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610d2157600080fd5b6000602082840312156118a257600080fd5b81356117f28161186e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b63ffffffff8181168382160190808211156118f9576118f96118ad565b5092915050565b60006020828403121561191257600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561195a57600080fd5b81516117f28161186e565b600063ffffffff80831681810361197e5761197e6118ad565b6001019392505050565b808202811582820484141761138d5761138d6118ad565b8082018082111561138d5761138d6118ad565b600081518084526020808501945080840160005b838110156119e2578151875295820195908201906001016119c6565b509495945050505050565b73ffffffffffffffffffffffffffffffffffffffff83168152604060208201526000611a1c60408301846119b2565b949350505050565b604081526000611a3760408301856119b2565b905073ffffffffffffffffffffffffffffffffffffffff831660208301529392505050565b600082611a92577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500690565b8181038181111561138d5761138d6118ad565b600063ffffffff821680611ac057611ac06118ad565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019291505056fea2646970667358221220dbb5852fcf4d60b548d73fd530fe25b612f532b377b143818d5c21f4c3ad6afd64736f6c6343000811003300000000000000000000000076d4415947b6bba3b37b3a93c3869dcef84e19e6000000000000000000000000b5d5b4cd4303d985d83c228644b9ed10930a81520000000000000000000000000000000000000000000000000000000000000071

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

00000000000000000000000076d4415947b6bba3b37b3a93c3869dcef84e19e6000000000000000000000000b5d5b4cd4303d985d83c228644b9ed10930a81520000000000000000000000000000000000000000000000000000000000000071

-----Decoded View---------------
Arg [0] : _goldenTokenAddress (address): 0x76d4415947b6bba3b37b3a93c3869dcef84e19e6
Arg [1] : _oopaAddress (address): 0xb5d5b4cd4303d985d83c228644b9ed10930a8152
Arg [2] : subscriptionId (uint64): 113

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000076d4415947b6bba3b37b3a93c3869dcef84e19e6
Arg [1] : 000000000000000000000000b5d5b4cd4303d985d83c228644b9ed10930a8152
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000071


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.