POL Price: $0.126672 (-4.03%)
 

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Claim Tokens259447342022-03-14 20:12:431411 days ago1647288763IN
0x3eA68344...D7Fc23C20
0 POL0.0109653832.59200001
Claim Tokens259447302022-03-14 20:12:271411 days ago1647288747IN
0x3eA68344...D7Fc23C20
0 POL0.0068872531.61424
Claim Tokens259447152022-03-14 20:11:271411 days ago1647288687IN
0x3eA68344...D7Fc23C20
0 POL0.0085398339.20000002
Claim Tokens259446522022-03-14 20:08:531411 days ago1647288533IN
0x3eA68344...D7Fc23C20
0 POL0.0070566732.39192951
Claim Tokens259445982022-03-14 20:07:011411 days ago1647288421IN
0x3eA68344...D7Fc23C20
0 POL0.1089265500.00000001
Claim Tokens259445962022-03-14 20:06:571411 days ago1647288417IN
0x3eA68344...D7Fc23C20
0 POL0.0071048230.60406327
Claim Tokens259445622022-03-14 20:05:451411 days ago1647288345IN
0x3eA68344...D7Fc23C20
0 POL0.0067751331.09955762
Claim Tokens259445532022-03-14 20:05:271411 days ago1647288327IN
0x3eA68344...D7Fc23C20
0 POL0.1686575500.00000002
Claim Tokens259445252022-03-14 20:04:311411 days ago1647288271IN
0x3eA68344...D7Fc23C20
0 POL0.1686575500.00000005
Claim Tokens259445062022-03-14 20:03:391411 days ago1647288219IN
0x3eA68344...D7Fc23C20
0 POL0.0115210532.83970113
Claim Tokens259445022022-03-14 20:03:231411 days ago1647288203IN
0x3eA68344...D7Fc23C20
0 POL0.1735075500.0000001
Claim Tokens259445002022-03-14 20:03:151411 days ago1647288195IN
0x3eA68344...D7Fc23C20
0 POL0.0099944730.04817209
Claim Tokens259444882022-03-14 20:02:271411 days ago1647288147IN
0x3eA68344...D7Fc23C20
0 POL0.1758075500.00000009
Claim Tokens259444842022-03-14 20:02:111411 days ago1647288131IN
0x3eA68344...D7Fc23C20
0 POL0.0106802830.7776018
Claim Tokens259444742022-03-14 20:01:311411 days ago1647288091IN
0x3eA68344...D7Fc23C20
0 POL0.0077239633.27099999
Claim Tokens259444632022-03-14 20:00:471411 days ago1647288047IN
0x3eA68344...D7Fc23C20
0 POL0.0127471935.28000001
Claim Tokens259442922022-03-14 19:52:131411 days ago1647287533IN
0x3eA68344...D7Fc23C20
0 POL0.0072322931.15315298
Claim Tokens259442772022-03-14 19:51:431411 days ago1647287503IN
0x3eA68344...D7Fc23C20
0 POL0.0074559732.11665256
Claim Tokens259442672022-03-14 19:51:231411 days ago1647287483IN
0x3eA68344...D7Fc23C20
0 POL0.0113885433.7506338
Claim Tokens259442382022-03-14 19:50:211411 days ago1647287421IN
0x3eA68344...D7Fc23C20
0 POL0.0166636648.02
Claim Tokens259442112022-03-14 19:49:271411 days ago1647287367IN
0x3eA68344...D7Fc23C20
0 POL0.0105782231.350788
Claim Tokens259441882022-03-14 19:48:371411 days ago1647287317IN
0x3eA68344...D7Fc23C20
0 POL0.0110629831.88043189
Claim Tokens259441472022-03-14 19:47:151411 days ago1647287235IN
0x3eA68344...D7Fc23C20
0 POL0.171116500.00000001
Claim Tokens259441382022-03-14 19:46:571411 days ago1647287217IN
0x3eA68344...D7Fc23C20
0 POL0.0117811533.94999999
Claim Tokens259441192022-03-14 19:46:151411 days ago1647287175IN
0x3eA68344...D7Fc23C20
0 POL0.1735075500.00000001
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BackToSchool_ByCourtyard

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

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

pragma solidity ^0.8.0;

import "../TokenDropBase.sol";

/**
 * @title NFT Drop "Back To School", by Courtyard, on Polygon Mainnet.
 */ 
contract BackToSchool_ByCourtyard is TokenDropBase {

    /// @dev Polygon Mainnet constructor.
    /// See {https://docs.chain.link/docs/vrf-contracts/v1/#polygon-matic-mainnet} for VRF parameters. 
    constructor() TokenDropBase(
        "Back To School | by Courtyard",
        2,                                                                  // Max 2 tokens per transaction
        10,                                                                 // Max 10 tokens per address
        0.2 * 10 ** 18,                                                     // 0.2 ETH on Polygon (subject to be updated before the drop)
        0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619,                         // ETH on Polygon Mainnet
        0x732134D7f99b90C704d736B360dB45425073380f,                         // Courtyard Engineering Multisig on Polygon Mainnet
        0x581425C638882bd8169dAe6F2995878927C9fE70,                         // Courtyard Registry deployed on Polygon Mainnet
        0x3d2341ADb2D31f1c5530cDC622016af293177AE0,                         // VRFCoordinator on Polygon Mainnet
        0xb0897686c545045aFc77CF20eC7A532E3120E0F1,                         // LINK Token on Polygon Mainnet
        0xf86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da, // Chainlink keyHash on Polygon Mainnet
        0.0001 * 10 ** 18                                                   // 0.0001 LINK
    ) {}

}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/ERC20PaymentProcessor.sol";
import "./PresaleList.sol";
import "./TokenMintingPool.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";


/**
 * @title Base contract to handle an NFT drop.
 */ 
