ETH Price: $2,635.21 (-1.23%)

Token

The Warlords of Champions Tactics (WAR)
 

Overview

Max Total Supply

9,999 WAR

Holders

3,710

Market

Volume (24H)

0.1689 ETH

Min Price (24H)

$56.66 @ 0.021500 ETH

Max Price (24H)

$66.41 @ 0.025200 ETH
Balance
0 WAR
0x480c595b754c6cdf92b6dfdb1e96492f17f8e99d
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

The Warlords is a collection of 9,999 digital collectibles for the upcoming game Champions Tactics™ Grimoria Chronicles by Ubisoft.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
GenesisPFP

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 33 : GenesisPFP.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {ChainlinkVRFMetadata} from "./abstracts/ChainlinkVRFMetadata.sol";
import {ECDSA} from "openzeppelin/utils/cryptography/ECDSA.sol";
import {EIP712} from "openzeppelin/utils/cryptography/EIP712.sol";
import {ERC721Psi} from "src/ERC721Psi/ERC721Psi.sol";
import {ERC721PsiAddressData} from "src/ERC721Psi/extension/ERC721PsiAddressData.sol";
import {Errors} from "./librairies/Errors.sol";
import {IGenesisPFP} from "./interfaces/IGenesisPFP.sol";
import {GenesisBase} from "./abstracts/GenesisBase.sol";
import {MintData} from "./types/MintData.sol";
import {VRFV2WrapperConsumerBase} from "chainlink/v0.8/vrf/VRFV2WrapperConsumerBase.sol";
import {Strings} from "openzeppelin/utils/Strings.sol";

/**
 * @title GenesisPFP
 *
 * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
 * Non-Fungible Token Standard, implementing ERC721URIStorage (storage based token URI management), Ownable and EIP712 typed signatures
 *
 * Token IDs are minted in sequential order (e.g. 1, 2, 3, ...)
 * starting from 1.
 */
contract GenesisPFP is GenesisBase, IGenesisPFP, ChainlinkVRFMetadata {
    using Strings for uint256;

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

    /// @notice Minter role used for AccessControl
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    /// @notice Maximum supply
    uint256 public constant MAX_SUPPLY = 9999;

    /**
     * @notice The typeHash is designed to turn into a compile time constant in Solidity.
     * @notice see https://eips.ethereum.org/EIPS/eip-712#rationale-for-typehash for more information
     * @dev keccak256("MintData(address to,uint256 validity_start,uint256 validity_end,uint256 chain_id,uint256 mint_amount,bytes32 user_nonce)");
     */
    // EIP712 Type Hash
    bytes32 public constant MINT_DATA_TYPEHASH = keccak256(
        "MintData(address to,uint256 validity_start,uint256 validity_end,uint256 chain_id,uint256 mint_amount,bytes32 user_nonce)"
    );

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

    /**
     * @dev Initializes the contract
     * @param _name name of the contract
     * @param _symbol symbol of the contract
     * @param _version version of the contract
     * @param _minter allowed address to mint
     * @param _minter royalty receiver
     * @param _link address to fund Chainlink VRF
     * @param _vrfV2Wrapper address to interact with Chainlink VRF
     */
    constructor(
        string memory _name,
        string memory _symbol,
        string memory _version,
        address _minter,
        address _vault,
        address _link,
        address _vrfV2Wrapper
    ) ERC721Psi(_name, _symbol) EIP712(_name, _version) VRFV2WrapperConsumerBase(_link, _vrfV2Wrapper) {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        grantRole(MINTER_ROLE, _minter);
        // Set royalties to a default 5% with ERC2981
        _setDefaultRoyalty(_vault, 500);
    }

    // =============================================================
    //                   EXTERNAL
    // =============================================================

    /**
     * @inheritdoc IGenesisPFP
     */
    function mintWithSignature(MintData calldata request, bytes memory signature) external override {
        // Supply is empty
        uint256 _remainingSupply = remainingSupply();
        if (_remainingSupply == 0) revert Errors.MaxSupplyReached();
        // Signature validity begins on `MintData.validity_start`
        if (block.timestamp < request.validity_start) revert Errors.SignatureValidityStart();
        // Signature validity ends on `MintData.validity_end`
        if (block.timestamp > request.validity_end) revert Errors.SignatureValidityEnd();
        // No replay attacks
        if (block.chainid != request.chain_id) revert Errors.WrongChainID();
        // Cannot mint zero tokens
        if (request.mint_amount == 0) revert Errors.InvalidMintAmount();
        // Cannot use a user nonce twise
        if (minted[request.user_nonce]) revert Errors.AlreadyMinted();

        // Verify the signer has the role MINTER_ROLE
        address recovered = verifySignature(request, signature);
        if (!hasRole(MINTER_ROLE, recovered)) {
            revert Errors.InvalidSignature();
        }

        // Get user allocation
        uint256 allocation = request.mint_amount;

        if (request.mint_amount > _remainingSupply) {
            allocation = _remainingSupply;
        }
        // Make sure a user cannot mint twice with the same account
        minted[request.user_nonce] = true;

        _safeMint(request.to, allocation);
    }

    // =============================================================
    //                   PUBLIC
    // =============================================================

    /**
     * @dev hashTypedData V4 computes the hash of the fully encoded EIP-712 message for the domain, which can be used to recover the signer
     * @param mintData holding the typed struct used by EIP-712
     */
    function hashTypedDataV4(MintData memory mintData) public view returns (bytes32) {
        return _hashTypedDataV4(hashStruct(mintData));
    }

    function remainingSupply() public view returns (uint256) {
        return MAX_SUPPLY - _totalMinted();
    }

    // =============================================================
    //                   INTERNAL
    // =============================================================

    /**
     * @notice see https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct
     * @param mintData structure to hash
     */
    function hashStruct(MintData memory mintData) internal pure returns (bytes32) {
        return keccak256(
            abi.encode(
                MINT_DATA_TYPEHASH,
                mintData.to,
                mintData.validity_start,
                mintData.validity_end,
                mintData.chain_id,
                mintData.mint_amount,
                mintData.user_nonce
            )
        );
    }

    /**
     * @dev Takes a signature and returns the address from
     * @param mintData MintData object describing the mint request
     * @param signature EIP712-typed signature
     */
    function verifySignature(MintData calldata mintData, bytes memory signature) internal view returns (address) {
        bytes32 _hash = _hashTypedDataV4(hashStruct(mintData));
        return ECDSA.recover(_hash, signature);
    }

    // =============================================================
    //                   ERC721
    // =============================================================

    /**
     * @inheritdoc ERC721Psi
     */
    function _startTokenId() internal pure override returns (uint256) {
        return 1;
    }

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

        // Return empty tokenURI if metadata CID isn't registered
        if (bytes(_baseURI()).length == 0) {
            return "";
        }

        // Return a fallback URI if reveal isn't called yet
        if (chainlinkSeed == 0) {
            return string(abi.encodePacked(_baseURI(), "default.json"));
        }

        uint256 metadataId = ((tokenId + chainlinkSeed) % 9999) + 1;
        return string(abi.encodePacked(_baseURI(), metadataId.toString(), ".json"));
    }
}

File 2 of 33 : ChainlinkVRFMetadata.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {Errors} from "src/librairies/Errors.sol";
import {Ownable} from "openzeppelin/access/Ownable.sol";
import {VRFCoordinatorV2Interface} from "chainlink/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import {VRFV2WrapperConsumerBase} from "chainlink/v0.8/vrf/VRFV2WrapperConsumerBase.sol";

/**
 * @title ChainlinkVRFMetadata
 *
 * @dev Implementation of Chainlink VRFV2WrapperConsumerBase to request random numbers
 */
abstract contract ChainlinkVRFMetadata is VRFV2WrapperConsumerBase, Ownable {
    // =============================================================
    //                   VARIABLES
    // =============================================================

    // RequestID from the chainlink VRF V2 randomness request
    uint256 public chainlinkRequestID;

    // RandomWorlds fetched from the chainlink VRF V2 randomness request
    uint256 public chainlinkSeed;

    // =============================================================
    //                   EXTERNAL
    // =============================================================

    /**
     * @notice must called by the contract owner, contract must be funded with LINK tokens
     * @notice can only be called once if `chainlinkRequestID` isn't set
     * @dev reveal will call `requestRandomness` from VRFV2WrapperConsumerBase with
     * @dev the following parameters:
     * @dev _callbackGasLimit is the gas limit that should be used when calling the consumer's
     *        fulfillRandomWords function.
     * @dev _requestConfirmations is the number of confirmations to wait before fulfilling the
     *        request. A higher number of confirmations increases security by reducing the likelihood
     *        that a chain re-org changes a published randomness outcome.
     * @dev _numWords is the number of random words to request.
     */
    function requestChainlinkVRF(uint32 _callbackGasLimit, uint16 _requestConfirmations) external onlyOwner {
        if (chainlinkRequestID != 0) {
            revert Errors.RequestAlreadyInitialized();
        }
        // 150_000 gas should be more than enough for the callback
        // 6 block confirmations or more
        // 1 random number used a a seed for the tokenIDs
        chainlinkRequestID = requestRandomness(_callbackGasLimit, _requestConfirmations, 1);
    }

    /**
     * @notice withdraw all excess of Link tokens from the contract balance to the specified recipient
     * @param dest recipient of the Link transfer
     */
    function withdrawRemainingLink(address dest) external onlyOwner {
        uint256 balance = LINK.balanceOf(address(this));
        if (balance == 0) revert Errors.EmptyLinkBalance();
        require(LINK.transfer(dest, balance));
    }

    // =============================================================
    //                   INTERNAL
    // =============================================================

    /**
     * @notice fulfillRandomWords handles the VRF V2 wrapper response.
     * @notice Consuming contract must implement it.
     * @dev Instead of reverting, reset chainlinkRequestID if there is an error
     * @dev caused by Chainlink's oracle so we can trigger a new VRF request
     * @param _requestId is the VRF V2 request ID.
     * @param _randomWords is the randomness result.
     */
    function fulfillRandomWords(uint256 _requestId, uint256[] memory _randomWords) internal override {
        if (_requestId != chainlinkRequestID || _randomWords.length != 1) {
            chainlinkRequestID = 0;
            return;
        }
        // Assign the retrieved random word from Chainlink VRF V2
        // Anyone can re-generate the tokenIds from the seed deterministically
        chainlinkSeed = _randomWords[0];
    }
}

File 3 of 33 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 4 of 33 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 5 of 33 : ERC721Psi.sol
// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _ 
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/ 
 | |____| | \ \| |____  / /   / /_ | |  | |   
 |______|_|  \_\\_____|/_/   |____||_|  |_|   

 - github: https://github.com/estarriolvetch/ERC721Psi
 - npm: https://www.npmjs.com/package/erc721psi
                                          
 */

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/StorageSlot.sol";
import "solidity-bits/contracts/BitMaps.sol";