abstract contract TokenDropBase is Context, ReentrancyGuard, Ownable, ERC20PaymentProcessor, PresaleList, TokenMintingPool {

    string public name;                             // the name of this drop
    uint256 public maxPerTx;                        // maximum of tokens that can be minted per transaction
    uint256 public maxPerAddress;                   // maximum of tokens that can be minted by a specific address.
    uint256 public mintPrice;                       // mint price per token, in the selected ERC20.
    mapping(address => uint256) _mintsPerAddress;   // keeps track of how many tokens were minted per address.
    mapping(address => bool) _presaleMinters;       // keeps track of the addresses that already minted the presale.
                                                    // Same conditions apply to the presale as public sale, except only 
                                                    // one transaction is allowed.
    bool private _presaleIsOpen = false;            // flag used to control the presale opening
    bool private _publicSaleIsOpen = false;         // flag used to control the public sale opening

    /* ========================================== CONSTRUCTOR AND HELPERS ========================================== */

    /**
     * @dev Constructor.
     *  - Sets the name of the drop
     *  - Sets the mint limitations
     *  - Sets the mint price
     *  - Sets the {ERC20PaymentProcessor} parameters
     *  - Sets the {TokenMintingPool} parameters
     */
    constructor(
        string memory dropName,
        uint256 _maxPerTx,
        uint256 _maxPerAddress,
        uint256 mintPriceERC20,
        address erc20TokenAddress,
        address paymentReceiverAddress,
        address tokenRegistryAddress,
        address vrfCoordinator,
        address linkToken,
        bytes32 vrfKeyHash,
        uint256 vrfLinkFee
    )
    Ownable()
    ERC20PaymentProcessor(erc20TokenAddress, paymentReceiverAddress)
    PresaleList()
    TokenMintingPool(
        tokenRegistryAddress,
        vrfCoordinator,
        linkToken,
        vrfKeyHash,
        vrfLinkFee
    ) {
        name = dropName;
        maxPerTx = _maxPerTx;
        maxPerAddress = _maxPerAddress;
        mintPrice = mintPriceERC20;
    }


    /**
     * @dev Updates the mint price.
     * Requirement: the drop hasn't started (i.e. the contract is not in presale or in public sale).
     */
    function updateMintPrice(uint256 _mintPrice) public onlyOwner {
        require(!(_presaleIsOpen || _publicSaleIsOpen) , "TokenDropBase: The drop already started - cannot update the mint price.");
        mintPrice = _mintPrice;
    }


    /* ============================================ TOKEN SUPPLY HELPERS ============================================ */

    /**
     * @dev See {TokenMintingPool._addTokens}.
     */
    function addTokens(bytes32[] memory tokenHashes) public onlyOwner {
        _addTokens(tokenHashes);
    }

    /**
     * @dev See {TokenMintingPool._removeTokens}.
     */
    function removeTokens(bytes32[] memory tokenHashes) public onlyOwner {
        _removeTokens(tokenHashes);
    }

    /**
     * @dev See {TokenMintingPool._lockTokenSupply}.
     */
    function lockTokenSupply() public onlyOwner {
        _lockTokenSupply();
    }


    /* =========================================== PRESALE LIST HELPERS =========================================== */

    /**
     * @dev See {PresaleList._addAddressesToPresale}.
     */
    function addAddressesToPresale(bytes32[] memory addressHashes) public onlyOwner {
        _addAddressesToPresale(addressHashes);
    }

    /**
     * @dev See {PresaleList._removeAddressesFromPresale}.
     */
    function removeAddressesFromPresale(bytes32[] memory addressHashes) public onlyOwner {
        _removeAddressesFromPresale(addressHashes);
    }

    /**
     * @dev allows users to check if they have presale access at their own discretion.
     */ 
    function selfCheckPresaleAccess() public view returns (bool) {
        return _hasPresaleAccess(_msgSender());
    }

    /**
     * @dev allows users to check if they can mint the presale at their own discretion.
     * note: like {selfCheckPresaleAccess}, this will always return false for an non presale address,
     * but it will also return false if a presale address already used their presale access to claim tokens.
     */
    function selfCheckPresaleEligibility() public view returns (bool) {
        address caller = _msgSender();
        return _hasPresaleAccess(caller) && !_presaleMinters[caller];
    }


    /* ========================================= PRESALE AND SALE HELPERS ========================================= */

    /**
     * @dev Check that the presale is open. Note that opening the public sale does not close the presale access.
     */
    modifier onlyPresale {
        require(_presaleIsOpen, "TokenDropBase: The presale is closed.");
        _ ;
    }

    /**
     * @dev Check that the public sale is open.
     */
    modifier onlyPublicSale {
        require(_publicSaleIsOpen, "TokenDropBase: The public sale is closed.");
        _ ;
    }

    /**
     * @dev Opens the presale. This cannot be undone.
     */
    function openPresale() public onlyOwner {
        require(tokenSupplyLocked(), "TokenDropBase: The token supply needs to be locked.");
        _lockPresaleList();
        _presaleIsOpen = true;
    }

    /**
     * @dev Opens the public sale. This cannot be undone.
     * Requirements:
     *  - presale is already open
     */
    function openPublicSale() public onlyOwner onlyPresale {
        _publicSaleIsOpen = true;
    }

    /**
     * @dev Get the sale status of the drop.
     */
    function saleStatus() public view returns (string memory) {
        bool tokenSupplyIsEmpty = remainingSupplyCount() <= 0;
        return _presaleIsOpen ? (_publicSaleIsOpen ? (tokenSupplyIsEmpty ? "SOLD_OUT" : "PUBLIC_SALE") : (tokenSupplyIsEmpty ? "SOLD_OUT" : "PRESALE" )) : "CLOSED";
    }

    /**
     * @dev allows users to check how many tokens they minted already at their own discretion.
     */
    function selfCheckTokensMinted() public view returns (uint256) {
        return _mintsPerAddress[_msgSender()];
    }


    /* ================================================== MINTING ================================================== */


    /**
      * @dev Calculate the number of mintable tokens given the following parameters:
      *  - the requested amount of tokens
      *  - {maxPerTx}
      *  - {maxPerAddress}
      *  - the remaining supply.
      * 
      * Notes:
      *  - the actual number of tokens that the caller can mint during this transaction may be less than 
      *    the requested amount when getting close to {maxPerAddress} or when {remainingSupply} is close to 0
      */
     function _mintableAmountForAddress(address minter, uint256 requestedAmount, uint256 remainingSupply) private view returns (uint256) {
        uint256 mintableAmount = requestedAmount;
        mintableAmount = Math.min(mintableAmount, maxPerAddress - _mintsPerAddress[minter]);
        mintableAmount = Math.min(mintableAmount, remainingSupply);
        return mintableAmount;
     }

    /**
     * @dev Helper to process a mint request.
     * 
     * Requirements:
     *  - the requested amount must be > 0
     *  - the remaining supply must be > 0
     *  - the caller must not have reached {maxPerAddress}
     *  - {amount} must be less or equal to {maxPerTx}
     * 
     * Notes:
     *  - Ensures that the address is eligible to mint tokens.
     *  - Calls {_mintableAmountForAddress} to calculate the actual number of tokens that can be minted by that 
     *    address, if differs from the requested amount.
     *  - Processes payment for the tokens through a call to transfer ERC20 tokens from the minter to this contract.
     *    If this fails for any reason (including insufficient funds or lack of authorization) the contract call will be reverted.
     *  - Mints the tokens to the minter.
     */
    function _processMintRequest(address minter, uint256 requestedAmount) private {
        uint256 remainingSupply = remainingSupplyCount();
        require(requestedAmount > 0, "TokenDropBase: Invalid request for zero tokens.");
        require(remainingSupply > 0, "TokenDropBase: No more tokens left.");
        require(_mintsPerAddress[minter] < maxPerAddress, "TokenDropBase: Token limit per wallet already reached.");
        require(requestedAmount <= maxPerTx, "TokenDropBase: Token limit per transaction exceeded.");

        uint256 mintableAmount = _mintableAmountForAddress(minter, requestedAmount, remainingSupply);
        _mintsPerAddress[minter] += mintableAmount;
        _processPayment(minter, mintableAmount * mintPrice);
        _mintTokens(minter, mintableAmount);
    }

    /**
     * @dev Claim tokens.
     * 
     * Requirements:
     *  - if the public sale is not open:
     *      - the presale must be open
     *      - sender must be allowed to access the presale
     *      - sender hasn't used their presale access yet
     *  - see {_processMintRequest}
     */
    function claimTokens(uint256 amount) external nonReentrant {
        address caller = _msgSender();
        if (!_publicSaleIsOpen) {
            require(_presaleIsOpen, "TokenDropBase: The presale is not open yet.");
            require(_hasPresaleAccess(caller), "TokenDropBase: The public sale is not open yet and caller does not have presale address.");
            require(!_presaleMinters[caller], "TokenDropBase: The public sale is not open yet and caller already minted during the presale.");
            _presaleMinters[caller] = true;
        }
        _processMintRequest(caller, amount);
    }

    /* ========================================== PAYMENT RECEIVER UPDATE ========================================== */

    /**
     * @dev Updates payment receiver address.
     * Requirement: See {ERC20PaymentProcessor._setPaymentReceiverAddress}
     */
    function updatePaymentReceiverAddress(address newReceiver) public onlyOwner {
        _setPaymentReceiverAddress(newReceiver);
    }

}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/**
 * @title processes payments in ERC20 and redirects them to a receiver address.
 */ 
abstract contract ERC20PaymentProcessor {

    using SafeERC20 for IERC20;

    event PaymentProcessed(address indexed to, address indexed token, uint256 amount);

    event PaymentReceiverAddressChanged(address indexed oldAddress, address indexed newAddress);

    IERC20 public immutable erc20Token; // the ERC20 token accepted as funds by this contract.
    address private _receiverAddress;	// the address that will be transferred the payments.

    constructor(address tokenAddress, address receiverAddress) {
        erc20Token = IERC20(tokenAddress);
        _setPaymentReceiverAddress(receiverAddress);
    }

    /**
     * @dev return the current payment receiver address.
     */
    function paymentReceiverAddress() public view returns (address) {
        return _receiverAddress;
    }

    /* ================================================= SETTERS ================================================= */

    /**
     * @dev Set the payment receiver address.
     * Requirement: the receiver address cannot be the null address
     */
    function _setPaymentReceiverAddress(address newAddress) internal {
        require(newAddress != address(0), "ERC20PaymentProcessor: Cannot set the receiver address to the null address.");
        address oldAddress = _receiverAddress;
        _receiverAddress = newAddress;
        emit PaymentReceiverAddressChanged(oldAddress, _receiverAddress);
    }

    /* ============================================ PAYMENT PROCESSING ============================================ */

    function _processPayment(address from, uint256 amount) internal {
        erc20Token.safeTransferFrom(from, _receiverAddress, amount);
        emit PaymentProcessed(_receiverAddress, address(erc20Token), amount);
    }

}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/**
 * @title Presale List contract.
 */ 
abstract contract PresaleList {

    using EnumerableSet for EnumerableSet.Bytes32Set;

    EnumerableSet.Bytes32Set private _presaleList;  // The hashes of the addresses allowed for the presale
    bool private _presaleListLocked = false;        // whether or not the presale list is locked

    constructor() {}

    /**
     * @dev Adds multiple addresses to the presale list.
     * Note: In order to help protect privacy ahead of using the list for a drop or other event,
     * (even though everything is public on the blockchain), we only store the hashes of addresses.
     * Note: if the input is too big, the transaction will fail due to high gas limit.
     */
    function _addAddressesToPresale(bytes32[] memory addressHashes) internal {
        require(!_presaleListLocked, "PresaleList: Presale list is locked. Cannot add new addresses.");
        for (uint ii = 0 ; ii < addressHashes.length ; ii++) {
            _presaleList.add(addressHashes[ii]);
        }
    }

    /**
     * @dev Removes multiple addresses from the presale list.
     * Note: if the input is too big, the transaction will fail due to high gas limit.
     */
    function _removeAddressesFromPresale(bytes32[] memory addressHashes) internal {
        require(!_presaleListLocked, "PresaleList: Presale list is locked. Cannot remove addresses.");
        for (uint ii = 0 ; ii < addressHashes.length ; ii++) {
            _presaleList.remove(addressHashes[ii]);
        }
    }

    /**
     * @dev Locks the presale list.
     */
    function _lockPresaleList() internal {
        _presaleListLocked = true;
    }

    /**
     * @dev Tells if the presale is locked.
     */
    function presaleListLocked() public view returns (bool) {
        return _presaleListLocked;
    }

    /**
     * @dev Give the number of addresses in the presale list.
     */
    function presaleListCount() public view returns (uint256) {
        return _presaleList.length();
    }

    /**
     * @dev Tells whether or not {addr} is in the presale list.
     */
    function _hasPresaleAccess(address addr) internal view returns (bool) {
        return _presaleList.contains(keccak256(abi.encodePacked(addr)));
    }

}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../registry/ITokenRegistry.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/**
 * @title Token minting pool contract.
 */ 
abstract contract TokenMintingPool is VRFConsumerBase {

    using EnumerableSet for EnumerableSet.Bytes32Set;

    bytes32 private _vrfKeyHash;                                // The key hash to run Chainlink VRF

    uint256 private _vrfLinkFee;                                // Fee to call Chainlink {requestRandomness}, in LINK. 

    ITokenRegistry public immutable tokenRegistry;              // Reference to the registry where tokens will be minted.

    EnumerableSet.Bytes32Set private _availableTokenHashes;     // The available token hashes that haven't been minted yet.

    uint256 private _randomSeed;                                // A random seed number provided by Chainlink, ensuring that 
                                                                // even though the mint is 1st come / 1st serve, the order in 
                                                                // which token hashes were uploaded does not matter.
                                                                // (_randomSeed != 0) serves as a check to verify that the 
                                                                // supply is locked.

    /* ========================================== CONSTRUCTOR AND HELPERS ========================================== */

    /**
     * @dev modifier to check that the token registry implements {ITokenRegistry}, like {CourtyardRegistry}.
     */
    modifier onlyValidRegistry(address tokenRegistryAddress) {
        require(
            ERC165Checker.supportsInterface(tokenRegistryAddress, type(ITokenRegistry).interfaceId),
            "TokenMintingPool: Target token registry contract does not match the interface requirements."
        );
        _;
    }

    /**
     * @dev Constructor.
     *
     *  - Sets the parameters to use Chainlink VRF for token hashes shuffling pre-mint.
     *  - Sets the token registry
     * 
     * Requirement: {tokenRegistryAddress} must point to a valid {ITokenRegistry} contract.
     *  
     */
    constructor(
        address tokenRegistryAddress,
        address vrfCoordinator,
        address linkToken,
        bytes32 vrfKeyHash,
        uint256 vrfLinkFee
    )
    onlyValidRegistry(tokenRegistryAddress)
    VRFConsumerBase(vrfCoordinator, linkToken) {
        tokenRegistry = ITokenRegistry(tokenRegistryAddress);
        _vrfKeyHash = vrfKeyHash;
        _vrfLinkFee = vrfLinkFee;
    }


    /* ============================================ TOKEN SUPPLY HELPERS ============================================ */

    /**
     * @dev add multiple token hashes to the supply.
     * Note: if the input is too big, the transaction will fail due to high gas limit.
     */
    function _addTokens(bytes32[] memory tokenHashes) internal {
        require(!tokenSupplyLocked(), "TokenMintingPool: Token supply is locked. Cannot add new tokens.");
        for (uint ii = 0 ; ii < tokenHashes.length ; ii++) {
            _availableTokenHashes.add(tokenHashes[ii]);
        }
    }

    /**
     * @dev remove multiple token hashes from the supply.
     * Note: if the input is too big, the transaction will fail due to high gas limit.
     */
    function _removeTokens(bytes32[] memory tokenHashes) internal {
        require(!tokenSupplyLocked(), "TokenMintingPool: Token supply is locked. Cannot remove tokens.");
        for (uint ii = 0 ; ii < tokenHashes.length ; ii++) {
            _availableTokenHashes.remove(tokenHashes[ii]);
        }
    }

    /**
     * @dev Triggers the token supply locking process by making a request to Chainlink VRF to get a random seed.
     * The random seed, when provided by Chainlink, will automatically trigger a shuffle of all the token hashes 
     * and lock the supply. See {fulfillRandomness()}.
     *
     * This cannot be undone, but can be called again if chainlink failed to return a random number.
     */
    function _lockTokenSupply() internal {
        require(!tokenSupplyLocked(), "TokenMintingPool: Token supply is already locked.");
        require(LINK.balanceOf(address(this)) >= _vrfLinkFee, "TokenMintingPool: Not enough LINK to run VRF.");
        requestRandomness(_vrfKeyHash, _vrfLinkFee);
    }

    /**
     * @dev Callback function used by the VRF Coordinator, that will update the seed,
     * and lock the supply in the process (See {tokenSupplyLocked()})
     */
    function fulfillRandomness(bytes32, uint256 randomness) internal override {
        if (!tokenSupplyLocked()) {
            _randomSeed = randomness;
        }
    }

    /**
     * @dev Tells whether or not the token supply is locked.
     */
    function tokenSupplyLocked() public view returns (bool) {
        return _randomSeed != 0;
    }

    /**
     * @dev The size of the remaining supply.
     */
    function remainingSupplyCount() public view returns (uint256) {
        return _availableTokenHashes.length();
    }

    /* ================================================== MINTING ================================================== */

    /**
     * @dev Minting function
     * 
     * Parameters:
     *  - to: the address that will recieve the newly minted tokens 
     *  - numTokens: the number of tokens to mint
     * 
     * Requirements:
     *  - The token supply must be locked.
     *  - The request hasn't already been fulfilled (using the request hash for reference).
     *  - The number of requested tokens needs to be <= The remaining supply.
     * 
     */
    function _mintTokens(address to, uint256 numTokens) internal {
        require(tokenSupplyLocked(), "TokenMintingPool: Token supply needs to be locked.");
        require(remainingSupplyCount() >= numTokens, "TokenMintingPool: Not enough tokens left.");
        for (uint ii = 0 ; ii < numTokens ; ii++) {
            uint256 index = _randomSeed % remainingSupplyCount();
            bytes32 tokenHash = _availableTokenHashes.at(index);
            tokenRegistry.mintToken(to, tokenHash);
            _availableTokenHashes.remove(tokenHash);
        }
    }

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

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

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

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

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

File 7 of 20 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev 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) {
        require(isContract(target), "Address: delegate call to non-contract");

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Checker.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface,
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            _supportsERC165Interface(account, type(IERC165).interfaceId) &&
            !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
        internal
        view
        returns (bool[] memory)
    {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in _interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!_supportsERC165Interface(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     * Interface identification is specified in ERC-165.
     */
    function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);
        (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams);
        if (result.length < 32) return false;
        return success && abi.decode(result, (bool));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @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 / b + (a % b == 0 ? 0 : 1);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @title {ITokenRegistry} is an interface for a token registry.
 */
interface ITokenRegistry is IERC165 {
    /**
     * @dev mint a new token to _to, and return the {tokenId} of the newly minted token. Upon minting a token, it is
     * required to provide the {_tokenHash} of integrity of the token. 
     * 
     * The hash uniquely identifies the token and is used to guarantee the integrity of the token at all times.
     * 
     * Use-case: for a token representing a physical asset, the _tokenHash is a hash of the information that uniquely
     * identifies the physical asset in the physical world. 
     */
    function mintToken(address _to, bytes32 _tokenHash) external returns (uint256);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./interfaces/LinkTokenInterface.sol";

import "./VRFRequestIDBase.sol";

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constuctor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator, _link) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash), and have told you the minimum LINK
 * @dev price for VRF service. Make sure your contract has sufficient LINK, and
 * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you
 * @dev want to generate randomness from.
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomness method.
 *
 * @dev The randomness argument to fulfillRandomness is the actual random value
 * @dev generated from your seed.
 *
 * @dev The requestId argument is generated from the keyHash and the seed by
 * @dev makeRequestId(keyHash, seed). If your contract could have concurrent
 * @dev requests open, you can use the requestId to track which seed is
 * @dev associated with which randomness. See VRFRequestIDBase.sol for more
 * @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.)
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ. (Which is critical to making unpredictable randomness! See the
 * @dev next section.)
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the ultimate input to the VRF is mixed with the block hash of the
 * @dev block in which the request is made, user-provided seeds have no impact
 * @dev on its economic security properties. They are only included for API
 * @dev compatability with previous versions of this contract.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request.
 */