contract ERC721Psi is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;
    using BitMaps for BitMaps.BitMap;

    BitMaps.BitMap private _batchHead;

    string private _name;
    string private _symbol;

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

    mapping(uint256 => address) private _tokenApprovals;
    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_;
        _currentIndex = _startTokenId();
    }

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal pure virtual returns (uint256) {
        // It will become modifiable in the future versions
        return 0;
    }

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

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view virtual returns (uint256) {
        return _currentIndex - _startTokenId();
    }


    /**
     * @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 (uint) 
    {
        require(owner != address(0), "ERC721Psi: balance query for the zero address");

        uint count;
        for( uint i = _startTokenId(); i < _nextTokenId(); ++i ){
            if(_exists(i)){
                if( owner == ownerOf(i)){
                    ++count;
                }
            }
        }
        return count;
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        (address owner, ) = _ownerAndBatchHeadOf(tokenId);
        return owner;
    }

    function _ownerAndBatchHeadOf(uint256 tokenId) internal view returns (address owner, uint256 tokenIdBatchHead){
        require(_exists(tokenId), "ERC721Psi: owner query for nonexistent token");
        tokenIdBatchHead = _getBatchHead(tokenId);
        owner = _owners[tokenIdBatchHead];
    }

    /**
     * @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) {
        require(_exists(tokenId), "ERC721Psi: URI query for nonexistent token");

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

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


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

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721Psi: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        require(
            _exists(tokenId),
            "ERC721Psi: approved query for nonexistent token"
        );

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
    {
        require(operator != _msgSender(), "ERC721Psi: approve to caller");

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721Psi: transfer caller is not owner nor 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),
            "ERC721Psi: transfer caller is not owner nor 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, 1,_data),
            "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }

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

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

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

    
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal virtual {
        uint256 nextTokenId = _nextTokenId();
        _mint(to, quantity);
        require(
            _checkOnERC721Received(address(0), to, nextTokenId, quantity, _data),
            "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }


    function _mint(
        address to,
        uint256 quantity
    ) internal virtual {
        uint256 nextTokenId = _nextTokenId();
        
        require(quantity > 0, "ERC721Psi: quantity must be greater 0");
        require(to != address(0), "ERC721Psi: mint to the zero address");
        
        _beforeTokenTransfers(address(0), to, nextTokenId, quantity);
        _currentIndex += quantity;
        _owners[nextTokenId] = to;
        _batchHead.set(nextTokenId);
        _afterTokenTransfers(address(0), to, nextTokenId, quantity);
        
        // Emit events
        for(uint256 tokenId=nextTokenId; tokenId < nextTokenId + quantity; tokenId++){
            emit Transfer(address(0), to, tokenId);
        } 
    }


    /**
     * @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 {
        (address owner, uint256 tokenIdBatchHead) = _ownerAndBatchHeadOf(tokenId);

        require(
            owner == from,
            "ERC721Psi: transfer of token that is not own"
        );
        require(to != address(0), "ERC721Psi: transfer to the zero address");

        _beforeTokenTransfers(from, to, tokenId, 1);

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

        uint256 subsequentTokenId = tokenId + 1;

        if(!_batchHead.get(subsequentTokenId) &&  
            subsequentTokenId < _nextTokenId()
        ) {
            _owners[subsequentTokenId] = from;
            _batchHead.set(subsequentTokenId);
        }

        _owners[tokenId] = to;
        if(tokenId != tokenIdBatchHead) {
            _batchHead.set(tokenId);
        }

        emit Transfer(from, to, tokenId);

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

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

    /**
     * @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 startTokenId uint256 the first ID of the tokens to be transferred
     * @param quantity uint256 amount of the tokens to be transfered.
     * @param _data bytes optional data to send along with the call
     * @return r bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity,
        bytes memory _data
    ) private returns (bool r) {
        if (to.isContract()) {
            r = true;
            for(uint256 tokenId = startTokenId; tokenId < startTokenId + quantity; tokenId++){
                try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                    r = r && retval == IERC721Receiver.onERC721Received.selector;
                } catch (bytes memory reason) {
                    if (reason.length == 0) {
                        revert("ERC721Psi: transfer to non ERC721Receiver implementer");
                    } else {
                        assembly {
                            revert(add(32, reason), mload(reason))
                        }
                    }
                }
            }
            return r;
        } else {
            return true;
        }
    }

    function _getBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdBatchHead) {
        tokenIdBatchHead = _batchHead.scanForward(tokenId); 
    }


    function totalSupply() public virtual view returns (uint256) {
        return _totalMinted();
    }

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(`totalSupply`) in complexity.
     * It is meant to be called off-chain.
     *
     * This function is compatiable with ERC721AQueryable.
     */
    function tokensOfOwner(address owner) external view virtual returns (uint256[] memory) {
        unchecked {
            uint256 tokenIdsIdx;
            uint256 tokenIdsLength = balanceOf(owner);
            uint256[] memory tokenIds = new uint256[](tokenIdsLength);
            for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
                if (_exists(i)) {
                    if (ownerOf(i) == owner) {
                        tokenIds[tokenIdsIdx++] = i;
                    }
                }
            }
            return tokenIds;   
        }
    }

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

    /**
     * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
     * minting.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}
}

File 6 of 33 : ERC721PsiAddressData.sol
// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _ 
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/ 
 | |____| | \ \| |____  / /   / /_ | |  | |   
 |______|_|  \_\\_____|/_/   |____||_|  |_|   
                                              
                                            
 */
pragma solidity ^0.8.0;

import "solidity-bits/contracts/BitMaps.sol";
import "../ERC721Psi.sol";


/**
    @dev This extension follows the AddressData format of ERC721A, so
    it can be a dropped-in replacement for the contract that requires AddressData
*/ 
abstract contract ERC721PsiAddressData is ERC721Psi {
    // Mapping owner address to address data
    mapping(address => AddressData) _addressData;

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


    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) 
        public 
        view 
        virtual 
        override 
        returns (uint) 
    {
        require(owner != address(0), "ERC721Psi: balance query for the zero address");
        return uint256(_addressData[owner].balance);   
    }

    /**
     * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
     * minting.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal override virtual {
        require(quantity < 2 ** 64);
        uint64 _quantity = uint64(quantity);

        if(from != address(0)){
            _addressData[from].balance -= _quantity;
        } else {
            // Mint
            _addressData[to].numberMinted += _quantity;
        }

        if(to != address(0)){
            _addressData[to].balance += _quantity;
        } else {
            // Burn
            _addressData[from].numberBurned += _quantity;
        }
        super._afterTokenTransfers(from, to, startTokenId, quantity);
    }
}

File 7 of 33 : Errors.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

/**
 * @title Errors
 * 
 * @notice Library contains all the custom errors used to revert in Genesis contracts
 */
library Errors {
    /**
     * @notice user has already minted
     */
    error AlreadyMinted();

    /**
     * @notice signature is invalid
     */
    error InvalidSignature();

    /**
     * @notice signature is being used too early
     */
    error SignatureValidityStart();

    /**
     * @notice signature isn't valid anymore
     */
    error SignatureValidityEnd();

    /**
     * @notice signature was created for another chain_id
     */
    error WrongChainID();

    /**
     * @notice baseURI was already set once
     */
    error BaseURIAlreadyInitialized();

    /**
     * @notice token does not exist
     */
    error ERC721UriNonExistent();

    /**
     * @notice MintData.mint_amount cannot be 0
     */
    error InvalidMintAmount();

    /**
     * @notice the token maximum supply is reached
     */
    error MaxSupplyReached();

    /**
     * Chainlink VRF request was already called
     */
    error RequestAlreadyInitialized();

    /**
     * GenesisPFP contract does not own any Link tokens
     */
    error EmptyLinkBalance();
}

File 8 of 33 : IGenesisPFP.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {IGenesisBase} from "./IGenesisBase.sol";
import {MintData} from "../types/MintData.sol";

/**
 * @title IGenesisPFP
 *
 * @notice Interface for the GenesisPFP contract, implementing minting and signature verification
 */
interface IGenesisPFP {
    /**
     * @notice allows a user to mint a token with a valid signature
     * @dev signarture must be signed by the contract owner
     * @param request MintData object describing the mint request
     * @param signature EIP712-typed signature
     */
    function mintWithSignature(MintData calldata request, bytes memory signature) external;
}

File 9 of 33 : GenesisBase.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {AccessControl} from "openzeppelin/access/AccessControl.sol";
import {EIP712} from "openzeppelin/utils/cryptography/EIP712.sol";
import {ERC721Psi} from "src/ERC721Psi/ERC721Psi.sol";
import {ERC721PsiAddressData} from "src/ERC721Psi/extension/ERC721PsiAddressData.sol";
import {ERC2981} from "openzeppelin/token/common/ERC2981.sol";
import {Errors} from "../librairies/Errors.sol";
import {IAccessControl} from "openzeppelin/access/IAccessControl.sol";
import {IERC721} from "openzeppelin/token/ERC721/IERC721.sol";
import {IERC721Metadata} from "openzeppelin/token/ERC721/extensions/IERC721Metadata.sol";
import {IGenesisBase} from "../interfaces/IGenesisBase.sol";
import {MintData} from "../types/MintData.sol";
import {Ownable} from "openzeppelin/access/Ownable.sol";

/**
 * @title GenesisBase
 *
 * @dev GenesisBase implements ERC721 and should be used as a base
 * for GenesisPFP and the other upcoming Genesis contracts
 */
abstract contract GenesisBase is IGenesisBase, ERC721PsiAddressData, ERC2981, EIP712, Ownable, AccessControl {
    // =============================================================
    //                   VARIABLES
    // =============================================================

    /// @notice baseURI for computing tokenURI
    string public baseURI;

    // =============================================================
    //                   MAPPINGS
    // =============================================================

    /// @notice Mapping for an address to a bool
    /// @notice Tracks if a user minted its tokens
    mapping(bytes32 => bool) public minted;

    // =============================================================
    //                   EXTERNAL
    // =============================================================

    /**
     * @inheritdoc IGenesisBase
     */
    function setBaseURI(string calldata _uri) external override onlyOwner {
        if (bytes(baseURI).length > 0) {
            revert Errors.BaseURIAlreadyInitialized();
        }
        baseURI = _uri;
    }

    /**
     * @inheritdoc IGenesisBase
     */
    function updateDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
        _setDefaultRoyalty(receiver, feeNumerator);
    }

    // =============================================================
    //                   PUBLIC
    // =============================================================

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

    // =============================================================
    //                   INTERNAL
    // =============================================================

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

File 10 of 33 : MintData.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

/**
 * @notice MintData holds the data required to a minting request
 * @param to address of the user receiving the token(s)
 * @param validity_start timestamp for signature's start of validity
 * @param validity_end timestamp for signature's end of validity
 * @param chain_id for replay attack protection
 * @param mint_amount total number of tokens to mint if available
 * @param user_nonce generated by Genesis' backend
 */
struct MintData {
    address to;
    uint256 validity_start;
    uint256 validity_end;
    uint256 chain_id;
    uint256 mint_amount;
    bytes32 user_nonce;
}

File 11 of 33 : VRFV2WrapperConsumerBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../interfaces/LinkTokenInterface.sol";
import "../interfaces/VRFV2WrapperInterface.sol";

/** *******************************************************************************
 * @notice Interface for contracts using VRF randomness through the VRF V2 wrapper
 * ********************************************************************************
 * @dev PURPOSE
 *
 * @dev Create VRF V2 requests without the need for subscription management. Rather than creating
 * @dev and funding a VRF V2 subscription, a user can use this wrapper to create one off requests,
 * @dev paying up front rather than at fulfillment.
 *
 * @dev Since the price is determined using the gas price of the request transaction rather than
 * @dev the fulfillment transaction, the wrapper charges an additional premium on callback gas
 * @dev usage, in addition to some extra overhead costs associated with the VRFV2Wrapper contract.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFV2WrapperConsumerBase. The consumer must be funded
 * @dev with enough LINK to make the request, otherwise requests will revert. To request randomness,
 * @dev call the 'requestRandomness' function with the desired VRF parameters. This function handles
 * @dev paying for the request based on the current pricing.
 *
 * @dev Consumers must implement the fullfillRandomWords function, which will be called during
 * @dev fulfillment with the randomness result.
 */
abstract contract VRFV2WrapperConsumerBase {
  LinkTokenInterface internal immutable LINK;
  VRFV2WrapperInterface internal immutable VRF_V2_WRAPPER;

  /**
   * @param _link is the address of LinkToken
   * @param _vrfV2Wrapper is the address of the VRFV2Wrapper contract
   */
  constructor(address _link, address _vrfV2Wrapper) {
    LINK = LinkTokenInterface(_link);
    VRF_V2_WRAPPER = VRFV2WrapperInterface(_vrfV2Wrapper);
  }

  /**
   * @dev Requests randomness from the VRF V2 wrapper.
   *
   * @param _callbackGasLimit is the gas limit that should be used when calling the consumer's
   *        fulfillRandomWords function.
   * @param _requestConfirmations is the number of confirmations to wait before fulfilling the
   *        request. A higher number of confirmations increases security by reducing the likelihood
   *        that a chain re-org changes a published randomness outcome.
   * @param _numWords is the number of random words to request.
   *
   * @return requestId is the VRF V2 request ID of the newly created randomness request.
   */
  function requestRandomness(
    uint32 _callbackGasLimit,
    uint16 _requestConfirmations,
    uint32 _numWords
  ) internal returns (uint256 requestId) {
    LINK.transferAndCall(
      address(VRF_V2_WRAPPER),
      VRF_V2_WRAPPER.calculateRequestPrice(_callbackGasLimit),
      abi.encode(_callbackGasLimit, _requestConfirmations, _numWords)
    );
    return VRF_V2_WRAPPER.lastRequestId();
  }

  /**
   * @notice fulfillRandomWords handles the VRF V2 wrapper response. The consuming contract must
   * @notice implement it.
   *
   * @param _requestId is the VRF V2 request ID.
   * @param _randomWords is the randomness result.
   */
  function fulfillRandomWords(uint256 _requestId, uint256[] memory _randomWords) internal virtual;

  function rawFulfillRandomWords(uint256 _requestId, uint256[] memory _randomWords) external {
    require(msg.sender == address(VRF_V2_WRAPPER), "only VRF V2 wrapper can fulfill");
    fulfillRandomWords(_requestId, _randomWords);
  }
}

File 12 of 33 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

File 13 of 33 : 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 14 of 33 : 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 33 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 16 of 33 : 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 17 of 33 : 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 18 of 33 : 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 19 of 33 : 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 20 of 33 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 21 of 33 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }
}

File 22 of 33 : BitMaps.sol
// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */
pragma solidity ^0.8.0;

import "./BitScan.sol";
import "./Popcount.sol";

/**
 * @dev This Library is a modified version of Openzeppelin's BitMaps library with extra features.
 *
 * 1. Functions of finding the index of the closest set bit from a given index are added.
 *    The indexing of each bucket is modifed to count from the MSB to the LSB instead of from the LSB to the MSB.
 *    The modification of indexing makes finding the closest previous set bit more efficient in gas usage.
 * 2. Setting and unsetting the bitmap consecutively.
 * 3. Accounting number of set bits within a given range.   
 *
*/

/**
 * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
 * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
 */

library BitMaps {
    using BitScan for uint256;
    uint256 private constant MASK_INDEX_ZERO = (1 << 255);
    uint256 private constant MASK_FULL = type(uint256).max;

    struct BitMap {
        mapping(uint256 => uint256) _data;
    }

    /**
     * @dev Returns whether the bit at `index` is set.
     */
    function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
        uint256 bucket = index >> 8;
        uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
        return bitmap._data[bucket] & mask != 0;
    }

    /**
     * @dev Sets the bit at `index` to the boolean `value`.
     */
    function setTo(
        BitMap storage bitmap,
        uint256 index,
        bool value
    ) internal {
        if (value) {
            set(bitmap, index);
        } else {
            unset(bitmap, index);
        }
    }

    /**
     * @dev Sets the bit at `index`.
     */
    function set(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
        bitmap._data[bucket] |= mask;
    }

    /**
     * @dev Unsets the bit at `index`.
     */
    function unset(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = MASK_INDEX_ZERO >> (index & 0xff);
        bitmap._data[bucket] &= ~mask;
    }


    /**
     * @dev Consecutively sets `amount` of bits starting from the bit at `startIndex`.
     */    
    function setBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                bitmap._data[bucket] |= MASK_FULL << (256 - amount) >> bucketStartIndex;
            } else {
                bitmap._data[bucket] |= MASK_FULL >> bucketStartIndex;
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    bitmap._data[bucket] = MASK_FULL;
                    amount -= 256;
                    bucket++;
                }

                bitmap._data[bucket] |= MASK_FULL << (256 - amount);
            }
        }
    }


    /**
     * @dev Consecutively unsets `amount` of bits starting from the bit at `startIndex`.
     */    
    function unsetBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount) >> bucketStartIndex);
            } else {
                bitmap._data[bucket] &= ~(MASK_FULL >> bucketStartIndex);
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    bitmap._data[bucket] = 0;
                    amount -= 256;
                    bucket++;
                }

                bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount));
            }
        }
    }

    /**
     * @dev Returns number of set bits within a range.
     */
    function popcountA(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                count +=  Popcount.popcount256A(
                    bitmap._data[bucket] & (MASK_FULL << (256 - amount) >> bucketStartIndex)
                );
            } else {
                count += Popcount.popcount256A(
                    bitmap._data[bucket] & (MASK_FULL >> bucketStartIndex)
                );
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    count += Popcount.popcount256A(bitmap._data[bucket]);
                    amount -= 256;
                    bucket++;
                }
                count += Popcount.popcount256A(
                    bitmap._data[bucket] & (MASK_FULL << (256 - amount))
                );
            }
        }
    }

    /**
     * @dev Returns number of set bits within a range.
     */
    function popcountB(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                count +=  Popcount.popcount256B(
                    bitmap._data[bucket] & (MASK_FULL << (256 - amount) >> bucketStartIndex)
                );
            } else {
                count += Popcount.popcount256B(
                    bitmap._data[bucket] & (MASK_FULL >> bucketStartIndex)
                );
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    count += Popcount.popcount256B(bitmap._data[bucket]);
                    amount -= 256;
                    bucket++;
                }
                count += Popcount.popcount256B(
                    bitmap._data[bucket] & (MASK_FULL << (256 - amount))
                );
            }
        }
    }


    /**
     * @dev Find the closest index of the set bit before `index`.
     */
    function scanForward(BitMap storage bitmap, uint256 index) internal view returns (uint256 setBitIndex) {
        uint256 bucket = index >> 8;

        // index within the bucket
        uint256 bucketIndex = (index & 0xff);

        // load a bitboard from the bitmap.
        uint256 bb = bitmap._data[bucket];

        // offset the bitboard to scan from `bucketIndex`.
        bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex)
        
        if(bb > 0) {
            unchecked {
                setBitIndex = (bucket << 8) | (bucketIndex -  bb.bitScanForward256());    
            }
        } else {
            while(true) {
                require(bucket > 0, "BitMaps: The set bit before the index doesn't exist.");
                unchecked {
                    bucket--;
                }
                // No offset. Always scan from the least significiant bit now.
                bb = bitmap._data[bucket];
                
                if(bb > 0) {
                    unchecked {
                        setBitIndex = (bucket << 8) | (255 -  bb.bitScanForward256());
                        break;
                    }
                } 
            }
        }
    }

    function getBucket(BitMap storage bitmap, uint256 bucket) internal view returns (uint256) {
        return bitmap._data[bucket];
    }
}

File 23 of 33 : IGenesisBase.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.18;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {MintData} from "../types/MintData.sol";

/**
 * @title IGenesisBase
 *
 * @notice Interface for the GenesisBase contract used for minting and
 * setting a metadata CID on top of ERC721Psi, EIP712, Ownable, AccessControl
 */
interface IGenesisBase {
    /**
     * @notice can only be called once if baseURI isn't set
     * @notice can only be called by the contract owner
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     * @param _uri Content Identifier of the IPFS folder containing metadata files
     */
    function setBaseURI(string calldata _uri) external;

    /**
     * @notice update the default royalty informations as per ERC2981
     * @notice can only be called by the contract owner
     * @param receiver address of the new vault receiving royalty fees
     * @param feeNumerator percentage of royalties to apply
     */
    function updateDefaultRoyalty(address receiver, uint96 feeNumerator) external;
}

File 24 of 33 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

        return (royalty.receiver, royaltyAmount);
    }

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

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

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

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

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

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

File 26 of 33 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 27 of 33 : LinkTokenInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface LinkTokenInterface {
  function allowance(address owner, address spender) external view returns (uint256 remaining);

  function approve(address spender, uint256 value) external returns (bool success);

  function balanceOf(address owner) external view returns (uint256 balance);

  function decimals() external view returns (uint8 decimalPlaces);

  function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);

  function increaseApproval(address spender, uint256 subtractedValue) external;

  function name() external view returns (string memory tokenName);

  function symbol() external view returns (string memory tokenSymbol);

  function totalSupply() external view returns (uint256 totalTokensIssued);

  function transfer(address to, uint256 value) external returns (bool success);

  function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool success);

  function transferFrom(address from, address to, uint256 value) external returns (bool success);
}

File 28 of 33 : VRFV2WrapperInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface VRFV2WrapperInterface {
  /**
   * @return the request ID of the most recent VRF V2 request made by this wrapper. This should only
   * be relied option within the same transaction that the request was made.
   */
  function lastRequestId() external view returns (uint256);

  /**
   * @notice Calculates the price of a VRF request with the given callbackGasLimit at the current
   * @notice block.
   *
   * @dev This function relies on the transaction gas price which is not automatically set during
   * @dev simulation. To estimate the price at a specific gas price, use the estimatePrice function.
   *
   * @param _callbackGasLimit is the gas limit used to estimate the price.
   */
  function calculateRequestPrice(uint32 _callbackGasLimit) external view returns (uint256);

  /**
   * @notice Estimates the price of a VRF request with a specific gas limit and gas price.
   *
   * @dev This is a convenience function that can be called in simulation to better understand
   * @dev pricing.
   *
   * @param _callbackGasLimit is the gas limit used to estimate the price.
   * @param _requestGasPriceWei is the gas price in wei used for the estimation.
   */
  function estimateRequestPrice(uint32 _callbackGasLimit, uint256 _requestGasPriceWei) external view returns (uint256);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 30 of 33 : 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 31 of 33 : BitScan.sol
// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */

pragma solidity ^0.8.0;


library BitScan {
    uint256 constant private DEBRUIJN_256 = 0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff;
    bytes constant private LOOKUP_TABLE_256 = hex"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8";

    /**
        @dev Isolate the least significant set bit.
     */ 
    function isolateLS1B256(uint256 bb) pure internal returns (uint256) {
        require(bb > 0);
        unchecked {
            return bb & (0 - bb);
        }
    } 

    /**
        @dev Isolate the most significant set bit.
     */ 
    function isolateMS1B256(uint256 bb) pure internal returns (uint256) {
        require(bb > 0);
        unchecked {
            bb |= bb >> 128;
            bb |= bb >> 64;
            bb |= bb >> 32;
            bb |= bb >> 16;
            bb |= bb >> 8;
            bb |= bb >> 4;
            bb |= bb >> 2;
            bb |= bb >> 1;
            
            return (bb >> 1) + 1;
        }
    } 

    /**
        @dev Find the index of the lest significant set bit. (trailing zero count)
     */ 
    function bitScanForward256(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return uint8(LOOKUP_TABLE_256[(isolateLS1B256(bb) * DEBRUIJN_256) >> 248]);
        }   
    }

    /**
        @dev Find the index of the most significant set bit.
     */ 
    function bitScanReverse256(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return 255 - uint8(LOOKUP_TABLE_256[((isolateMS1B256(bb) * DEBRUIJN_256) >> 248)]);
        }   
    }

    function log2(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return uint8(LOOKUP_TABLE_256[(isolateMS1B256(bb) * DEBRUIJN_256) >> 248]);
        } 
    }
}