abstract contract VRFConsumerBase is VRFRequestIDBase {
  /**
   * @notice fulfillRandomness handles the VRF response. Your contract must
   * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
   * @notice principles to keep in mind when implementing your fulfillRandomness
   * @notice method.
   *
   * @dev VRFConsumerBase expects its subcontracts to have a method with this
   * @dev signature, and will call it once it has verified the proof
   * @dev associated with the randomness. (It is triggered via a call to
   * @dev rawFulfillRandomness, below.)
   *
   * @param requestId The Id initially returned by requestRandomness
   * @param randomness the VRF output
   */
  function fulfillRandomness(bytes32 requestId, uint256 randomness) internal virtual;

  /**
   * @dev In order to keep backwards compatibility we have kept the user
   * seed field around. We remove the use of it because given that the blockhash
   * enters later, it overrides whatever randomness the used seed provides.
   * Given that it adds no security, and can easily lead to misunderstandings,
   * we have removed it from usage and can now provide a simpler API.
   */
  uint256 private constant USER_SEED_PLACEHOLDER = 0;

  /**
   * @notice requestRandomness initiates a request for VRF output given _seed
   *
   * @dev The fulfillRandomness method receives the output, once it's provided
   * @dev by the Oracle, and verified by the vrfCoordinator.
   *
   * @dev The _keyHash must already be registered with the VRFCoordinator, and
   * @dev the _fee must exceed the fee specified during registration of the
   * @dev _keyHash.
   *
   * @dev The _seed parameter is vestigial, and is kept only for API
   * @dev compatibility with older versions. It can't *hurt* to mix in some of
   * @dev your own randomness, here, but it's not necessary because the VRF
   * @dev oracle will mix the hash of the block containing your request into the
   * @dev VRF seed it ultimately uses.
   *
   * @param _keyHash ID of public key against which randomness is generated
   * @param _fee The amount of LINK to send with the request
   *
   * @return requestId unique ID for this request
   *
   * @dev The returned requestId can be used to distinguish responses to
   * @dev concurrent requests. It is passed as the first argument to
   * @dev fulfillRandomness.
   */
  function requestRandomness(bytes32 _keyHash, uint256 _fee) internal returns (bytes32 requestId) {
    LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER));
    // This is the seed passed to VRFCoordinator. The oracle will mix this with
    // the hash of the block containing this request to obtain the seed/input
    // which is finally passed to the VRF cryptographic machinery.
    uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
    // nonces[_keyHash] must stay in sync with
    // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above
    // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest).
    // This provides protection against the user repeating their input seed,
    // which would result in a predictable/duplicate output, if multiple such
    // requests appeared in the same block.
    nonces[_keyHash] = nonces[_keyHash] + 1;
    return makeRequestId(_keyHash, vRFSeed);
  }

  LinkTokenInterface internal immutable LINK;
  address private immutable vrfCoordinator;

  // Nonces for each VRF key from which randomness has been requested.
  //
  // Must stay in sync with VRFCoordinator[_keyHash][this]
  mapping(bytes32 => uint256) /* keyHash */ /* nonce */
    private nonces;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   * @param _link address of LINK token contract
   *
   * @dev https://docs.chain.link/docs/link-token-contracts
   */
  constructor(address _vrfCoordinator, address _link) {
    vrfCoordinator = _vrfCoordinator;
    LINK = LinkTokenInterface(_link);
  }

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
    require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
    fulfillRandomness(requestId, randomness);
  }
}

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

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

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract VRFRequestIDBase {
  /**
   * @notice returns the seed which is actually input to the VRF coordinator
   *
   * @dev To prevent repetition of VRF output due to repetition of the
   * @dev user-supplied seed, that seed is combined in a hash with the
   * @dev user-specific nonce, and the address of the consuming contract. The
   * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in
   * @dev the final seed, but the nonce does protect against repetition in
   * @dev requests which are included in a single block.
   *
   * @param _userSeed VRF seed input provided by user
   * @param _requester Address of the requesting contract
   * @param _nonce User-specific nonce at the time of the request
   */
  function makeVRFInputSeed(
    bytes32 _keyHash,
    uint256 _userSeed,
    address _requester,
    uint256 _nonce
  ) internal pure returns (uint256) {
    return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
  }

  /**
   * @notice Returns the id for this request
   * @param _keyHash The serviceAgreement ID to be used for this request
   * @param _vRFInputSeed The seed to be passed directly to the VRF
   * @return The id for this request
   *
   * @dev Note that _vRFInputSeed is not the seed passed by the consuming
   * @dev contract, but the one generated by makeVRFInputSeed
   */
  function makeRequestId(bytes32 _keyHash, uint256 _vRFInputSeed) internal pure returns (bytes32) {
    return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
  }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"PaymentReceiverAddressChanged","type":"event"},{"inputs":[{"internalType":"bytes32[]","name":"addressHashes","type":"bytes32[]"}],"name":"addAddressesToPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"tokenHashes","type":"bytes32[]"}],"name":"addTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"erc20Token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockTokenSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxPerAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"openPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"openPublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentReceiverAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleListCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleListLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"remainingSupplyCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"addressHashes","type":"bytes32[]"}],"name":"removeAddressesFromPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"tokenHashes","type":"bytes32[]"}],"name":"removeTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleStatus","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"selfCheckPresaleAccess","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"selfCheckPresaleEligibility","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"selfCheckTokensMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRegistry","outputs":[{"internalType":"contract ITokenRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenSupplyLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintPrice","type":"uint256"}],"name":"updateMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newReceiver","type":"address"}],"name":"updatePaymentReceiverAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101006040526005805460ff191690556012805461ffff191690553480156200002757600080fd5b5060408051808201909152601d81527f4261636b20546f205363686f6f6c207c20627920436f75727479617264000000602082015260016000556002600a6702c68af0bb140000737ceb23fd6bc0add59e62ac25578270cff1b9f61973732134d7f99b90c704d736b360db45425073380f73581425c638882bd8169dae6f2995878927c9fe70733d2341adb2d31f1c5530cdc622016af293177ae073b0897686c545045afc77cf20ec7a532e3120e0f17ff86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da655af3107a4000848484848483838d8d62000113336200025a565b6001600160601b0319606083901b166080526200013081620002ac565b5050606091821b6001600160601b031990811660c052911b1660a052846200016c816363f8ec4160e01b62000390602090811b62000cb317901c565b6200020a5760405162461bcd60e51b815260206004820152605b60248201527f546f6b656e4d696e74696e67506f6f6c3a2054617267657420746f6b656e207260448201527f6567697374727920636f6e747261637420646f6573206e6f74206d617463682060648201527f74686520696e7465726661636520726571756972656d656e74732e0000000000608482015260a4015b60405180910390fd5b5060609490941b6001600160601b03191660e05260075550506008558a516200023b90600c9060208e0190620004e4565b505050600d97909755505050600e92909255600f555062000630915050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0381166200033e5760405162461bcd60e51b815260206004820152604b60248201527f45524332305061796d656e7450726f636573736f723a2043616e6e6f7420736560448201527f7420746865207265636569766572206164647265737320746f20746865206e7560648201526a36361030b2323932b9b99760a91b608482015260a40162000201565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f1f5ca32bca795f51f990f46b6d28e4b2cc3c83013cb5ec25179e49c9dbf5108c90600090a35050565b60006200039d83620003ba565b8015620003b15750620003b18383620003f2565b90505b92915050565b6000620003cf826301ffc9a760e01b620003f2565b8015620003b45750620003eb826001600160e01b0319620003f2565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b03871690617530906200045b908690620005b5565b6000604051808303818686fa925050503d806000811462000499576040519150601f19603f3d011682016040523d82523d6000602084013e6200049e565b606091505b5091509150602081511015620004bb5760009350505050620003b4565b818015620004da575080806020019051810190620004da91906200058a565b9695505050505050565b828054620004f290620005f3565b90600052602060002090601f01602090048101928262000516576000855562000561565b82601f106200053157805160ff191683800117855562000561565b8280016001018555821562000561579182015b828111156200056157825182559160200191906001019062000544565b506200056f92915062000573565b5090565b5b808211156200056f576000815560010162000574565b6000602082840312156200059d57600080fd5b81518015158114620005ae57600080fd5b9392505050565b6000825160005b81811015620005d85760208186018101518583015201620005bc565b81811115620005e8576000828501525b509190910192915050565b600181811c908216806200060857607f821691505b602082108114156200062a57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160601c60a05160601c60c05160601c60e05160601c61222a620006996000396000818161032a0152611a100152600081816109920152611696015260008181610f4d01526116670152600081816102c401528181611850015261188e015261222a6000f3fe608060405234801561001057600080fd5b50600436106101ce5760003560e01c80638dd9831211610104578063cf747475116100a2578063f669c43d11610071578063f669c43d1461039d578063f9020e33146103a7578063f968adbe146103af578063fee48f2d146103b857600080fd5b8063cf74747514610364578063e09a619c14610377578063ee30b56c1461037f578063f2fde38b1461038a57600080fd5b80639d23c4c7116100de5780639d23c4c714610325578063adaaa0c91461034c578063b585209b14610354578063b99350ad1461035c57600080fd5b80638dd98312146102f75780638e22cb43146102ff57806394985ddd1461031257600080fd5b806346e04a2f116101715780636817c76c1161014b5780636817c76c146102ae578063715018a6146102b75780638a13eea7146102bf5780638da5cb5b146102e657600080fd5b806346e04a2f146102715780636256cf8d14610284578063639814e01461029757600080fd5b80630d34bf3c116101ad5780630d34bf3c1461021e578063197ff8c21461024357806343b33fd31461025657806344447f471461026957600080fd5b8062728e46146101d357806306fdde03146101e85780630bf82a9d14610206575b600080fd5b6101e66101e1366004611fb8565b6103cd565b005b6101f06104a0565b6040516101fd9190612062565b60405180910390f35b61020e61052e565b60405190151581526020016101fd565b6002546001600160a01b03165b6040516001600160a01b0390911681526020016101fd565b6101e6610251366004611eaf565b61053e565b6101e6610264366004611e86565b610574565b6101e66105a7565b6101e661027f366004611fb8565b6105db565b6101e6610292366004611eaf565b610837565b6102a0600e5481565b6040519081526020016101fd565b6102a0600f5481565b6101e661086a565b61022b7f000000000000000000000000000000000000000000000000000000000000000081565b6001546001600160a01b031661022b565b6101e661089e565b6101e661030d366004611eaf565b610954565b6101e6610320366004611f96565b610987565b61022b7f000000000000000000000000000000000000000000000000000000000000000081565b6102a0610a0d565b6101e6610a19565b61020e610ab4565b6101e6610372366004611eaf565b610aeb565b6102a0610b1e565b60055460ff1661020e565b6101e6610398366004611e86565b610b2a565b600b54151561020e565b6101f0610bc2565b6102a0600d5481565b336000908152601060205260409020546102a0565b6001546001600160a01b031633146104005760405162461bcd60e51b81526004016103f790612075565b60405180910390fd5b60125460ff16806104185750601254610100900460ff165b1561049b5760405162461bcd60e51b815260206004820152604760248201527f546f6b656e44726f70426173653a205468652064726f7020616c72656164792060448201527f73746172746564202d2063616e6e6f742075706461746520746865206d696e7460648201526610383934b1b29760c91b608482015260a4016103f7565b600f55565b600c80546104ad90612124565b80601f01602080910402602001604051908101604052809291908181526020018280546104d990612124565b80156105265780601f106104fb57610100808354040283529160200191610526565b820191906000526020600020905b81548152906001019060200180831161050957829003601f168201915b505050505081565b600061053933610cd8565b905090565b6001546001600160a01b031633146105685760405162461bcd60e51b81526004016103f790612075565b61057181610d24565b50565b6001546001600160a01b0316331461059e5760405162461bcd60e51b81526004016103f790612075565b61057181610de9565b6001546001600160a01b031633146105d15760405162461bcd60e51b81526004016103f790612075565b6105d9610ecb565b565b6002600054141561062e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103f7565b60026000556012543390610100900460ff166108245760125460ff166106aa5760405162461bcd60e51b815260206004820152602b60248201527f546f6b656e44726f70426173653a205468652070726573616c65206973206e6f60448201526a3a1037b832b7103cb2ba1760a91b60648201526084016103f7565b6106b381610cd8565b61074b5760405162461bcd60e51b815260206004820152605860248201527f546f6b656e44726f70426173653a20546865207075626c69632073616c65206960448201527f73206e6f74206f70656e2079657420616e642063616c6c657220646f6573206e60648201527f6f7420686176652070726573616c6520616464726573732e0000000000000000608482015260a4016103f7565b6001600160a01b03811660009081526011602052604090205460ff16156108005760405162461bcd60e51b815260206004820152605c60248201527f546f6b656e44726f70426173653a20546865207075626c69632073616c65206960448201527f73206e6f74206f70656e2079657420616e642063616c6c657220616c7265616460648201527f79206d696e74656420647572696e67207468652070726573616c652e00000000608482015260a4016103f7565b6001600160a01b0381166000908152601160205260409020805460ff191660011790555b61082e8183611041565b50506001600055565b6001546001600160a01b031633146108615760405162461bcd60e51b81526004016103f790612075565b6105718161126f565b6001546001600160a01b031633146108945760405162461bcd60e51b81526004016103f790612075565b6105d96000611333565b6001546001600160a01b031633146108c85760405162461bcd60e51b81526004016103f790612075565b600b546109335760405162461bcd60e51b815260206004820152603360248201527f546f6b656e44726f70426173653a2054686520746f6b656e20737570706c79206044820152723732b2b239903a37903132903637b1b5b2b21760691b60648201526084016103f7565b6109456005805460ff19166001179055565b6012805460ff19166001179055565b6001546001600160a01b0316331461097e5760405162461bcd60e51b81526004016103f790612075565b61057181611385565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146109ff5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c0060448201526064016103f7565b610a09828261144a565b5050565b60006105396003611457565b6001546001600160a01b03163314610a435760405162461bcd60e51b81526004016103f790612075565b60125460ff16610aa35760405162461bcd60e51b815260206004820152602560248201527f546f6b656e44726f70426173653a205468652070726573616c6520697320636c60448201526437b9b2b21760d91b60648201526084016103f7565b6012805461ff001916610100179055565b600033610ac081610cd8565b8015610ae557506001600160a01b03811660009081526011602052604090205460ff16155b91505090565b6001546001600160a01b03163314610b155760405162461bcd60e51b81526004016103f790612075565b61057181611461565b60006105396009611457565b6001546001600160a01b03163314610b545760405162461bcd60e51b81526004016103f790612075565b6001600160a01b038116610bb95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103f7565b61057181611333565b6060600080610bcf610b1e565b601254911015915060ff16610c02576040518060400160405280600681526020016510d313d4d15160d21b815250610ae5565b601254610100900460ff16610c615780610c3b576040518060400160405280600781526020016650524553414c4560c81b815250610ae5565b6040518060400160405280600881526020016714d3d31117d3d55560c21b815250610ae5565b80610c8f576040518060400160405280600b81526020016a5055424c49435f53414c4560a81b815250610ae5565b505060408051808201909152600881526714d3d31117d3d55560c21b602082015290565b6000610cbe83611523565b8015610ccf5750610ccf8383611556565b90505b92915050565b6040516bffffffffffffffffffffffff19606083901b166020820152600090610cd29060340160405160208183030381529060405280519060200120600361163f90919063ffffffff16565b60055460ff1615610d9d5760405162461bcd60e51b815260206004820152603e60248201527f50726573616c654c6973743a2050726573616c65206c697374206973206c6f6360448201527f6b65642e2043616e6e6f7420616464206e6577206164647265737365732e000060648201526084016103f7565b60005b8151811015610a0957610dd6828281518110610dbe57610dbe6121c8565b6020026020010151600361165790919063ffffffff16565b5080610de18161215f565b915050610da0565b6001600160a01b038116610e795760405162461bcd60e51b815260206004820152604b60248201527f45524332305061796d656e7450726f636573736f723a2043616e6e6f7420736560448201527f7420746865207265636569766572206164647265737320746f20746865206e7560648201526a36361030b2323932b9b99760a91b608482015260a4016103f7565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f1f5ca32bca795f51f990f46b6d28e4b2cc3c83013cb5ec25179e49c9dbf5108c90600090a35050565b600b5415610f355760405162461bcd60e51b815260206004820152603160248201527f546f6b656e4d696e74696e67506f6f6c3a20546f6b656e20737570706c792069604482015270399030b63932b0b23c903637b1b5b2b21760791b60648201526084016103f7565b6008546040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b158015610f9757600080fd5b505afa158015610fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcf9190611fd1565b10156110335760405162461bcd60e51b815260206004820152602d60248201527f546f6b656e4d696e74696e67506f6f6c3a204e6f7420656e6f756768204c494e60448201526c25903a3790393ab7102b29231760991b60648201526084016103f7565b610571600754600854611663565b600061104b610b1e565b9050600082116110b55760405162461bcd60e51b815260206004820152602f60248201527f546f6b656e44726f70426173653a20496e76616c69642072657175657374206660448201526e37b9103d32b937903a37b5b2b7399760891b60648201526084016103f7565b600081116111115760405162461bcd60e51b815260206004820152602360248201527f546f6b656e44726f70426173653a204e6f206d6f726520746f6b656e73206c65604482015262333a1760e91b60648201526084016103f7565b600e546001600160a01b038416600090815260106020526040902054106111995760405162461bcd60e51b815260206004820152603660248201527f546f6b656e44726f70426173653a20546f6b656e206c696d697420706572207760448201527530b63632ba1030b63932b0b23c903932b0b1b432b21760511b60648201526084016103f7565b600d548211156112085760405162461bcd60e51b815260206004820152603460248201527f546f6b656e44726f70426173653a20546f6b656e206c696d69742070657220746044820152733930b739b0b1ba34b7b71032bc31b2b2b232b21760611b60648201526084016103f7565b60006112158484846117f6565b6001600160a01b0385166000908152601060205260408120805492935083929091906112429084906120aa565b9091555050600f5461125f90859061125a90846120c2565b61183f565b61126984826118e3565b50505050565b600b54156112e7576040805162461bcd60e51b81526020600482015260248101919091527f546f6b656e4d696e74696e67506f6f6c3a20546f6b656e20737570706c79206960448201527f73206c6f636b65642e2043616e6e6f7420616464206e657720746f6b656e732e60648201526084016103f7565b60005b8151811015610a0957611320828281518110611308576113086121c8565b6020026020010151600961165790919063ffffffff16565b508061132b8161215f565b9150506112ea565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60055460ff16156113fe5760405162461bcd60e51b815260206004820152603d60248201527f50726573616c654c6973743a2050726573616c65206c697374206973206c6f6360448201527f6b65642e2043616e6e6f742072656d6f7665206164647265737365732e00000060648201526084016103f7565b60005b8151811015610a095761143782828151811061141f5761141f6121c8565b60200260200101516003611ab590919063ffffffff16565b50806114428161215f565b915050611401565b600b54610a0957600b5550565b6000610cd2825490565b600b54156114d75760405162461bcd60e51b815260206004820152603f60248201527f546f6b656e4d696e74696e67506f6f6c3a20546f6b656e20737570706c79206960448201527f73206c6f636b65642e2043616e6e6f742072656d6f766520746f6b656e732e0060648201526084016103f7565b60005b8151811015610a09576115108282815181106114f8576114f86121c8565b60200260200101516009611ab590919063ffffffff16565b508061151b8161215f565b9150506114da565b6000611536826301ffc9a760e01b611556565b8015610cd2575061154f826001600160e01b0319611556565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b03871690617530906115bd908690612016565b6000604051808303818686fa925050503d80600081146115f9576040519150601f19603f3d011682016040523d82523d6000602084013e6115fe565b606091505b50915091506020815110156116195760009350505050610cd2565b8180156116355750808060200190518101906116359190611f74565b9695505050505050565b60008181526001830160205260408120541515610ccf565b6000610ccf8383611ac1565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f0000000000000000000000000000000000000000000000000000000000000000848660006040516020016116d3929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161170093929190612032565b602060405180830381600087803b15801561171a57600080fd5b505af115801561172e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117529190611f74565b50600083815260066020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526117ae9060016120aa565b6000858152600660205260409020556117ee8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b949350505050565b6001600160a01b038316600090815260106020526040812054600e548491611828918391611823916120e1565b611b10565b90506118348184611b10565b9150505b9392505050565b60025461187b906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169185911684611b26565b6002546040518281526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169216907f0538ab32a957d2b55d0ec70a4029e73fdf19f500832839b1d7bafcfbca2a56309060200160405180910390a35050565b600b5461194d5760405162461bcd60e51b815260206004820152603260248201527f546f6b656e4d696e74696e67506f6f6c3a20546f6b656e20737570706c79206e60448201527132b2b239903a37903132903637b1b5b2b21760711b60648201526084016103f7565b80611956610b1e565b10156119b65760405162461bcd60e51b815260206004820152602960248201527f546f6b656e4d696e74696e67506f6f6c3a204e6f7420656e6f75676820746f6b60448201526832b739903632b33a1760b91b60648201526084016103f7565b60005b81811015611ab05760006119cb610b1e565b600b546119d8919061217a565b905060006119e7600983611b80565b6040516363f8ec4160e01b81526001600160a01b038781166004830152602482018390529192507f0000000000000000000000000000000000000000000000000000000000000000909116906363f8ec4190604401602060405180830381600087803b158015611a5657600080fd5b505af1158015611a6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8e9190611fd1565b50611a9a600982611ab5565b5050508080611aa89061215f565b9150506119b9565b505050565b6000610ccf8383611b8c565b6000818152600183016020526040812054611b0857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610cd2565b506000610cd2565b6000818310611b1f5781610ccf565b5090919050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611269908590611c7f565b6000610ccf8383611d51565b60008181526001830160205260408120548015611c75576000611bb06001836120e1565b8554909150600090611bc4906001906120e1565b9050818114611c29576000866000018281548110611be457611be46121c8565b9060005260206000200154905080876000018481548110611c0757611c076121c8565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611c3a57611c3a6121b2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610cd2565b6000915050610cd2565b6000611cd4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d7b9092919063ffffffff16565b805190915015611ab05780806020019051810190611cf29190611f74565b611ab05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103f7565b6000826000018281548110611d6857611d686121c8565b9060005260206000200154905092915050565b60606117ee848460008585843b611dd45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103f7565b600080866001600160a01b03168587604051611df09190612016565b60006040518083038185875af1925050503d8060008114611e2d576040519150601f19603f3d011682016040523d82523d6000602084013e611e32565b606091505b5091509150611e42828286611e4d565b979650505050505050565b60608315611e5c575081611838565b825115611e6c5782518084602001fd5b8160405162461bcd60e51b81526004016103f79190612062565b600060208284031215611e9857600080fd5b81356001600160a01b038116811461183857600080fd5b60006020808385031215611ec257600080fd5b823567ffffffffffffffff80821115611eda57600080fd5b818501915085601f830112611eee57600080fd5b813581811115611f0057611f006121de565b8060051b604051601f19603f83011681018181108582111715611f2557611f256121de565b604052828152858101935084860182860187018a1015611f4457600080fd5b600095505b83861015611f67578035855260019590950194938601938601611f49565b5098975050505050505050565b600060208284031215611f8657600080fd5b8151801515811461183857600080fd5b60008060408385031215611fa957600080fd5b50508035926020909101359150565b600060208284031215611fca57600080fd5b5035919050565b600060208284031215611fe357600080fd5b5051919050565b600081518084526120028160208601602086016120f8565b601f01601f19169290920160200192915050565b600082516120288184602087016120f8565b9190910192915050565b60018060a01b03841681528260208201526060604082015260006120596060830184611fea565b95945050505050565b602081526000610ccf6020830184611fea565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156120bd576120bd61219c565b500190565b60008160001904831182151516156120dc576120dc61219c565b500290565b6000828210156120f3576120f361219c565b500390565b60005b838110156121135781810151838201526020016120fb565b838111156112695750506000910152565b600181811c9082168061213857607f821691505b6020821081141561215957634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156121735761217361219c565b5060010190565b60008261219757634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212203513a47db8b0fc84fd84c5ee5b223d13503eea896f7d358d9183deb6f28a217864736f6c63430008070033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101ce5760003560e01c80638dd9831211610104578063cf747475116100a2578063f669c43d11610071578063f669c43d1461039d578063f9020e33146103a7578063f968adbe146103af578063fee48f2d146103b857600080fd5b8063cf74747514610364578063e09a619c14610377578063ee30b56c1461037f578063f2fde38b1461038a57600080fd5b80639d23c4c7116100de5780639d23c4c714610325578063adaaa0c91461034c578063b585209b14610354578063b99350ad1461035c57600080fd5b80638dd98312146102f75780638e22cb43146102ff57806394985ddd1461031257600080fd5b806346e04a2f116101715780636817c76c1161014b5780636817c76c146102ae578063715018a6146102b75780638a13eea7146102bf5780638da5cb5b146102e657600080fd5b806346e04a2f146102715780636256cf8d14610284578063639814e01461029757600080fd5b80630d34bf3c116101ad5780630d34bf3c1461021e578063197ff8c21461024357806343b33fd31461025657806344447f471461026957600080fd5b8062728e46146101d357806306fdde03146101e85780630bf82a9d14610206575b600080fd5b6101e66101e1366004611fb8565b6103cd565b005b6101f06104a0565b6040516101fd9190612062565b60405180910390f35b61020e61052e565b60405190151581526020016101fd565b6002546001600160a01b03165b6040516001600160a01b0390911681526020016101fd565b6101e6610251366004611eaf565b61053e565b6101e6610264366004611e86565b610574565b6101e66105a7565b6101e661027f366004611fb8565b6105db565b6101e6610292366004611eaf565b610837565b6102a0600e5481565b6040519081526020016101fd565b6102a0600f5481565b6101e661086a565b61022b7f0000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f61981565b6001546001600160a01b031661022b565b6101e661089e565b6101e661030d366004611eaf565b610954565b6101e6610320366004611f96565b610987565b61022b7f000000000000000000000000581425c638882bd8169dae6f2995878927c9fe7081565b6102a0610a0d565b6101e6610a19565b61020e610ab4565b6101e6610372366004611eaf565b610aeb565b6102a0610b1e565b60055460ff1661020e565b6101e6610398366004611e86565b610b2a565b600b54151561020e565b6101f0610bc2565b6102a0600d5481565b336000908152601060205260409020546102a0565b6001546001600160a01b031633146104005760405162461bcd60e51b81526004016103f790612075565b60405180910390fd5b60125460ff16806104185750601254610100900460ff165b1561049b5760405162461bcd60e51b815260206004820152604760248201527f546f6b656e44726f70426173653a205468652064726f7020616c72656164792060448201527f73746172746564202d2063616e6e6f742075706461746520746865206d696e7460648201526610383934b1b29760c91b608482015260a4016103f7565b600f55565b600c80546104ad90612124565b80601f01602080910402602001604051908101604052809291908181526020018280546104d990612124565b80156105265780601f106104fb57610100808354040283529160200191610526565b820191906000526020600020905b81548152906001019060200180831161050957829003601f168201915b505050505081565b600061053933610cd8565b905090565b6001546001600160a01b031633146105685760405162461bcd60e51b81526004016103f790612075565b61057181610d24565b50565b6001546001600160a01b0316331461059e5760405162461bcd60e51b81526004016103f790612075565b61057181610de9565b6001546001600160a01b031633146105d15760405162461bcd60e51b81526004016103f790612075565b6105d9610ecb565b565b6002600054141561062e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103f7565b60026000556012543390610100900460ff166108245760125460ff166106aa5760405162461bcd60e51b815260206004820152602b60248201527f546f6b656e44726f70426173653a205468652070726573616c65206973206e6f60448201526a3a1037b832b7103cb2ba1760a91b60648201526084016103f7565b6106b381610cd8565b61074b5760405162461bcd60e51b815260206004820152605860248201527f546f6b656e44726f70426173653a20546865207075626c69632073616c65206960448201527f73206e6f74206f70656e2079657420616e642063616c6c657220646f6573206e60648201527f6f7420686176652070726573616c6520616464726573732e0000000000000000608482015260a4016103f7565b6001600160a01b03811660009081526011602052604090205460ff16156108005760405162461bcd60e51b815260206004820152605c60248201527f546f6b656e44726f70426173653a20546865207075626c69632073616c65206960448201527f73206e6f74206f70656e2079657420616e642063616c6c657220616c7265616460648201527f79206d696e74656420647572696e67207468652070726573616c652e00000000608482015260a4016103f7565b6001600160a01b0381166000908152601160205260409020805460ff191660011790555b61082e8183611041565b50506001600055565b6001546001600160a01b031633146108615760405162461bcd60e51b81526004016103f790612075565b6105718161126f565b6001546001600160a01b031633146108945760405162461bcd60e51b81526004016103f790612075565b6105d96000611333565b6001546001600160a01b031633146108c85760405162461bcd60e51b81526004016103f790612075565b600b546109335760405162461bcd60e51b815260206004820152603360248201527f546f6b656e44726f70426173653a2054686520746f6b656e20737570706c79206044820152723732b2b239903a37903132903637b1b5b2b21760691b60648201526084016103f7565b6109456005805460ff19166001179055565b6012805460ff19166001179055565b6001546001600160a01b0316331461097e5760405162461bcd60e51b81526004016103f790612075565b61057181611385565b336001600160a01b037f0000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae016146109ff5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c0060448201526064016103f7565b610a09828261144a565b5050565b60006105396003611457565b6001546001600160a01b03163314610a435760405162461bcd60e51b81526004016103f790612075565b60125460ff16610aa35760405162461bcd60e51b815260206004820152602560248201527f546f6b656e44726f70426173653a205468652070726573616c6520697320636c60448201526437b9b2b21760d91b60648201526084016103f7565b6012805461ff001916610100179055565b600033610ac081610cd8565b8015610ae557506001600160a01b03811660009081526011602052604090205460ff16155b91505090565b6001546001600160a01b03163314610b155760405162461bcd60e51b81526004016103f790612075565b61057181611461565b60006105396009611457565b6001546001600160a01b03163314610b545760405162461bcd60e51b81526004016103f790612075565b6001600160a01b038116610bb95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103f7565b61057181611333565b6060600080610bcf610b1e565b601254911015915060ff16610c02576040518060400160405280600681526020016510d313d4d15160d21b815250610ae5565b601254610100900460ff16610c615780610c3b576040518060400160405280600781526020016650524553414c4560c81b815250610ae5565b6040518060400160405280600881526020016714d3d31117d3d55560c21b815250610ae5565b80610c8f576040518060400160405280600b81526020016a5055424c49435f53414c4560a81b815250610ae5565b505060408051808201909152600881526714d3d31117d3d55560c21b602082015290565b6000610cbe83611523565b8015610ccf5750610ccf8383611556565b90505b92915050565b6040516bffffffffffffffffffffffff19606083901b166020820152600090610cd29060340160405160208183030381529060405280519060200120600361163f90919063ffffffff16565b60055460ff1615610d9d5760405162461bcd60e51b815260206004820152603e60248201527f50726573616c654c6973743a2050726573616c65206c697374206973206c6f6360448201527f6b65642e2043616e6e6f7420616464206e6577206164647265737365732e000060648201526084016103f7565b60005b8151811015610a0957610dd6828281518110610dbe57610dbe6121c8565b6020026020010151600361165790919063ffffffff16565b5080610de18161215f565b915050610da0565b6001600160a01b038116610e795760405162461bcd60e51b815260206004820152604b60248201527f45524332305061796d656e7450726f636573736f723a2043616e6e6f7420736560448201527f7420746865207265636569766572206164647265737320746f20746865206e7560648201526a36361030b2323932b9b99760a91b608482015260a4016103f7565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f1f5ca32bca795f51f990f46b6d28e4b2cc3c83013cb5ec25179e49c9dbf5108c90600090a35050565b600b5415610f355760405162461bcd60e51b815260206004820152603160248201527f546f6b656e4d696e74696e67506f6f6c3a20546f6b656e20737570706c792069604482015270399030b63932b0b23c903637b1b5b2b21760791b60648201526084016103f7565b6008546040516370a0823160e01b81523060048201527f000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f16001600160a01b0316906370a082319060240160206040518083038186803b158015610f9757600080fd5b505afa158015610fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcf9190611fd1565b10156110335760405162461bcd60e51b815260206004820152602d60248201527f546f6b656e4d696e74696e67506f6f6c3a204e6f7420656e6f756768204c494e60448201526c25903a3790393ab7102b29231760991b60648201526084016103f7565b610571600754600854611663565b600061104b610b1e565b9050600082116110b55760405162461bcd60e51b815260206004820152602f60248201527f546f6b656e44726f70426173653a20496e76616c69642072657175657374206660448201526e37b9103d32b937903a37b5b2b7399760891b60648201526084016103f7565b600081116111115760405162461bcd60e51b815260206004820152602360248201527f546f6b656e44726f70426173653a204e6f206d6f726520746f6b656e73206c65604482015262333a1760e91b60648201526084016103f7565b600e546001600160a01b038416600090815260106020526040902054106111995760405162461bcd60e51b815260206004820152603660248201527f546f6b656e44726f70426173653a20546f6b656e206c696d697420706572207760448201527530b63632ba1030b63932b0b23c903932b0b1b432b21760511b60648201526084016103f7565b600d548211156112085760405162461bcd60e51b815260206004820152603460248201527f546f6b656e44726f70426173653a20546f6b656e206c696d69742070657220746044820152733930b739b0b1ba34b7b71032bc31b2b2b232b21760611b60648201526084016103f7565b60006112158484846117f6565b6001600160a01b0385166000908152601060205260408120805492935083929091906112429084906120aa565b9091555050600f5461125f90859061125a90846120c2565b61183f565b61126984826118e3565b50505050565b600b54156112e7576040805162461bcd60e51b81526020600482015260248101919091527f546f6b656e4d696e74696e67506f6f6c3a20546f6b656e20737570706c79206960448201527f73206c6f636b65642e2043616e6e6f7420616464206e657720746f6b656e732e60648201526084016103f7565b60005b8151811015610a0957611320828281518110611308576113086121c8565b6020026020010151600961165790919063ffffffff16565b508061132b8161215f565b9150506112ea565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60055460ff16156113fe5760405162461bcd60e51b815260206004820152603d60248201527f50726573616c654c6973743a2050726573616c65206c697374206973206c6f6360448201527f6b65642e2043616e6e6f742072656d6f7665206164647265737365732e00000060648201526084016103f7565b60005b8151811015610a095761143782828151811061141f5761141f6121c8565b60200260200101516003611ab590919063ffffffff16565b50806114428161215f565b915050611401565b600b54610a0957600b5550565b6000610cd2825490565b600b54156114d75760405162461bcd60e51b815260206004820152603f60248201527f546f6b656e4d696e74696e67506f6f6c3a20546f6b656e20737570706c79206960448201527f73206c6f636b65642e2043616e6e6f742072656d6f766520746f6b656e732e0060648201526084016103f7565b60005b8151811015610a09576115108282815181106114f8576114f86121c8565b60200260200101516009611ab590919063ffffffff16565b508061151b8161215f565b9150506114da565b6000611536826301ffc9a760e01b611556565b8015610cd2575061154f826001600160e01b0319611556565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b03871690617530906115bd908690612016565b6000604051808303818686fa925050503d80600081146115f9576040519150601f19603f3d011682016040523d82523d6000602084013e6115fe565b606091505b50915091506020815110156116195760009350505050610cd2565b8180156116355750808060200190518101906116359190611f74565b9695505050505050565b60008181526001830160205260408120541515610ccf565b6000610ccf8383611ac1565b60007f000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f16001600160a01b0316634000aea07f0000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae0848660006040516020016116d3929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161170093929190612032565b602060405180830381600087803b15801561171a57600080fd5b505af115801561172e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117529190611f74565b50600083815260066020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526117ae9060016120aa565b6000858152600660205260409020556117ee8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b949350505050565b6001600160a01b038316600090815260106020526040812054600e548491611828918391611823916120e1565b611b10565b90506118348184611b10565b9150505b9392505050565b60025461187b906001600160a01b037f0000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f61981169185911684611b26565b6002546040518281526001600160a01b037f0000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f61981169216907f0538ab32a957d2b55d0ec70a4029e73fdf19f500832839b1d7bafcfbca2a56309060200160405180910390a35050565b600b5461194d5760405162461bcd60e51b815260206004820152603260248201527f546f6b656e4d696e74696e67506f6f6c3a20546f6b656e20737570706c79206e60448201527132b2b239903a37903132903637b1b5b2b21760711b60648201526084016103f7565b80611956610b1e565b10156119b65760405162461bcd60e51b815260206004820152602960248201527f546f6b656e4d696e74696e67506f6f6c3a204e6f7420656e6f75676820746f6b60448201526832b739903632b33a1760b91b60648201526084016103f7565b60005b81811015611ab05760006119cb610b1e565b600b546119d8919061217a565b905060006119e7600983611b80565b6040516363f8ec4160e01b81526001600160a01b038781166004830152602482018390529192507f000000000000000000000000581425c638882bd8169dae6f2995878927c9fe70909116906363f8ec4190604401602060405180830381600087803b158015611a5657600080fd5b505af1158015611a6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8e9190611fd1565b50611a9a600982611ab5565b5050508080611aa89061215f565b9150506119b9565b505050565b6000610ccf8383611b8c565b6000818152600183016020526040812054611b0857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610cd2565b506000610cd2565b6000818310611b1f5781610ccf565b5090919050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611269908590611c7f565b6000610ccf8383611d51565b60008181526001830160205260408120548015611c75576000611bb06001836120e1565b8554909150600090611bc4906001906120e1565b9050818114611c29576000866000018281548110611be457611be46121c8565b9060005260206000200154905080876000018481548110611c0757611c076121c8565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611c3a57611c3a6121b2565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610cd2565b6000915050610cd2565b6000611cd4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d7b9092919063ffffffff16565b805190915015611ab05780806020019051810190611cf29190611f74565b611ab05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103f7565b6000826000018281548110611d6857611d686121c8565b9060005260206000200154905092915050565b60606117ee848460008585843b611dd45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103f7565b600080866001600160a01b03168587604051611df09190612016565b60006040518083038185875af1925050503d8060008114611e2d576040519150601f19603f3d011682016040523d82523d6000602084013e611e32565b606091505b5091509150611e42828286611e4d565b979650505050505050565b60608315611e5c575081611838565b825115611e6c5782518084602001fd5b8160405162461bcd60e51b81526004016103f79190612062565b600060208284031215611e9857600080fd5b81356001600160a01b038116811461183857600080fd5b60006020808385031215611ec257600080fd5b823567ffffffffffffffff80821115611eda57600080fd5b818501915085601f830112611eee57600080fd5b813581811115611f0057611f006121de565b8060051b604051601f19603f83011681018181108582111715611f2557611f256121de565b604052828152858101935084860182860187018a1015611f4457600080fd5b600095505b83861015611f67578035855260019590950194938601938601611f49565b5098975050505050505050565b600060208284031215611f8657600080fd5b8151801515811461183857600080fd5b60008060408385031215611fa957600080fd5b50508035926020909101359150565b600060208284031215611fca57600080fd5b5035919050565b600060208284031215611fe357600080fd5b5051919050565b600081518084526120028160208601602086016120f8565b601f01601f19169290920160200192915050565b600082516120288184602087016120f8565b9190910192915050565b60018060a01b03841681528260208201526060604082015260006120596060830184611fea565b95945050505050565b602081526000610ccf6020830184611fea565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082198211156120bd576120bd61219c565b500190565b60008160001904831182151516156120dc576120dc61219c565b500290565b6000828210156120f3576120f361219c565b500390565b60005b838110156121135781810151838201526020016120fb565b838111156112695750506000910152565b600181811c9082168061213857607f821691505b6020821081141561215957634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156121735761217361219c565b5060010190565b60008261219757634e487b7160e01b600052601260045260246000fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212203513a47db8b0fc84fd84c5ee5b223d13503eea896f7d358d9183deb6f28a217864736f6c63430008070033

Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.