File 32 of 33 : Popcount.sol
// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */

pragma solidity ^0.8.0;

library Popcount {
    uint256 private constant m1 = 0x5555555555555555555555555555555555555555555555555555555555555555;
    uint256 private constant m2 = 0x3333333333333333333333333333333333333333333333333333333333333333;
    uint256 private constant m4 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;
    uint256 private constant h01 = 0x0101010101010101010101010101010101010101010101010101010101010101;

    function popcount256A(uint256 x) internal pure returns (uint256 count) {
        unchecked{
            for (count=0; x!=0; count++)
                x &= x - 1;
        }
    }

    function popcount256B(uint256 x) internal pure returns (uint256) {
        if (x == type(uint256).max) {
            return 256;
        }
        unchecked {
            x -= (x >> 1) & m1;             //put count of each 2 bits into those 2 bits
            x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits 
            x = (x + (x >> 4)) & m4;        //put count of each 8 bits into those 8 bits 
            x = (x * h01) >> 248;  //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ... 
        }
        return x;
    }
}

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

pragma solidity ^0.8.0;

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

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

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "ERC721Psi/=lib/ERC721Psi/contracts/",
    "solidity-bits/=lib/solidity-bits/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "chainlink/=lib/chainlink/contracts/src/",
    "erc4626-tests/=lib/chainlink/contracts/foundry-lib/openzeppelin-contracts/lib/erc4626-tests/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_version","type":"string"},{"internalType":"address","name":"_minter","type":"address"},{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_link","type":"address"},{"internalType":"address","name":"_vrfV2Wrapper","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyMinted","type":"error"},{"inputs":[],"name":"BaseURIAlreadyInitialized","type":"error"},{"inputs":[],"name":"ERC721UriNonExistent","type":"error"},{"inputs":[],"name":"EmptyLinkBalance","type":"error"},{"inputs":[],"name":"InvalidMintAmount","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"RequestAlreadyInitialized","type":"error"},{"inputs":[],"name":"SignatureValidityEnd","type":"error"},{"inputs":[],"name":"SignatureValidityStart","type":"error"},{"inputs":[],"name":"WrongChainID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_DATA_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkRequestID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainlinkSeed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"validity_start","type":"uint256"},{"internalType":"uint256","name":"validity_end","type":"uint256"},{"internalType":"uint256","name":"chain_id","type":"uint256"},{"internalType":"uint256","name":"mint_amount","type":"uint256"},{"internalType":"bytes32","name":"user_nonce","type":"bytes32"}],"internalType":"struct MintData","name":"mintData","type":"tuple"}],"name":"hashTypedDataV4","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"validity_start","type":"uint256"},{"internalType":"uint256","name":"validity_end","type":"uint256"},{"internalType":"uint256","name":"chain_id","type":"uint256"},{"internalType":"uint256","name":"mint_amount","type":"uint256"},{"internalType":"bytes32","name":"user_nonce","type":"bytes32"}],"internalType":"struct MintData","name":"request","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mintWithSignature","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"minted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256[]","name":"_randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"remainingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_callbackGasLimit","type":"uint32"},{"internalType":"uint16","name":"_requestConfirmations","type":"uint16"}],"name":"requestChainlinkVRF","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"updateDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"dest","type":"address"}],"name":"withdrawRemainingLink","outputs":[],"stateMutability":"nonpayable","type":"function"}]

61018060408181523462000905576200414080380380916200002282866200090a565b8439820160e083820312620009055782516001600160401b0391908281116200090557816200005391860162000953565b92602092838601518181116200090557836200007191880162000953565b92828701519082821162000905576200008c91880162000953565b936200009b60608801620009ae565b95620000aa60808901620009ae565b97620000c760c0620000bf60a08401620009ae565b9201620009ae565b6001600160a01b03918216608052811660a052815198848a11620008275760019687549a888c811c9c168015620008fa575b868d10146200080657601f9b8c8111620008af575b5080868d821160011462000849576000916200083d575b50600019600383901b1c191690891b1788555b8051908682116200082757600254908982811c921680156200081c575b878310146200080657818d849311620007af575b5086908d8311600114620007455760009262000739575b5050600019600383901b1c191690881b176002555b600492878455848151910120978481519101209961012099898b52610140988c8a524660e0528851928784019d8e9c7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f809e528b86015260608501524660808501523060a085015260a0845260c084019d8e8a86821091111762000647578e8b528451902060c052306101009081526101609c8d52600a8054336001600160a01b031982168117909255919f9188167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a360008052600b89528a60002033600052895260ff8b600020541615620006fc575b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a69485600052600b8a52838c6000200154806000528c600020336000528b5260ff8d60002054161562000428575050505082600052600b8752848960002092169182600052875260ff89600020541615620003e9575b50505016928315620003a7578451918286019182118383101762000392575084528281526101f4910152607d60a21b17600855516137149490939085620009ec86396080518581816106f5015261167b015260a0518581816106530152611a39015260c05185612fed015260e051856130a801525184612fb70152518361303c01525182613062015251816130190152f35b604190634e487b7160e01b6000525260246000fd5b5060649184519162461bcd60e51b8352820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152fd5b82600052600b875288600020826000528752886000209060ff19825416179055339160008051602062004100833981519152600080a438808062000300565b8f8d93868e8e958e9589953390830186811085821117620006e7578a52602a865260e08301928a368537865115620006d257603084538651861015620006d25760e1607891015360295b8581116200068c57506200065c578851926080840190811184821017620006475789526042835287830193606036863783511562000632576030855383518110156200063257607860218501536041905b808211620005c05750506200059057966200056160488862000584957f416363657373436f6e74726f6c3a206163636f756e74200000000000000000009897956200055160449c9d620005278851998a9687019d8e5251809260378801906200092e565b8401917001034b99036b4b9b9b4b733903937b6329607d1b6037840152518093868401906200092e565b010360288101855201836200090a565b5196879562461bcd60e51b8752860152518093816024870152868601906200092e565b01601f19168101030190fd5b60648688808b519262461bcd60e51b84528301526024820152600080516020620041208339815191526044820152fd5b9091600f811660108110156200061d576f181899199a1a9b1b9c1cb0b131b232b360811b901a620005f28487620009c3565b53881c91801562000608576000190190620004c3565b601189634e487b7160e01b6000525260246000fd5b60328a634e487b7160e01b6000525260246000fd5b603288634e487b7160e01b6000525260246000fd5b604188634e487b7160e01b6000525260246000fd5b60648789808c519262461bcd60e51b84528301526024820152600080516020620041208339815191526044820152fd5b90600f811660108110156200061d576f181899199a1a9b1b9c1cb0b131b232b360811b901a620006bd8389620009c3565b53881c90801562000608576000190162000472565b603289634e487b7160e01b6000525260246000fd5b604189634e487b7160e01b6000525260246000fd5b60008052600b89528a6000203360005289528a6000208360ff1982541617905533336000600080516020620041008339815191528180a46200028a565b01519050388062000180565b908a9350601f198316916002600052886000209260005b8a8282106200079857505084116200077e575b505050811b0160025562000195565b015160001960f88460031b161c191690553880806200076f565b8385015186558e979095019493840193016200075c565b9091506002600052866000208d80850160051c820192898610620007fc575b918c91869594930160051c01915b828110620007ec57505062000169565b600081558594508c9101620007dc565b92508192620007ce565b634e487b7160e01b600052602260045260246000fd5b91607f169162000155565b634e487b7160e01b600052604160045260246000fd5b90508501513862000125565b8a9250601f1982169083600052886000209160005b8a8282106200089857505083116200087e575b5050811b01885562000138565b87015160001960f88460031b161c19169055388062000871565b838b015185558e969094019392830192016200085e565b89600052866000208d80840160051c820192898510620008f0575b0160051c01908a905b828110620008e35750506200010e565b60008155018a90620008d3565b92508192620008ca565b9b607f169b620000f9565b600080fd5b601f909101601f19168101906001600160401b038211908210176200082757604052565b60005b838110620009425750506000910152565b818101518382015260200162000931565b81601f82011215620009055780516001600160401b0381116200082757604051926200098a601f8301601f1916602001856200090a565b818452602082840101116200090557620009ab91602080850191016200092e565b90565b51906001600160a01b03821682036200090557565b908151811015620009d5570160200190565b634e487b7160e01b600052603260045260246000fdfe6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461029757806306fdde0314610292578063081812fc1461028d578063095ea7b31461028857806318160ddd14610283578063191f61d41461027e5780631a23a7eb146102795780631fe543e31461027457806323b872dd1461026f578063248a9ca31461026a5780632a55205a146102655780632f2ff15d1461026057806332cb6b0c1461025b57806336568abe1461025657806337ca8c031461025157806342842e0e1461024c57806355f804b3146102475780636352211e146102425780636c0360eb1461023d5780636c766e491461023857806370a0823114610233578063715018a61461022e57806372581802146102295780638462151c146102245780638ccc5f801461021f5780638da5cb5b1461021a57806391d148541461021557806394e673c71461021057806395d89b411461020b578063a217fddf14610206578063a22cb46514610201578063b88d4fde146101fc578063c6a361c9146101f7578063c87b56dd146101f2578063d5391393146101ed578063d547741f146101e8578063d691e43c146101e3578063da0239a6146101de578063e985e9c5146101d95763f2fde38b146101d457600080fd5b61196e565b611912565b6118f7565b6117ef565b6117ad565b611772565b611753565b611638565b6115e2565b6114f2565b6114cc565b611425565b6113c6565b61131e565b6112f5565b6112c4565b61120f565b6111b6565b611158565b611131565b611113565b6110e3565b610fbc565b610e6a565b610e42565b610e07565b610d71565b610d54565b610c87565b610be0565b610bb1565b610b88565b610ad1565b610901565b6105ee565b6105cb565b6104d5565b610494565b6103b1565b6102b3565b6001600160e01b03198116036102ae57565b600080fd5b346102ae5760203660031901126102ae5760206004356102d28161029c565b63ffffffff60e01b16637965db0b60e01b81149081156102f8575b506040519015158152f35b63152a902d60e11b811491508115610312575b50386102ed565b6380ac58cd60e01b811491508115610344575b8115610333575b503861030b565b6301ffc9a760e01b1490503861032c565b635b5e139f60e01b81149150610325565b60005b8381106103685750506000910152565b8181015183820152602001610358565b9060209161039181518092818552858086019101610355565b601f01601f1916010190565b9060206103ae928181520190610378565b90565b346102ae5760008060031936011261049157604051908060018054916103d683610fed565b80865292828116908115610467575060011461040d575b610409856103fd8187038261086f565b6040519182918261039d565b0390f35b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b82841061044f5750505081016020016103fd826104096103ed565b80546020858701810191909152909301928101610434565b869550610409969350602092506103fd94915060ff191682840152151560051b82010192936103ed565b80fd5b346102ae5760203660031901126102ae5760206104b260043561209c565b6040516001600160a01b039091168152f35b6001600160a01b038116036102ae57565b346102ae5760403660031901126102ae576004356104f2816104c4565b6024356104fe81611f09565b50916001600160a01b03808416908216811461057a576105319361052c913314908115610533575b5061202a565b612585565b005b6001600160a01b03166000908152600660205260409020610574915061056d9033905b9060018060a01b0316600052602052604060002090565b5460ff1690565b38610526565b60405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608490fd5b346102ae5760003660031901126102ae5760206105e6612ae0565b604051908152f35b346102ae576040806003193601126102ae5760043563ffffffff811681036102ae576024359161ffff831683036102ae57610627611ca5565b600e546107d75780516310c1b4d560e21b815263ffffffff831660048201526020936001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169291908683602481875afa8015610782576106f19688946000926107b4575b506106d3906106c5885195869288840160409061ffff600193959463ffffffff60608401971683521660208201520152565b03601f19810185528461086f565b60008651809881958294630200057560e51b845289600485016135c9565b03927f0000000000000000000000000000000000000000000000000000000000000000165af1918215610782576004938593610787575b505163fc2a88c360e01b815292839182905afa9081156107825761053192600092610755575b5050600e55565b6107749250803d1061077b575b61076c818361086f565b8101906135a5565b388061074e565b503d610762565b61266a565b6107a690843d86116107ad575b61079e818361086f565b8101906135b4565b5038610728565b503d610794565b6106d39192506107d090863d881161077b5761076c818361086f565b9190610693565b516325e9548560e21b8152600490fd5b634e487b7160e01b600052604160045260246000fd5b60c081019081106001600160401b0382111761081857604052565b6107e7565b604081019081106001600160401b0382111761081857604052565b602081019081106001600160401b0382111761081857604052565b61012081019081106001600160401b0382111761081857604052565b90601f801991011681019081106001600160401b0382111761081857604052565b6040519061089d8261081d565b565b6001600160401b03811161081857601f01601f191660200190565b81601f820112156102ae578035906108d18261089f565b926108df604051948561086f565b828452602083830101116102ae57816000926020809301838601378301015290565b346102ae57366003190160e081126102ae5760c0136102ae5760c4356001600160401b0381116102ae5761093a600491369083016108ba565b6109426130ce565b908115610aa9576024354210610a98576044354211610a87576064354603610a7657608435918215610a655760a4359161098961056d84600052600d602052604060002090565b610a54576109f26109b56109f6926109b06109ab6109a636611374565b6130e6565b612f6d565b61317b565b6001600160a01b031660009081527ff70e363b3d7895af770c4a138460777d52eebd3cb9962ccc6b58721f6127bbc8602052604090205460ff1690565b1590565b610a43576105319350808311610a39575b50610a1f610a2c91600052600d602052604060002090565b805460ff19166001179055565b610a34612dcb565b612dd7565b9150610a1f610a07565b604051638baa579f60e01b81528490fd5b604051631bbdf5c560e31b81528590fd5b60405163199f5a0360e31b81528490fd5b60405163e21c266f60e01b81528390fd5b604051636105d05f60e11b81528390fd5b6040516301546a7760e01b81528390fd5b60405163d05cb60960e01b81528390fd5b6001600160401b0381116108185760051b60200190565b346102ae5760403660031901126102ae576024356001600160401b0381116102ae57366023820112156102ae57806004013590610b0d82610aba565b90610b1b604051928361086f565b82825260209260248484019160051b830101913683116102ae57602401905b828210610b4d5761053184600435611a36565b81358152908401908401610b3a565b60609060031901126102ae57600435610b74816104c4565b90602435610b81816104c4565b9060443590565b346102ae57610531610b9936610b5c565b91610bac610ba78433612245565b612122565b61237c565b346102ae5760203660031901126102ae57600435600052600b6020526020600160406000200154604051908152f35b346102ae5760403660031901126102ae576004356000526009602052604060002060405190610c0e8261081d565b546001600160a01b03811680835260a09190911c602083015215610c79575b610c5d612710610c4c6001600160601b03602085015116602435611d39565b92519204916001600160a01b031690565b604080516001600160a01b039290921682526020820192909252f35b50610c82611cfd565b610c2d565b346102ae5760403660031901126102ae57600435602435610ca7816104c4565b600091808352600b602052610cc26001604085200154611aba565b808352600b602090815260408085206001600160a01b0385166000908152925290205460ff1615610cf1578280f35b808352600b602090815260408085206001600160a01b038516600090815292529020805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a438808280f35b346102ae5760003660031901126102ae57602060405161270f8152f35b346102ae5760403660031901126102ae57602435610d8e816104c4565b336001600160a01b03821603610daa5761053190600435611c12565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b346102ae5760003660031901126102ae5760206040517f5671fbb49e96506fa1bf458ae595e6b5aa91747fa8fd744a8e7987e92b4e7eb18152f35b346102ae57610531610e5336610b5c565b9060405192610e6184610838565b6000845261218b565b346102ae576020806003193601126102ae576001600160401b036004358181116102ae57366023820112156102ae5780600401359182116102ae57602490368284830101116102ae57610ebb611ca5565b600c54610ec781610fed565b610faa5783610ed8610edd92610fed565b613621565b600093601f8411600114610f1e5750928293600093610f11575b505050600019600383901b1c191660019190911b17600c55005b0101359050388080610ef7565b91601f19841694610f51600c6000527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c790565b9381905b878210610f905750508460019610610f74575b50505050811b01600c55005b60001960f88660031b161c199201013516905538808080610f68565b806001849786839596890101358155019601920190610f55565b604051636f2c52f960e01b8152600490fd5b346102ae5760203660031901126102ae576020610fda600435611f09565b506040516001600160a01b039091168152f35b90600182811c9216801561101d575b602083101461100757565b634e487b7160e01b600052602260045260246000fd5b91607f1691610ffc565b60405190600082600c549161103b83610fed565b808352926001908181169081156110c15750600114611062575b5061089d9250038361086f565b600c600090815291507fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c75b8483106110a6575061089d935050810160200138611055565b81935090816020925483858a0101520191019091859261108d565b90506020925061089d94915060ff191682840152151560051b82010138611055565b346102ae5760003660031901126102ae576104096110ff611027565b604051918291602083526020830190610378565b346102ae5760003660031901126102ae576020600f54604051908152f35b346102ae5760203660031901126102ae5760206105e6600435611153816104c4565b612b06565b346102ae5760008060031936011261049157611172611ca5565b600a80546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102ae5760003660031901126102ae576020600e54604051908152f35b6020908160408183019282815285518094520193019160005b8281106111fb575050505090565b8351855293810193928101926001016111ed565b346102ae5760203660031901126102ae5760043561122c816104c4565b600061123782612b06565b61124081610aba565b9161124e604051938461086f565b818352601f1961125d83610aba565b01366020850137600193845b83830361127e576040518061040987826111d4565b80611289879261222d565b611294575b01611269565b61129d81611f09565b506001600160a01b0384811691160361128e57806112be8386019588612af2565b5261128e565b346102ae5760203660031901126102ae57600435600052600d602052602060ff604060002054166040519015158152f35b346102ae5760003660031901126102ae57600a546040516001600160a01b039091168152602090f35b346102ae5760403660031901126102ae57602060ff611368602435611342816104c4565b600435600052600b845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b60c09060031901126102ae576040519061138d826107fd565b8160043561139a816104c4565b8152602435602082015260443560408201526064356060820152608435608082015260a060a435910152565b346102ae5760c03660031901126102ae5760206105e66109ab6040516113eb816107fd565b6004356113f7816104c4565b81526024358482015260443560408201526064356060820152608435608082015260a43560a08201526130e6565b346102ae5760008060031936011261049157604051908060025461144881610fed565b80855291600191808316908115610467575060011461147157610409856103fd8187038261086f565b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b8284106114b45750505081016020016103fd826104096103ed565b80546020858701810191909152909301928101611499565b346102ae5760003660031901126102ae57602060405160008152f35b801515036102ae57565b346102ae5760403660031901126102ae5760043561150f816104c4565b60243561151b816114e8565b6001600160a01b0382169133831461159d578161155a61156b9233600052600660205260406000209060018060a01b0316600052602052604060002090565b9060ff801983541691151516179055565b604051901515815233907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b60405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606490fd5b346102ae5760803660031901126102ae576004356115ff816104c4565b60243561160b816104c4565b606435916001600160401b0383116102ae5761162e6105319336906004016108ba565b916044359161218b565b346102ae576020806003193601126102ae57600435611656816104c4565b61165e611ca5565b6040516370a0823160e01b81523060048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691908381602481865afa90811561078257600091611736575b5080156117245760405163a9059cbb60e01b81526001600160a01b039290921660048301526024820152908290829060449082906000905af19081156107825761053192600092611707575b5050612ad9565b61171d9250803d106107ad5761079e818361086f565b3880611700565b6040516322da1a0760e21b8152600490fd5b61174d9150843d861161077b5761076c818361086f565b386116b4565b346102ae5760203660031901126102ae576104096110ff60043561338a565b346102ae5760003660031901126102ae5760206040517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68152f35b346102ae5760403660031901126102ae576105316024356004356117d0826104c4565b80600052600b6020526117ea600160406000200154611aba565b611c12565b346102ae5760403660031901126102ae5760043561180c816104c4565b602435906001600160601b0382168083036102ae576127109061182d611ca5565b1161189f57610531916118789061184e6001600160a01b0384161515613692565b611868611859610890565b6001600160a01b039094168452565b6001600160601b03166020830152565b805160209091015160a01b6001600160a01b0319166001600160a01b039190911617600855565b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608490fd5b346102ae5760003660031901126102ae5760206105e66130ce565b346102ae5760403660031901126102ae57602060ff611368600435611936816104c4565b60243590611943826104c4565b60018060a01b03166000526006845260406000209060018060a01b0316600052602052604060002090565b346102ae5760203660031901126102ae5760043561198b816104c4565b611993611ca5565b6001600160a01b039081169081156119e257600a54826001600160601b0360a01b821617600a55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303611a705761089d916135ed565b60405162461bcd60e51b815260206004820152601f60248201527f6f6e6c792056524620563220777261707065722063616e2066756c66696c6c006044820152606490fd5b541690565b6000818152600b6020908152604080832033845290915290205460ff1615611adf5750565b3390611ae9611d7f565b916030611af584611df3565b536078611b0184611e00565b5360295b60018111611bb457611bb0611b6d611b9886611b8a611b2d88611b288915611e2e565b611e79565b611b67604051958694611b67602087016017907f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081520190565b90611bfb565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110190565b03601f19810183528261086f565b60405162461bcd60e51b81529182916004830161039d565b0390fd5b90600f8116906010821015611bf657611bf1916f181899199a1a9b1b9c1cb0b131b232b360811b901a611be78487611e10565b5360041c91611e21565b611b05565b611ddd565b90611c0e60209282815194859201610355565b0190565b600090808252600b60205260ff611c3e84604085209060018060a01b0316600052602052604060002090565b5416611c4957505050565b808252600b602090815260408084206001600160a01b038616600090815292529020805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4565b600a546001600160a01b03163303611cb957565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60405190611d0a8261081d565b6008546001600160a01b038116835260a01c6020830152565b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715611d4c57565b611d23565b9060018201809211611d4c57565b91908201809211611d4c57565b60405190611d7982610838565b60008252565b60405190606082018281106001600160401b0382111761081857604052602a8252604082602036910137565b90611db58261089f565b611dc2604051918261086f565b8281528092611dd3601f199161089f565b0190602036910137565b634e487b7160e01b600052603260045260246000fd5b805115611bf65760200190565b805160011015611bf65760210190565b908151811015611bf6570160200190565b8015611d4c576000190190565b15611e3557565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b60405190608082018281106001600160401b03821117610818576040526042825260603660208401376030611ead83611df3565b536078611eb983611e00565b536041905b60018211611ed1576103ae915015611e2e565b600f8116906010821015611bf657611f03916f181899199a1a9b1b9c1cb0b131b232b360811b901a611be78486611e10565b90611ebe565b611f128161222d565b15611fd057600090600891604060ff83851c9316918381528060205220548160ff181c801515600014611f7e57611f4b611f5191612946565b60ff1690565b9003911b175b611f7b611f6e826000526003602052604060002090565b546001600160a01b031690565b91565b50505b611f8c8115156128dd565b60001901611fa4816000526000602052604060002090565b5480611fb05750611f81565b611f4b611fbf611fc892612946565b60ff9081031690565b911b17611f57565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608490fd5b1561203157565b60405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608490fd5b6120a58161222d565b156120c5576000908152600560205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b1561212957565b60405162461bcd60e51b815260206004820152603460248201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6044820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b6064820152608490fd5b9161089d93916121b2936121a2610ba78433612245565b6121ad83838361237c565b6126a6565b61220d565b60809060208152603560208201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b60608201520190565b1561221457565b60405162461bcd60e51b815280611bb0600482016121b7565b6004548110908161223c575090565b90506001111590565b61224e8261222d565b156122c35761225c82611f09565b506001600160a01b0382811682821681149490919085156122ab575b505050821561228657505090565b6001600160a01b0316600090815260066020526040902060ff9250611ab59190610556565b6122b8919293955061209c565b161491388080612278565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b1561232757565b60405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608490fd5b61238583611f09565b6001600160a01b0394918386169086168190036124d65761089d958516916123ae831515612320565b6123b784612530565b6123c084611d51565b6123e86109f2828060081c600052600060205260ff6001811b91161c60406000205416151590565b806124cb575b612487575b5061242b8661240c866000526003602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b830361245c575b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4612bbd565b612482838060081c600052600060205260406000209060ff6001811b91161c8154179055565b612432565b806124a38761240c6124c5946000526003602052604060002090565b8060081c600052600060205260406000209060ff6001811b91161c8154179055565b386123f3565b5060045481106123ee565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608490fd5b600081815260056020526040812080546001600160a01b031916905561255582611f09565b506001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258280a4565b600082815260056020526040902080546001600160a01b0319166001600160a01b0383161790556125b582611f09565b506001600160a01b0391821691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b6000198114611d4c5760010190565b908160209103126102ae57516103ae8161029c565b6103ae939260809260018060a01b031682526000602083015260408201528160608201520190610378565b6001600160a01b0391821681529116602082015260408101919091526080606082018190526103ae92910190610378565b6040513d6000823e3d90fd5b3d156126a1573d906126878261089f565b91612695604051938461086f565b82523d6000602084013e565b606090565b9192813b156127d65790929160019081948285935b6126c9575b50505050505090565b6126d68697989596611d51565b8410156127cd57604095865197630a85bd0160e11b998a8a5260209a8b60049b808d878c8c339385019361270994612639565b6000929184918391900381856001600160a01b038e165af191928261279e575b505061275f578c8c8c61273a612676565b8051938461275957825162461bcd60e51b815280611bb08187016121b7565b84925001fd5b91939699509194979a5061277e939699508261278a575b5050966125ea565b928095929491956126bb565b6001600160e01b0319161490503880612776565b6127be929350803d106127c6575b6127b6818361086f565b8101906125f9565b90388e612729565b503d6127ac565b849796506126c0565b50505050600190565b9293909290813b156128d357600184935b6127fa8187611d5f565b8510156128ca57604051630a85bd0160e11b81528061281e8988336004850161260e565b6000916020918491900381846001600160a01b038b165af19091816128a9575b506128715761284b612676565b8051908161286c5760405162461bcd60e51b815280611bb0600482016121b7565b602001fd5b6127fa92612886918161288e575b50956125ea565b9491506127f0565b6001600160e01b031916630a85bd0160e11b1490503861287f565b6128c391925060203d6020116127c6576127b6818361086f565b903861283e565b50945092505050565b9350505050600190565b156128e457565b60405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608490fd5b60405161295281610853565b7ffd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f86101008083527e01020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7560208401527f06264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c960408401527f071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee360608401527f0e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf760808401527fff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c860a08401527f16365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f660c08401527ffe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf560e084015282015281156102ae57612ac5612ad3917e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff846103ae95600003160260f81c90611e10565b516001600160f81b03191690565b60f81c90565b156102ae57565b6004546000198101908111611d4c5790565b8051821015611bf65760209160051b010190565b6001600160a01b03168015612b2f5760005260076020526001600160401b036040600020541690565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608490fd5b9060016001600160401b0380931601918211611d4c57565b9190916001600160401b0380809416911601918211611d4c57565b6001600160a01b0381811615612cc9576001600160a01b03821660009081526007602052604090206001600160401b036000198183541601908111611d4c57815467ffffffffffffffff19166001600160401b039091161790555b821615612c6e57506001600160a01b0316600090815260076020526040902061089d90612c54612c4f82546001600160401b031690565b612b8a565b6001600160401b03166001600160401b0319825416179055565b6001600160a01b0316600090815260076020526040902061089d91508054612ca19060801c6001600160401b0316612b8a565b815467ffffffffffffffff60801b191660809190911b67ffffffffffffffff60801b16179055565b6001600160a01b0383166000908152600760205260409020612d2290612cfb6001600160401b03825460401c16612b8a565b67ffffffffffffffff60401b82549160401b169067ffffffffffffffff60401b1916179055565b612c18565b90680100000000000000008110156102ae576001600160a01b03821660009081526007602052604090206001600160401b039182169290612d7290612cfb8585835460401c16612ba2565b6001600160a01b03811615612da9576001600160a01b0316600090815260076020526040902061089d92612c549192835416612ba2565b50612ca161089d92600080526007602052604060002092835460801c16612ba2565b6004356103ae816104c4565b909160405190612de682610838565b600091828152600454948015612ec2576001600160a01b03851695612e0c871515612f15565b612e1e612e198383611d5f565b600455565b612e368661240c836000526003602052604060002090565b612e5c818060081c600052600060205260406000209060ff6001811b91161c8154179055565b612e668287612d27565b805b612e728383611d5f565b811015612eae5780612ea99189887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a46125ea565b612e68565b5090919295506121b2935061089d946127df565b60405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608490fd5b15612f1c57565b60405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b612f75612fb4565b9060405190602082019261190160f01b84526022830152604282015260428152608081018181106001600160401b038211176108185760405251902090565b307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614806130a5575b1561300f577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f000000000000000000000000000000000000000000000000000000000000000082527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a0815261309f816107fd565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000004614612fe6565b6130d6612ae0565b61270f908103908111611d4c5790565b60018060a01b0381511690602081015190604081015190606081015160a06080830151920151926040519460208601967f5671fbb49e96506fa1bf458ae595e6b5aa91747fa8fd744a8e7987e92b4e7eb1885260408701526060860152608085015260a084015260c083015260e082015260e0815261010081018181106001600160401b038211176108185760405251902090565b6103ae91613188916132d0565b9190916131b0565b6005111561319a57565b634e487b7160e01b600052602160045260246000fd5b6131b981613190565b806131c15750565b6131ca81613190565b600181036132175760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b61322081613190565b6002810361326d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b80613279600392613190565b1461328057565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b9060418151146000146132fe576132fa916020820151906060604084015193015160001a90613308565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831161337e5791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156107825781516001600160a01b03811615613378579190565b50600190565b50505050600090600390565b6133966109f28261222d565b613450576133a2611027565b511561344757600f54801561340c576133d46133cf6133c76103ae93611b6795611d5f565b61270f900690565b611d51565b611b8a6133fb6133eb6133e5611027565b93613462565b6040519586946020860190611bfb565b64173539b7b760d91b815260050190565b505061342f6103ae61341c611027565b611b8a6040519384926020840190611bfb565b6b3232b330bab63a173539b7b760a11b8152600c0190565b506103ae611d6c565b60405163851b21c360e01b8152600490fd5b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000080821015613597575b506d04ee2d6d415b85acef810000000080831015613588575b50662386f26fc1000080831015613579575b506305f5e1008083101561356a575b506127108083101561355b575b50606482101561354b575b600a80921015613541575b6001908160216134f9828701611dab565b95860101905b61350b575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a83530491821561353c579190826134ff565b613504565b91600101916134e8565b91906064600291049101916134dd565b600491939204910191386134d2565b600891939204910191386134c5565b601091939204910191386134b6565b602091939204910191386134a4565b60409350810491503861348b565b908160209103126102ae575190565b908160209103126102ae57516103ae816114e8565b6103ae939260609260018060a01b0316825260208201528160408201520190610378565b600e5414801590613615575b61360d57805115611bf65760200151600f55565b506000600e55565b506001815114156135f9565b601f811161362d575050565b600090600c82527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7906020601f850160051c83019410613688575b601f0160051c01915b82811061367d57505050565b818155600101613671565b9092508290613668565b1561369957565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fdfea2646970667358221220174048d75d5314f3e0256b72cb4b6d14dcf17e76185d7ba8700a354ade5a7eda64736f6c634300081200332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d537472696e67733a20686578206c656e67746820696e73756666696369656e7400000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000ff530fdc6775f732322279e580d41cb96c569447000000000000000000000000bd5328f498f29b57616c9233d6da2494b9d4f4fa000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca0000000000000000000000005a861794b927983406fce1d062e00b9368d97df60000000000000000000000000000000000000000000000000000000000000021546865205761726c6f726473206f66204368616d70696f6e732054616374696373000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003574152000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013100000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436101561001257600080fd5b60003560e01c806301ffc9a71461029757806306fdde0314610292578063081812fc1461028d578063095ea7b31461028857806318160ddd14610283578063191f61d41461027e5780631a23a7eb146102795780631fe543e31461027457806323b872dd1461026f578063248a9ca31461026a5780632a55205a146102655780632f2ff15d1461026057806332cb6b0c1461025b57806336568abe1461025657806337ca8c031461025157806342842e0e1461024c57806355f804b3146102475780636352211e146102425780636c0360eb1461023d5780636c766e491461023857806370a0823114610233578063715018a61461022e57806372581802146102295780638462151c146102245780638ccc5f801461021f5780638da5cb5b1461021a57806391d148541461021557806394e673c71461021057806395d89b411461020b578063a217fddf14610206578063a22cb46514610201578063b88d4fde146101fc578063c6a361c9146101f7578063c87b56dd146101f2578063d5391393146101ed578063d547741f146101e8578063d691e43c146101e3578063da0239a6146101de578063e985e9c5146101d95763f2fde38b146101d457600080fd5b61196e565b611912565b6118f7565b6117ef565b6117ad565b611772565b611753565b611638565b6115e2565b6114f2565b6114cc565b611425565b6113c6565b61131e565b6112f5565b6112c4565b61120f565b6111b6565b611158565b611131565b611113565b6110e3565b610fbc565b610e6a565b610e42565b610e07565b610d71565b610d54565b610c87565b610be0565b610bb1565b610b88565b610ad1565b610901565b6105ee565b6105cb565b6104d5565b610494565b6103b1565b6102b3565b6001600160e01b03198116036102ae57565b600080fd5b346102ae5760203660031901126102ae5760206004356102d28161029c565b63ffffffff60e01b16637965db0b60e01b81149081156102f8575b506040519015158152f35b63152a902d60e11b811491508115610312575b50386102ed565b6380ac58cd60e01b811491508115610344575b8115610333575b503861030b565b6301ffc9a760e01b1490503861032c565b635b5e139f60e01b81149150610325565b60005b8381106103685750506000910152565b8181015183820152602001610358565b9060209161039181518092818552858086019101610355565b601f01601f1916010190565b9060206103ae928181520190610378565b90565b346102ae5760008060031936011261049157604051908060018054916103d683610fed565b80865292828116908115610467575060011461040d575b610409856103fd8187038261086f565b6040519182918261039d565b0390f35b92508083527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b82841061044f5750505081016020016103fd826104096103ed565b80546020858701810191909152909301928101610434565b869550610409969350602092506103fd94915060ff191682840152151560051b82010192936103ed565b80fd5b346102ae5760203660031901126102ae5760206104b260043561209c565b6040516001600160a01b039091168152f35b6001600160a01b038116036102ae57565b346102ae5760403660031901126102ae576004356104f2816104c4565b6024356104fe81611f09565b50916001600160a01b03808416908216811461057a576105319361052c913314908115610533575b5061202a565b612585565b005b6001600160a01b03166000908152600660205260409020610574915061056d9033905b9060018060a01b0316600052602052604060002090565b5460ff1690565b38610526565b60405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608490fd5b346102ae5760003660031901126102ae5760206105e6612ae0565b604051908152f35b346102ae576040806003193601126102ae5760043563ffffffff811681036102ae576024359161ffff831683036102ae57610627611ca5565b600e546107d75780516310c1b4d560e21b815263ffffffff831660048201526020936001600160a01b037f0000000000000000000000005a861794b927983406fce1d062e00b9368d97df681169291908683602481875afa8015610782576106f19688946000926107b4575b506106d3906106c5885195869288840160409061ffff600193959463ffffffff60608401971683521660208201520152565b03601f19810185528461086f565b60008651809881958294630200057560e51b845289600485016135c9565b03927f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca165af1918215610782576004938593610787575b505163fc2a88c360e01b815292839182905afa9081156107825761053192600092610755575b5050600e55565b6107749250803d1061077b575b61076c818361086f565b8101906135a5565b388061074e565b503d610762565b61266a565b6107a690843d86116107ad575b61079e818361086f565b8101906135b4565b5038610728565b503d610794565b6106d39192506107d090863d881161077b5761076c818361086f565b9190610693565b516325e9548560e21b8152600490fd5b634e487b7160e01b600052604160045260246000fd5b60c081019081106001600160401b0382111761081857604052565b6107e7565b604081019081106001600160401b0382111761081857604052565b602081019081106001600160401b0382111761081857604052565b61012081019081106001600160401b0382111761081857604052565b90601f801991011681019081106001600160401b0382111761081857604052565b6040519061089d8261081d565b565b6001600160401b03811161081857601f01601f191660200190565b81601f820112156102ae578035906108d18261089f565b926108df604051948561086f565b828452602083830101116102ae57816000926020809301838601378301015290565b346102ae57366003190160e081126102ae5760c0136102ae5760c4356001600160401b0381116102ae5761093a600491369083016108ba565b6109426130ce565b908115610aa9576024354210610a98576044354211610a87576064354603610a7657608435918215610a655760a4359161098961056d84600052600d602052604060002090565b610a54576109f26109b56109f6926109b06109ab6109a636611374565b6130e6565b612f6d565b61317b565b6001600160a01b031660009081527ff70e363b3d7895af770c4a138460777d52eebd3cb9962ccc6b58721f6127bbc8602052604090205460ff1690565b1590565b610a43576105319350808311610a39575b50610a1f610a2c91600052600d602052604060002090565b805460ff19166001179055565b610a34612dcb565b612dd7565b9150610a1f610a07565b604051638baa579f60e01b81528490fd5b604051631bbdf5c560e31b81528590fd5b60405163199f5a0360e31b81528490fd5b60405163e21c266f60e01b81528390fd5b604051636105d05f60e11b81528390fd5b6040516301546a7760e01b81528390fd5b60405163d05cb60960e01b81528390fd5b6001600160401b0381116108185760051b60200190565b346102ae5760403660031901126102ae576024356001600160401b0381116102ae57366023820112156102ae57806004013590610b0d82610aba565b90610b1b604051928361086f565b82825260209260248484019160051b830101913683116102ae57602401905b828210610b4d5761053184600435611a36565b81358152908401908401610b3a565b60609060031901126102ae57600435610b74816104c4565b90602435610b81816104c4565b9060443590565b346102ae57610531610b9936610b5c565b91610bac610ba78433612245565b612122565b61237c565b346102ae5760203660031901126102ae57600435600052600b6020526020600160406000200154604051908152f35b346102ae5760403660031901126102ae576004356000526009602052604060002060405190610c0e8261081d565b546001600160a01b03811680835260a09190911c602083015215610c79575b610c5d612710610c4c6001600160601b03602085015116602435611d39565b92519204916001600160a01b031690565b604080516001600160a01b039290921682526020820192909252f35b50610c82611cfd565b610c2d565b346102ae5760403660031901126102ae57600435602435610ca7816104c4565b600091808352600b602052610cc26001604085200154611aba565b808352600b602090815260408085206001600160a01b0385166000908152925290205460ff1615610cf1578280f35b808352600b602090815260408085206001600160a01b038516600090815292529020805460ff1916600117905533916001600160a01b0316907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a438808280f35b346102ae5760003660031901126102ae57602060405161270f8152f35b346102ae5760403660031901126102ae57602435610d8e816104c4565b336001600160a01b03821603610daa5761053190600435611c12565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b346102ae5760003660031901126102ae5760206040517f5671fbb49e96506fa1bf458ae595e6b5aa91747fa8fd744a8e7987e92b4e7eb18152f35b346102ae57610531610e5336610b5c565b9060405192610e6184610838565b6000845261218b565b346102ae576020806003193601126102ae576001600160401b036004358181116102ae57366023820112156102ae5780600401359182116102ae57602490368284830101116102ae57610ebb611ca5565b600c54610ec781610fed565b610faa5783610ed8610edd92610fed565b613621565b600093601f8411600114610f1e5750928293600093610f11575b505050600019600383901b1c191660019190911b17600c55005b0101359050388080610ef7565b91601f19841694610f51600c6000527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c790565b9381905b878210610f905750508460019610610f74575b50505050811b01600c55005b60001960f88660031b161c199201013516905538808080610f68565b806001849786839596890101358155019601920190610f55565b604051636f2c52f960e01b8152600490fd5b346102ae5760203660031901126102ae576020610fda600435611f09565b506040516001600160a01b039091168152f35b90600182811c9216801561101d575b602083101461100757565b634e487b7160e01b600052602260045260246000fd5b91607f1691610ffc565b60405190600082600c549161103b83610fed565b808352926001908181169081156110c15750600114611062575b5061089d9250038361086f565b600c600090815291507fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c75b8483106110a6575061089d935050810160200138611055565b81935090816020925483858a0101520191019091859261108d565b90506020925061089d94915060ff191682840152151560051b82010138611055565b346102ae5760003660031901126102ae576104096110ff611027565b604051918291602083526020830190610378565b346102ae5760003660031901126102ae576020600f54604051908152f35b346102ae5760203660031901126102ae5760206105e6600435611153816104c4565b612b06565b346102ae5760008060031936011261049157611172611ca5565b600a80546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346102ae5760003660031901126102ae576020600e54604051908152f35b6020908160408183019282815285518094520193019160005b8281106111fb575050505090565b8351855293810193928101926001016111ed565b346102ae5760203660031901126102ae5760043561122c816104c4565b600061123782612b06565b61124081610aba565b9161124e604051938461086f565b818352601f1961125d83610aba565b01366020850137600193845b83830361127e576040518061040987826111d4565b80611289879261222d565b611294575b01611269565b61129d81611f09565b506001600160a01b0384811691160361128e57806112be8386019588612af2565b5261128e565b346102ae5760203660031901126102ae57600435600052600d602052602060ff604060002054166040519015158152f35b346102ae5760003660031901126102ae57600a546040516001600160a01b039091168152602090f35b346102ae5760403660031901126102ae57602060ff611368602435611342816104c4565b600435600052600b845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b60c09060031901126102ae576040519061138d826107fd565b8160043561139a816104c4565b8152602435602082015260443560408201526064356060820152608435608082015260a060a435910152565b346102ae5760c03660031901126102ae5760206105e66109ab6040516113eb816107fd565b6004356113f7816104c4565b81526024358482015260443560408201526064356060820152608435608082015260a43560a08201526130e6565b346102ae5760008060031936011261049157604051908060025461144881610fed565b80855291600191808316908115610467575060011461147157610409856103fd8187038261086f565b9250600283527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b8284106114b45750505081016020016103fd826104096103ed565b80546020858701810191909152909301928101611499565b346102ae5760003660031901126102ae57602060405160008152f35b801515036102ae57565b346102ae5760403660031901126102ae5760043561150f816104c4565b60243561151b816114e8565b6001600160a01b0382169133831461159d578161155a61156b9233600052600660205260406000209060018060a01b0316600052602052604060002090565b9060ff801983541691151516179055565b604051901515815233907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190602090a3005b60405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606490fd5b346102ae5760803660031901126102ae576004356115ff816104c4565b60243561160b816104c4565b606435916001600160401b0383116102ae5761162e6105319336906004016108ba565b916044359161218b565b346102ae576020806003193601126102ae57600435611656816104c4565b61165e611ca5565b6040516370a0823160e01b81523060048201526001600160a01b037f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca1691908381602481865afa90811561078257600091611736575b5080156117245760405163a9059cbb60e01b81526001600160a01b039290921660048301526024820152908290829060449082906000905af19081156107825761053192600092611707575b5050612ad9565b61171d9250803d106107ad5761079e818361086f565b3880611700565b6040516322da1a0760e21b8152600490fd5b61174d9150843d861161077b5761076c818361086f565b386116b4565b346102ae5760203660031901126102ae576104096110ff60043561338a565b346102ae5760003660031901126102ae5760206040517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68152f35b346102ae5760403660031901126102ae576105316024356004356117d0826104c4565b80600052600b6020526117ea600160406000200154611aba565b611c12565b346102ae5760403660031901126102ae5760043561180c816104c4565b602435906001600160601b0382168083036102ae576127109061182d611ca5565b1161189f57610531916118789061184e6001600160a01b0384161515613692565b611868611859610890565b6001600160a01b039094168452565b6001600160601b03166020830152565b805160209091015160a01b6001600160a01b0319166001600160a01b039190911617600855565b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608490fd5b346102ae5760003660031901126102ae5760206105e66130ce565b346102ae5760403660031901126102ae57602060ff611368600435611936816104c4565b60243590611943826104c4565b60018060a01b03166000526006845260406000209060018060a01b0316600052602052604060002090565b346102ae5760203660031901126102ae5760043561198b816104c4565b611993611ca5565b6001600160a01b039081169081156119e257600a54826001600160601b0360a01b821617600a55167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b907f0000000000000000000000005a861794b927983406fce1d062e00b9368d97df66001600160a01b03163303611a705761089d916135ed565b60405162461bcd60e51b815260206004820152601f60248201527f6f6e6c792056524620563220777261707065722063616e2066756c66696c6c006044820152606490fd5b541690565b6000818152600b6020908152604080832033845290915290205460ff1615611adf5750565b3390611ae9611d7f565b916030611af584611df3565b536078611b0184611e00565b5360295b60018111611bb457611bb0611b6d611b9886611b8a611b2d88611b288915611e2e565b611e79565b611b67604051958694611b67602087016017907f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081520190565b90611bfb565b7001034b99036b4b9b9b4b733903937b6329607d1b815260110190565b03601f19810183528261086f565b60405162461bcd60e51b81529182916004830161039d565b0390fd5b90600f8116906010821015611bf657611bf1916f181899199a1a9b1b9c1cb0b131b232b360811b901a611be78487611e10565b5360041c91611e21565b611b05565b611ddd565b90611c0e60209282815194859201610355565b0190565b600090808252600b60205260ff611c3e84604085209060018060a01b0316600052602052604060002090565b5416611c4957505050565b808252600b602090815260408084206001600160a01b038616600090815292529020805460ff1916905533926001600160a01b0316917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9080a4565b600a546001600160a01b03163303611cb957565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60405190611d0a8261081d565b6008546001600160a01b038116835260a01c6020830152565b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715611d4c57565b611d23565b9060018201809211611d4c57565b91908201809211611d4c57565b60405190611d7982610838565b60008252565b60405190606082018281106001600160401b0382111761081857604052602a8252604082602036910137565b90611db58261089f565b611dc2604051918261086f565b8281528092611dd3601f199161089f565b0190602036910137565b634e487b7160e01b600052603260045260246000fd5b805115611bf65760200190565b805160011015611bf65760210190565b908151811015611bf6570160200190565b8015611d4c576000190190565b15611e3557565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b60405190608082018281106001600160401b03821117610818576040526042825260603660208401376030611ead83611df3565b536078611eb983611e00565b536041905b60018211611ed1576103ae915015611e2e565b600f8116906010821015611bf657611f03916f181899199a1a9b1b9c1cb0b131b232b360811b901a611be78486611e10565b90611ebe565b611f128161222d565b15611fd057600090600891604060ff83851c9316918381528060205220548160ff181c801515600014611f7e57611f4b611f5191612946565b60ff1690565b9003911b175b611f7b611f6e826000526003602052604060002090565b546001600160a01b031690565b91565b50505b611f8c8115156128dd565b60001901611fa4816000526000602052604060002090565b5480611fb05750611f81565b611f4b611fbf611fc892612946565b60ff9081031690565b911b17611f57565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608490fd5b1561203157565b60405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608490fd5b6120a58161222d565b156120c5576000908152600560205260409020546001600160a01b031690565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b1561212957565b60405162461bcd60e51b815260206004820152603460248201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6044820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b6064820152608490fd5b9161089d93916121b2936121a2610ba78433612245565b6121ad83838361237c565b6126a6565b61220d565b60809060208152603560208201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b60608201520190565b1561221457565b60405162461bcd60e51b815280611bb0600482016121b7565b6004548110908161223c575090565b90506001111590565b61224e8261222d565b156122c35761225c82611f09565b506001600160a01b0382811682821681149490919085156122ab575b505050821561228657505090565b6001600160a01b0316600090815260066020526040902060ff9250611ab59190610556565b6122b8919293955061209c565b161491388080612278565b60405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b1561232757565b60405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608490fd5b61238583611f09565b6001600160a01b0394918386169086168190036124d65761089d958516916123ae831515612320565b6123b784612530565b6123c084611d51565b6123e86109f2828060081c600052600060205260ff6001811b91161c60406000205416151590565b806124cb575b612487575b5061242b8661240c866000526003602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b830361245c575b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4612bbd565b612482838060081c600052600060205260406000209060ff6001811b91161c8154179055565b612432565b806124a38761240c6124c5946000526003602052604060002090565b8060081c600052600060205260406000209060ff6001811b91161c8154179055565b386123f3565b5060045481106123ee565b60405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608490fd5b600081815260056020526040812080546001600160a01b031916905561255582611f09565b506001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258280a4565b600082815260056020526040902080546001600160a01b0319166001600160a01b0383161790556125b582611f09565b506001600160a01b0391821691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a4565b6000198114611d4c5760010190565b908160209103126102ae57516103ae8161029c565b6103ae939260809260018060a01b031682526000602083015260408201528160608201520190610378565b6001600160a01b0391821681529116602082015260408101919091526080606082018190526103ae92910190610378565b6040513d6000823e3d90fd5b3d156126a1573d906126878261089f565b91612695604051938461086f565b82523d6000602084013e565b606090565b9192813b156127d65790929160019081948285935b6126c9575b50505050505090565b6126d68697989596611d51565b8410156127cd57604095865197630a85bd0160e11b998a8a5260209a8b60049b808d878c8c339385019361270994612639565b6000929184918391900381856001600160a01b038e165af191928261279e575b505061275f578c8c8c61273a612676565b8051938461275957825162461bcd60e51b815280611bb08187016121b7565b84925001fd5b91939699509194979a5061277e939699508261278a575b5050966125ea565b928095929491956126bb565b6001600160e01b0319161490503880612776565b6127be929350803d106127c6575b6127b6818361086f565b8101906125f9565b90388e612729565b503d6127ac565b849796506126c0565b50505050600190565b9293909290813b156128d357600184935b6127fa8187611d5f565b8510156128ca57604051630a85bd0160e11b81528061281e8988336004850161260e565b6000916020918491900381846001600160a01b038b165af19091816128a9575b506128715761284b612676565b8051908161286c5760405162461bcd60e51b815280611bb0600482016121b7565b602001fd5b6127fa92612886918161288e575b50956125ea565b9491506127f0565b6001600160e01b031916630a85bd0160e11b1490503861287f565b6128c391925060203d6020116127c6576127b6818361086f565b903861283e565b50945092505050565b9350505050600190565b156128e457565b60405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608490fd5b60405161295281610853565b7ffd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f86101008083527e01020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7560208401527f06264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c960408401527f071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee360608401527f0e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf760808401527fff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c860a08401527f16365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f660c08401527ffe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf560e084015282015281156102ae57612ac5612ad3917e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff846103ae95600003160260f81c90611e10565b516001600160f81b03191690565b60f81c90565b156102ae57565b6004546000198101908111611d4c5790565b8051821015611bf65760209160051b010190565b6001600160a01b03168015612b2f5760005260076020526001600160401b036040600020541690565b60405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608490fd5b9060016001600160401b0380931601918211611d4c57565b9190916001600160401b0380809416911601918211611d4c57565b6001600160a01b0381811615612cc9576001600160a01b03821660009081526007602052604090206001600160401b036000198183541601908111611d4c57815467ffffffffffffffff19166001600160401b039091161790555b821615612c6e57506001600160a01b0316600090815260076020526040902061089d90612c54612c4f82546001600160401b031690565b612b8a565b6001600160401b03166001600160401b0319825416179055565b6001600160a01b0316600090815260076020526040902061089d91508054612ca19060801c6001600160401b0316612b8a565b815467ffffffffffffffff60801b191660809190911b67ffffffffffffffff60801b16179055565b6001600160a01b0383166000908152600760205260409020612d2290612cfb6001600160401b03825460401c16612b8a565b67ffffffffffffffff60401b82549160401b169067ffffffffffffffff60401b1916179055565b612c18565b90680100000000000000008110156102ae576001600160a01b03821660009081526007602052604090206001600160401b039182169290612d7290612cfb8585835460401c16612ba2565b6001600160a01b03811615612da9576001600160a01b0316600090815260076020526040902061089d92612c549192835416612ba2565b50612ca161089d92600080526007602052604060002092835460801c16612ba2565b6004356103ae816104c4565b909160405190612de682610838565b600091828152600454948015612ec2576001600160a01b03851695612e0c871515612f15565b612e1e612e198383611d5f565b600455565b612e368661240c836000526003602052604060002090565b612e5c818060081c600052600060205260406000209060ff6001811b91161c8154179055565b612e668287612d27565b805b612e728383611d5f565b811015612eae5780612ea99189887fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a46125ea565b612e68565b5090919295506121b2935061089d946127df565b60405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608490fd5b15612f1c57565b60405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b612f75612fb4565b9060405190602082019261190160f01b84526022830152604282015260428152608081018181106001600160401b038211176108185760405251902090565b307f000000000000000000000000e841e6e68becfc54b621a23a41f8c1a829a4cf446001600160a01b031614806130a5575b1561300f577fc013bdc0a0ddcd6bd0b9db0bb856654908dc29456c3cf6eb845a1661f2b4b59390565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527fc5662812e4040935c60149876e2f1cb8d28464d11e76ce42ca0143a9f0114de860408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a0815261309f816107fd565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000014614612fe6565b6130d6612ae0565b61270f908103908111611d4c5790565b60018060a01b0381511690602081015190604081015190606081015160a06080830151920151926040519460208601967f5671fbb49e96506fa1bf458ae595e6b5aa91747fa8fd744a8e7987e92b4e7eb1885260408701526060860152608085015260a084015260c083015260e082015260e0815261010081018181106001600160401b038211176108185760405251902090565b6103ae91613188916132d0565b9190916131b0565b6005111561319a57565b634e487b7160e01b600052602160045260246000fd5b6131b981613190565b806131c15750565b6131ca81613190565b600181036132175760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b61322081613190565b6002810361326d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b80613279600392613190565b1461328057565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b9060418151146000146132fe576132fa916020820151906060604084015193015160001a90613308565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831161337e5791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156107825781516001600160a01b03811615613378579190565b50600190565b50505050600090600390565b6133966109f28261222d565b613450576133a2611027565b511561344757600f54801561340c576133d46133cf6133c76103ae93611b6795611d5f565b61270f900690565b611d51565b611b8a6133fb6133eb6133e5611027565b93613462565b6040519586946020860190611bfb565b64173539b7b760d91b815260050190565b505061342f6103ae61341c611027565b611b8a6040519384926020840190611bfb565b6b3232b330bab63a173539b7b760a11b8152600c0190565b506103ae611d6c565b60405163851b21c360e01b8152600490fd5b806000917a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000080821015613597575b506d04ee2d6d415b85acef810000000080831015613588575b50662386f26fc1000080831015613579575b506305f5e1008083101561356a575b506127108083101561355b575b50606482101561354b575b600a80921015613541575b6001908160216134f9828701611dab565b95860101905b61350b575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a83530491821561353c579190826134ff565b613504565b91600101916134e8565b91906064600291049101916134dd565b600491939204910191386134d2565b600891939204910191386134c5565b601091939204910191386134b6565b602091939204910191386134a4565b60409350810491503861348b565b908160209103126102ae575190565b908160209103126102ae57516103ae816114e8565b6103ae939260609260018060a01b0316825260208201528160408201520190610378565b600e5414801590613615575b61360d57805115611bf65760200151600f55565b506000600e55565b506001815114156135f9565b601f811161362d575050565b600090600c82527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7906020601f850160051c83019410613688575b601f0160051c01915b82811061367d57505050565b818155600101613671565b9092508290613668565b1561369957565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fdfea2646970667358221220174048d75d5314f3e0256b72cb4b6d14dcf17e76185d7ba8700a354ade5a7eda64736f6c63430008120033

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

00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000ff530fdc6775f732322279e580d41cb96c569447000000000000000000000000bd5328f498f29b57616c9233d6da2494b9d4f4fa000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca0000000000000000000000005a861794b927983406fce1d062e00b9368d97df60000000000000000000000000000000000000000000000000000000000000021546865205761726c6f726473206f66204368616d70696f6e732054616374696373000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003574152000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013100000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): The Warlords of Champions Tactics
Arg [1] : _symbol (string): WAR
Arg [2] : _version (string): 1
Arg [3] : _minter (address): 0xfF530Fdc6775F732322279E580d41cb96C569447
Arg [4] : _vault (address): 0xBd5328f498F29B57616C9233d6Da2494B9D4F4FA
Arg [5] : _link (address): 0x514910771AF9Ca656af840dff83E8264EcF986CA
Arg [6] : _vrfV2Wrapper (address): 0x5A861794B927983406fCE1D062e00b9368d97Df6

-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [3] : 000000000000000000000000ff530fdc6775f732322279e580d41cb96c569447
Arg [4] : 000000000000000000000000bd5328f498f29b57616c9233d6da2494b9d4f4fa
Arg [5] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Arg [6] : 0000000000000000000000005a861794b927983406fce1d062e00b9368d97df6
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000021
Arg [8] : 546865205761726c6f726473206f66204368616d70696f6e7320546163746963
Arg [9] : 7300000000000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [11] : 5741520000000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [13] : 3100000000000000000000000000000000000000000000000000000000000000


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

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