Contract 0x3803f8497f0446ed5362c73635e3d8e9eac83d25 9

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xe04cbac71a5b9e04b1f87a7887d947c43ea8d1bf64f69bdcbb6da5b9d8da37b3Set Approval For...287504862022-05-25 11:32:237 hrs 11 mins ago0x84a66264b65d9c30a454a8a09aa7784ccadc340d IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.00140449889 30.102640336
0x5e9f50977273b587e431129d19feed2e7470318b4d155e0b3a50df1acc73d90aSet Approval For...287081872022-05-24 10:31:301 day 8 hrs ago0xa3fcd05cd04ba0d5558a3f560cc63cb2d89ba2aa IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.001448233275 31.039999908
0xf1333c8ea7e6c77d87b3eef969db4c5103b41b06a4204af1b7f40557f4b4427dSafe Transfer Fr...287055102022-05-24 8:59:191 day 9 hrs ago0x996bee39be9423d45583be82de199e1fdb77f0b9 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002760175758 30.814130708
0x01e4b19c75e380700432f0b680096b1ca0092ae317a07a032d91838803803303Safe Transfer Fr...287054982022-05-24 8:58:551 day 9 hrs ago0x996bee39be9423d45583be82de199e1fdb77f0b9 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002413340499 31.230546742
0xede5ae87ff091dfb68d7c63b5fa91421590542d6445e7fbb77e3e7ca6377cf9bSafe Transfer Fr...287054852022-05-24 8:58:291 day 9 hrs ago0x996bee39be9423d45583be82de199e1fdb77f0b9 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.0024728408 32.000527988
0x5a9fdb49d02f8268b39ab35a013935fee65a6e209123b6d9b95a64796a90d182Safe Transfer Fr...287054732022-05-24 8:58:051 day 9 hrs ago0x996bee39be9423d45583be82de199e1fdb77f0b9 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002431876859 32.653599991
0xc2a42614c07edba4d3d15c520f23bdb3b1d0c413e9b35e9a5c2e9fb27785a599Safe Transfer Fr...287054642022-05-24 8:57:431 day 9 hrs ago0x996bee39be9423d45583be82de199e1fdb77f0b9 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002726261999 35.279999988
0xeb158a4926672f9528b39b683d01cb109083e9998340708664d9e9dbd97e43d0Safe Transfer Fr...287054522022-05-24 8:57:191 day 9 hrs ago0x996bee39be9423d45583be82de199e1fdb77f0b9 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.003029179998 39.199999978
0xcc8f2adbbfaebc1051c47b4e5bc5269f41c85db34d802f495257143a8ddbb467Safe Transfer Fr...287054352022-05-24 8:56:451 day 9 hrs ago0x996bee39be9423d45583be82de199e1fdb77f0b9 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.003167579242 35.362313621
0x789e64ad0fb174d1ef5a110ad3be730cfbd9be9dc5ca9292ef25164d7a12116eSet Approval For...286977002022-05-24 4:24:071 day 14 hrs ago0x82dd45b0c7bb1d6a361e93231786458a51e537b6 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.001402975989 30.069999998
0x97b8897823df32a89449182327067c972c2825976c1d89d09abdfa90608a88d2Set Approval For...286769782022-05-23 16:03:092 days 2 hrs ago0x769ea7d3e828bfa66c1402f446b58aef2435d15a IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.001565647877 33.556548375
0xb4bf11c5282d1c0762f9ad4146e31a84380a60522351fc35d54e393fe46926cbSafe Transfer Fr...286613422022-05-23 7:03:172 days 11 hrs ago0x672efbb2538faa65d17f4a7c6a84001f6d3bbfe8 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002698931737 31.106943484
0x9573263a689b3f23f2e1abf419a96bef52d2ae0639d6772b21bf747fa649f8f3Set Approval For...286541232022-05-23 2:46:212 days 15 hrs ago0xcdfa0a09450c22f8ed9c5292f226093f1ff0390a IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.001452066118 31.122149262
0xf31102ac4b5b39f5163b21f9157dba30373d6ed7be8b569c39c1df2aba66458cTransfer From286448042022-05-22 21:23:502 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002823430973 32.596730126
0x5d8d442748b47c4964ae2df56f79d613115fcdb43594d790e51e8f587af2fb9eTransfer From286448002022-05-22 21:23:422 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422491192 32.596730125
0x084fd2c45e079468068cc29fc0f1e8809bfe8e382a41284cd16bb8acf4d3a893Transfer From286447942022-05-22 21:23:262 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422100031 32.596730125
0x3c04b3dbb2a791c0873bc06403670523944c5ceff9b4cdec69b816944856f272Transfer From286447882022-05-22 21:23:142 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422100031 32.596730123
0x00cf887ae6104d195996c72aa19204d399ae717da0fad744dd4e0e17fc32d677Transfer From286447832022-05-22 21:23:042 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422100031 32.596730123
0x720652f4a759169f9569e5271450b6939dc6c4bdf0029412980f2dfa1d987603Transfer From286447752022-05-22 21:22:482 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422491192 32.596730124
0x115b53525b3b417552826cba0789b1da6d35a98ffad8c5701c65fc1b5041b3b7Transfer From286447692022-05-22 21:22:362 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422491192 32.596730124
0x1e821c96dcdb214142f57c9d580c91fba8ba940086663bc4e6facb9fa9bb7aa3Transfer From286447632022-05-22 21:22:242 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422491192 32.596730123
0x7be140b509d8415e1dcbbd4880aef9c9dc785bd3877cb37f966098bf512fc62dTransfer From286447582022-05-22 21:22:142 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422491192 32.596730123
0x69a47ed198cd1708c796ed3fbe3dccb024df3b99649b54984de6f0989dc79fdcTransfer From286447462022-05-22 21:21:502 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422491192 32.596730124
0x4636e491f2921e3b11d656770a4bdd2ca23ae7ffc7ea2d313f3261b954ebf3e7Transfer From286447402022-05-22 21:21:382 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422491192 32.596730123
0xb24a2887cc5b671cba83d2c8dd2c12517ca6d36508b9586a4d07cd2cf46a07a8Transfer From286447362022-05-22 21:21:302 days 21 hrs ago0xdef167797f02459830958d7a45b81f892f9d7013 IN  0x3803f8497f0446ed5362c73635e3d8e9eac83d250 MATIC0.002422491192 32.596730122
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FoxHen

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 2 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 18 : FoxHen.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "./Metadata.sol";

contract FoxHen is ERC721Enumerable, Ownable, VRFConsumerBase {
  uint256 public constant MAX_TOKENS = 10000;
  uint256 public constant FREE_TOKENS = 3000;
  uint16 public purchased = 0;

  struct Minting {
    address minter;
    uint256 tokenId;
    bool fulfilled;
  }
  mapping(bytes32=>Minting) mintings;

  struct TokenWithMetadata {
    uint256 tokenId;
    bool isFox;
    string metadata;
  }

  mapping(uint256=>bool) public isFox;
  uint256[] public foxes;
  uint16 public stolenMints;
  mapping(uint256=>uint256) public traitsOfToken;
  mapping(uint256=>bool) public traitsTaken;
  bool public mainSaleStarted;
  mapping(bytes=>bool) public signatureUsed;
  mapping(address=>uint8) public freeMintsUsed;
  uint256 extrasCount;

  IERC20 eggs;
  Metadata metadata;

  bytes32 internal keyHash;
  uint256 internal fee;

  constructor(address _eggs, address _vrf, address _link, bytes32 _keyHash, uint256 _fee, address _metadata) ERC721("FoxHen", 'FH') VRFConsumerBase(_vrf, _link) {
    eggs = IERC20(_eggs);
    metadata = Metadata(_metadata);
    keyHash = _keyHash;
    fee = _fee;
    require(IERC20(_link).approve(msg.sender, type(uint256).max));
    require(eggs.approve(msg.sender, type(uint256).max));
  }

  // Internal
  function setTraits(uint256 tokenId, uint256 seed) internal returns (uint256) {
    uint256 maxTraits = 16 ** 4;
    uint256 nextRandom = uint256(keccak256(abi.encode(seed, 1)));
    uint256 traitsID = nextRandom % maxTraits;
    while(traitsTaken[traitsID]) {
      nextRandom = uint256(keccak256(abi.encode(nextRandom, 1)));
      traitsID = nextRandom % maxTraits;
    }
    traitsTaken[traitsID] = true;
    traitsOfToken[tokenId] = traitsID;
    return traitsID;
  }

  function setSpecies(uint256 tokenId, uint256 seed) internal returns (bool) {
    uint256 random = uint256(keccak256(abi.encode(seed, 2))) % 10;
    if (random == 0) {
      isFox[tokenId] = true;
      foxes.push(tokenId);
      return true;
    }
    return false;
  }

  function getRecipient(uint256 tokenId, address minter, uint256 seed) internal view returns (address) {
    if (tokenId > FREE_TOKENS && tokenId <= MAX_TOKENS && (uint256(keccak256(abi.encode(seed, 3))) % 10) == 0) {
      uint256 fox = foxes[uint256(keccak256(abi.encode(seed, 4))) % foxes.length];
      address owner = ownerOf(fox);
      if (owner != address(0)) {
        return owner;
      }
    }
    return minter;
  }

  function fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
    Minting storage minting = mintings[requestId];
    require(minting.minter != address(0));
    setSpecies(minting.tokenId, randomness);
    setTraits(minting.tokenId, randomness);

    address recipient = getRecipient(minting.tokenId, minting.minter, randomness);
    if (recipient != minting.minter) {
      stolenMints++;
    }
    _mint(recipient, minting.tokenId);
  }

  // Reads
  function eggsPrice(uint16 amount) public view returns (uint256) {
    require(purchased + amount >= FREE_TOKENS);
    uint16 secondGen = purchased + amount - uint16(FREE_TOKENS);
    return (secondGen / 500 + 1) * 40 ether;
  }

  function foxCount() public view returns (uint256) {
    return foxes.length;
  }

  function tokenURI(uint256 tokenId) public view override returns (string memory) {
    return metadata.tokenMetadata(isFox[tokenId], traitsOfToken[tokenId], tokenId);
  }

  function allTokensOfOwner(address owner) public view returns (TokenWithMetadata[] memory) {
    uint256 balance = balanceOf(owner);
    TokenWithMetadata[] memory tokens = new TokenWithMetadata[](balance);
    for (uint256 i = 0; i < balance; i++) {
      uint256 tokenId = tokenOfOwnerByIndex(owner, i);
      string memory data = tokenURI(tokenId);
      tokens[i] = TokenWithMetadata(tokenId, isFox[tokenId], data);
    }
    return tokens;
  }

  // Public
  function freeMint(uint8 amount) public payable {
    require(mainSaleStarted, "Main Sale hasn't started yet");
    address minter = _msgSender();
    require(freeMintsUsed[minter] + amount <= 5, "You can't free mint any more");
    require(tx.origin == minter, "Contracts not allowed");
    require(purchased + amount <= FREE_TOKENS, "Sold out");

    for (uint8 i = 0; i < amount; i++) {
      freeMintsUsed[minter]++;
      purchased++;
      bytes32 requestId = requestRandomness(keyHash, fee);
      mintings[requestId] = Minting(minter, purchased, false);
    }
  }

  function buyWithEggs(uint16 amount) public {
    address minter = _msgSender();
    require(mainSaleStarted, "Main Sale hasn't started yet");
    require(tx.origin == minter, "Contracts not allowed");
    require(amount > 0 && amount <= 20, "Max 20 mints per tx");
    require(purchased >= FREE_TOKENS, "Eggs sale not active");
    require(purchased + amount <= MAX_TOKENS, "Sold out");

    uint256 price = amount * eggsPrice(amount);
    require(price <= eggs.allowance(minter, address(this)) && price <= eggs.balanceOf(minter), "You need to send enough eggs");
    
    uint256 initialPurchased = purchased;
    purchased += amount;
    require(eggs.transferFrom(minter, address(this), price));

    for (uint16 i = 1; i <= amount; i++) {
      bytes32 requestId = requestRandomness(keyHash, fee);
      mintings[requestId] = Minting(minter, initialPurchased + i, false);
    }
  }

  function mintExtra(address recipient) public onlyOwner {
    require(extrasCount + 1 <= 30, "Max extras minted");
    extrasCount++;
    uint256 tokenId = MAX_TOKENS + extrasCount;
    bytes32 requestId = requestRandomness(keyHash, fee);
    mintings[requestId] = Minting(recipient, tokenId, false);
  }

  // Admin
  function mintL1Token(address recipient, uint256 tokenId, uint256 traitsID, bool fox) external onlyOwner {
    require(!mainSaleStarted, "Main Sale has already begun");
    require(purchased + 1 == tokenId, "Incorrect tokenId");
    require(!traitsTaken[traitsID], "Traits already in use");

    purchased++;
    if (fox) {
      isFox[tokenId] = true;
      foxes.push(tokenId);
    }
    traitsTaken[traitsID] = true;
    traitsOfToken[tokenId] = traitsID;
    _mint(recipient, tokenId);
  }

  function toggleMainSale() public onlyOwner {
    mainSaleStarted = !mainSaleStarted;
  }
}

File 2 of 18 : Metadata.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;

import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/Strings.sol";

contract Metadata is Ownable {
    using Strings for uint256;

    struct Trait {
        string name;
        string image;
    }

    string[4] categoryNames = ["Color", "Expression", "Accesory", "Hat"];

    mapping(uint8=>mapping(uint8=>Trait)) public traitData;

    constructor() {}

    function uploadTraits(uint8 category, Trait[] calldata traits)
        public
        onlyOwner
    {
        require(traits.length == 16, "Wrong length");
        for (uint8 i = 0; i < traits.length; i++) {
            traitData[category][i] = Trait(traits[i].name, traits[i].image);
        }
    }

    function drawTrait(Trait memory trait)
        internal
        pure
        returns (string memory)
    {
        return
            string(
                abi.encodePacked(
                    '<image x="0" y="0" width="64" height="64" image-rendering="pixelated" preserveAspectRatio="xMidYMid" xlink:href="data:image/png;base64,',
                    trait.image,
                    '"/>'
                )
            );
    }

    function drawSVG(bool isFox, uint8[] memory traits)
        public
        view
        returns (string memory)
    {
        uint8 offset = isFox ? 4 : 0;
        string memory svgString = string(
            abi.encodePacked(
                drawTrait(traitData[offset][traits[0]]),
                drawTrait(traitData[1 + offset][traits[1]]),
                drawTrait(traitData[2 + offset][traits[2]]),
                drawTrait(traitData[3 + offset][traits[3]])
            )
        );

        return
            string(
                abi.encodePacked(
                    '<svg id="foxhen" width="100%" height="100%" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">',
                    svgString,
                    "</svg>"
                )
            );
    }

    function attributeForTypeAndValue(
        string memory categoryName,
        string memory value
    ) internal pure returns (string memory) {
        return
            string(
                abi.encodePacked(
                    '{"trait_type":"',
                    categoryName,
                    '","value":"',
                    value,
                    '"}'
                )
            );
    }

    function compileAttributes(
        bool isFox,
        uint8[] memory traits,
        uint256 tokenId
    ) public view returns (string memory) {
        uint8 offset = isFox ? 4 : 0;
        string memory attributes = string(
            abi.encodePacked(
                attributeForTypeAndValue(
                    categoryNames[0],
                    traitData[offset][traits[0]].name
                ),
                ",",
                attributeForTypeAndValue(
                    categoryNames[1],
                    traitData[offset + 1][traits[1]].name
                ),
                ",",
                attributeForTypeAndValue(
                    categoryNames[2],
                    traitData[offset + 2][traits[2]].name
                ),
                ",",
                attributeForTypeAndValue(
                    categoryNames[3],
                    traitData[offset + 3][traits[3]].name
                ),
                ","
            )
        );
        return
            string(
                abi.encodePacked(
                    "[",
                    attributes,
                    '{"trait_type":"Generation","value":',
                    tokenId <= 10000 ? '"Gen 0"' : '"Gen 1"',
                    '},{"trait_type":"Type","value":',
                    isFox ? '"Fox"' : '"Hen"',
                    "}]"
                )
            );
    }

    function tokenMetadata(
        bool isFox,
        uint256 traitId,
        uint256 tokenId
    ) public view returns (string memory) {
        uint8[] memory traits = new uint8[](4);
        uint256 traitIdBackUp = traitId;
        for (uint8 i = 0; i < 4; i++) {
            uint8 exp = 3 - i;
            uint8 tmp = uint8(traitIdBackUp / (16**exp));
            traits[i] = tmp;
            traitIdBackUp -= tmp * 16**exp;
        }

        string memory svg = drawSVG(isFox, traits);

        string memory metadata = string(
            abi.encodePacked(
                '{"name": "',
                isFox ? "Fox #" : "Hen #",
                tokenId.toString(),
                '", "description": "A sunny day in the Summer begins, with the Farmlands and the Forest In its splendor, it seems like a normal day. But the cunning planning of the Foxes has begun, they know that the hens will do everything to protect their precious $EGG but can they keep them all without risk of losing them? A Risk-Reward economic game, where every action matters. No IPFS. No API. All stored and generated 100% on-chain", "image": "data:image/svg+xml;base64,',
                base64(bytes(svg)),
                '", "attributes":',
                compileAttributes(isFox, traits, tokenId),
                "}"
            )
        );

        return
            string(
                abi.encodePacked(
                    "data:application/json;base64,",
                    base64(bytes(metadata))
                )
            );
    }

    /** BASE 64 - Written by Brech Devos */

    string internal constant TABLE =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    function base64(bytes memory data) internal pure returns (string memory) {
        if (data.length == 0) return "";

        // load the table into memory
        string memory table = TABLE;

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

        // add some extra buffer at the end required for the writing
        string memory result = new string(encodedLen + 32);

        assembly {
            // set the actual output length
            mstore(result, encodedLen)

            // prepare the lookup table
            let tablePtr := add(table, 1)

            // input ptr
            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))

            // result ptr, jump over length
            let resultPtr := add(result, 32)

            // run over the input, 3 bytes at a time
            for {

            } lt(dataPtr, endPtr) {

            } {
                dataPtr := add(dataPtr, 3)

                // read 3 bytes
                let input := mload(dataPtr)

                // write 4 characters
                mstore(
                    resultPtr,
                    shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                )
                resultPtr := add(resultPtr, 1)
                mstore(
                    resultPtr,
                    shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                )
                resultPtr := add(resultPtr, 1)
                mstore(
                    resultPtr,
                    shl(248, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                )
                resultPtr := add(resultPtr, 1)
                mstore(
                    resultPtr,
                    shl(248, mload(add(tablePtr, and(input, 0x3F))))
                )
                resultPtr := add(resultPtr, 1)
            }

            // padding with '='
            switch mod(mload(data), 3)
            case 1 {
                mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
            }
            case 2 {
                mstore(sub(resultPtr, 1), shl(248, 0x3d))
            }
        }

        return result;
    }
}

File 3 of 18 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 4 of 18 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 5 of 18 : Strings.sol
// SPDX-License-Identifier: MIT

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

File 6 of 18 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 7 of 18 : Address.sol
// SPDX-License-Identifier: MIT

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

File 8 of 18 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

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

File 9 of 18 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 10 of 18 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 11 of 18 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 12 of 18 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 13 of 18 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

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

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

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

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

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

        _balances[to] += 1;
        _owners[tokenId] = to;

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

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

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

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 14 of 18 : IERC20.sol
// SPDX-License-Identifier: MIT

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

File 15 of 18 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

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

interface LinkTokenInterface {

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

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

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

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

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

  function increaseApproval(
    address spender,
    uint256 subtractedValue
  ) external;

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

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

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

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

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

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

}

File 17 of 18 : VRFRequestIDBase.sol
// 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));
  }
}

File 18 of 18 : VRFConsumerBase.sol
// 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 constant private 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 immutable internal LINK;
  address immutable private vrfCoordinator;

  // Nonces for each VRF key from which randomness has been requested.
  //
  // Must stay in sync with VRFCoordinator[_keyHash][this]
  mapping(bytes32 /* keyHash */ => uint256 /* 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);
  }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_eggs","type":"address"},{"internalType":"address","name":"_vrf","type":"address"},{"internalType":"address","name":"_link","type":"address"},{"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"address","name":"_metadata","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"FREE_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"allTokensOfOwner","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"isFox","type":"bool"},{"internalType":"string","name":"metadata","type":"string"}],"internalType":"struct FoxHen.TokenWithMetadata[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"amount","type":"uint16"}],"name":"buyWithEggs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"amount","type":"uint16"}],"name":"eggsPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"foxCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"foxes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"amount","type":"uint8"}],"name":"freeMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freeMintsUsed","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isFox","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mainSaleStarted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"mintExtra","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"traitsID","type":"uint256"},{"internalType":"bool","name":"fox","type":"bool"}],"name":"mintL1Token","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"purchased","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"signatureUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stolenMints","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleMainSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"traitsOfToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"traitsTaken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c0604052600c805461ffff191690553480156200001c57600080fd5b5060405162003506380380620035068339810160408190526200003f9162000355565b60408051808201825260068152652337bc2432b760d11b60208083019182528351808501909452600284526108c960f31b908401528151889388939290916200008b9160009162000292565b508051620000a190600190602084019062000292565b505050620000be620000b86200023c60201b60201c565b62000240565b6001600160601b0319606092831b811660a052911b16608052601780546001600160a01b038881166001600160a01b0319928316179092556018805484841692169190911790556019849055601a83905560405163095ea7b360e01b81529085169063095ea7b3906200013a90339060001990600401620003ef565b602060405180830381600087803b1580156200015557600080fd5b505af11580156200016a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001909190620003c4565b6200019a57600080fd5b60175460405163095ea7b360e01b81526001600160a01b039091169063095ea7b390620001d090339060001990600401620003ef565b602060405180830381600087803b158015620001eb57600080fd5b505af115801562000200573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002269190620003c4565b6200023057600080fd5b50505050505062000445565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620002a09062000408565b90600052602060002090601f016020900481019282620002c457600085556200030f565b82601f10620002df57805160ff19168380011785556200030f565b828001600101855582156200030f579182015b828111156200030f578251825591602001919060010190620002f2565b506200031d92915062000321565b5090565b5b808211156200031d576000815560010162000322565b80516001600160a01b03811681146200035057600080fd5b919050565b60008060008060008060c087890312156200036f57600080fd5b6200037a8762000338565b95506200038a6020880162000338565b94506200039a6040880162000338565b93506060870151925060808701519150620003b860a0880162000338565b90509295509295509295565b600060208284031215620003d757600080fd5b81518015158114620003e857600080fd5b9392505050565b6001600160a01b03929092168252602082015260400190565b600181811c908216806200041d57607f821691505b602082108114156200043f57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160601c60a05160601c61308e6200047860003960008181610e5d0152611df401526000611dc5015261308e6000f3fe6080604052600436106101c05760003560e01c806301ffc9a7146101c557806306fdde03146101fa578063081812fc1461021c578063095ea7b31461024957806318160ddd1461026b5780631a2157301461028a57806323b872dd146102a45780632709c7a1146102c45780632748fec8146103065780632f745c59146103265780633c99e2e91461034657806342842e0e146103735780634f6ccce7146103935780636352211e146103b35780636dbc4582146103d357806370a08231146103e9578063715018a6146104095780637decd3d81461041e578063879f9c96146104335780638a8cbf77146104615780638da5cb5b1461048157806394985ddd1461049657806395d89b41146104b65780639edede9f146104cb578063a1b5a556146104e0578063a22cb4651461050d578063b46b254f1461052d578063b82f74e11461054d578063b88d4fde1461057d578063bb10c8291461059d578063bd74e0aa146105d8578063c87b56dd146105f8578063c87c089c14610618578063e079f24f1461062b578063e17bfef11461065b578063e985e9c51461067b578063ec5aa2411461069b578063f2fde38b146106b6578063f47c84c5146106d6575b600080fd5b3480156101d157600080fd5b506101e56101e0366004612946565b6106ec565b60405190151581526020015b60405180910390f35b34801561020657600080fd5b5061020f610717565b6040516101f19190612bc8565b34801561022857600080fd5b5061023c610237366004612a4e565b6107a9565b6040516101f19190612acf565b34801561025557600080fd5b50610269610264366004612895565b610836565b005b34801561027757600080fd5b506008545b6040519081526020016101f1565b34801561029657600080fd5b506013546101e59060ff1681565b3480156102b057600080fd5b506102696102bf3660046127bb565b610947565b3480156102d057600080fd5b506102f46102df36600461276d565b60156020526000908152604090205460ff1681565b60405160ff90911681526020016101f1565b34801561031257600080fd5b5061027c610321366004612a4e565b610978565b34801561033257600080fd5b5061027c610341366004612895565b610999565b34801561035257600080fd5b5061036661036136600461276d565b610a2f565b6040516101f19190612b47565b34801561037f57600080fd5b5061026961038e3660046127bb565b610b39565b34801561039f57600080fd5b5061027c6103ae366004612a4e565b610b54565b3480156103bf57600080fd5b5061023c6103ce366004612a4e565b610be7565b3480156103df57600080fd5b5061027c610bb881565b3480156103f557600080fd5b5061027c61040436600461276d565b610c5e565b34801561041557600080fd5b50610269610ce5565b34801561042a57600080fd5b50600f5461027c565b34801561043f57600080fd5b50600c5461044e9061ffff1681565b60405161ffff90911681526020016101f1565b34801561046d57600080fd5b5061026961047c36600461276d565b610d20565b34801561048d57600080fd5b5061023c610e43565b3480156104a257600080fd5b506102696104b1366004612924565b610e52565b3480156104c257600080fd5b5061020f610ed8565b3480156104d757600080fd5b50610269610ee7565b3480156104ec57600080fd5b5061027c6104fb366004612a4e565b60116020526000908152604090205481565b34801561051957600080fd5b5061026961052836600461285e565b610f2a565b34801561053957600080fd5b50610269610548366004612a2a565b610feb565b34801561055957600080fd5b506101e5610568366004612a4e565b600e6020526000908152604090205460ff1681565b34801561058957600080fd5b506102696105983660046127f7565b611418565b3480156105a957600080fd5b506101e56105b8366004612980565b805160208183018101805160148252928201919093012091525460ff1681565b3480156105e457600080fd5b506102696105f33660046128bf565b611450565b34801561060457600080fd5b5061020f610613366004612a4e565b611624565b610269610626366004612a80565b6116d1565b34801561063757600080fd5b506101e5610646366004612a4e565b60126020526000908152604090205460ff1681565b34801561066757600080fd5b5061027c610676366004612a2a565b6118d8565b34801561068757600080fd5b506101e5610696366004612788565b611963565b3480156106a757600080fd5b5060105461044e9061ffff1681565b3480156106c257600080fd5b506102696106d136600461276d565b611991565b3480156106e257600080fd5b5061027c61271081565b60006001600160e01b0319821663780e9d6360e01b1480610711575061071182611a31565b92915050565b60606000805461072690612eda565b80601f016020809104026020016040519081016040528092919081815260200182805461075290612eda565b801561079f5780601f106107745761010080835404028352916020019161079f565b820191906000526020600020905b81548152906001019060200180831161078257829003601f168201915b5050505050905090565b60006107b482611a81565b61081a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061084182610be7565b9050806001600160a01b0316836001600160a01b031614156108af5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610811565b336001600160a01b03821614806108cb57506108cb8133611963565b6109385760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610811565b6109428383611a9e565b505050565b6109513382611b0c565b61096d5760405162461bcd60e51b815260040161081190612cc7565b610942838383611bd6565b600f818154811061098857600080fd5b600091825260209091200154905081565b60006109a483610c5e565b8210610a065760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610811565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b60606000610a3c83610c5e565b90506000816001600160401b03811115610a5857610a58612fde565b604051908082528060200260200182016040528015610aa557816020015b60408051606080820183526000808352602083015291810191909152815260200190600190039081610a765790505b50905060005b82811015610b31576000610abf8683610999565b90506000610acc82611624565b604080516060810182528481526000858152600e6020908152908390205460ff16151590820152908101829052855191925090859085908110610b1157610b11612fc8565b602002602001018190525050508080610b2990612f37565b915050610aab565b509392505050565b61094283838360405180602001604052806000815250611418565b6000610b5f60085490565b8210610bc25760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610811565b60088281548110610bd557610bd5612fc8565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b0316806107115760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610811565b60006001600160a01b038216610cc95760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610811565b506001600160a01b031660009081526003602052604090205490565b33610cee610e43565b6001600160a01b031614610d145760405162461bcd60e51b815260040161081190612c63565b610d1e6000611d6f565b565b33610d29610e43565b6001600160a01b031614610d4f5760405162461bcd60e51b815260040161081190612c63565b601e6016546001610d609190612dc8565b1115610da25760405162461bcd60e51b815260206004820152601160248201527013585e08195e1d1c985cc81b5a5b9d1959607a1b6044820152606401610811565b60168054906000610db283612f37565b91905055506000601654612710610dc99190612dc8565b90506000610ddb601954601a54611dc1565b604080516060810182526001600160a01b03958616815260208082019586526000828401818152948152600d90915291909120905181546001600160a01b03191695169490941784559151600184015550516002909101805460ff1916911515919091179055565b600a546001600160a01b031690565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610eca5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610811565b610ed48282611f4c565b5050565b60606001805461072690612eda565b33610ef0610e43565b6001600160a01b031614610f165760405162461bcd60e51b815260040161081190612c63565b6013805460ff19811660ff90911615179055565b6001600160a01b038216331415610f7f5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610811565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b601354339060ff1661100f5760405162461bcd60e51b815260040161081190612c2d565b326001600160a01b038216146110375760405162461bcd60e51b815260040161081190612c98565b60008261ffff16118015611050575060148261ffff1611155b6110925760405162461bcd60e51b815260206004820152601360248201527209ac2f040646040dad2dce8e640e0cae440e8f606b1b6044820152606401610811565b600c54610bb861ffff90911610156110e35760405162461bcd60e51b8152602060048201526014602482015273456767732073616c65206e6f742061637469766560601b6044820152606401610811565b600c54612710906110f990849061ffff16612da2565b61ffff16111561111b5760405162461bcd60e51b815260040161081190612d18565b6000611126836118d8565b6111349061ffff8516612e26565b601754604051636eb1769f60e11b81526001600160a01b03858116600483015230602483015292935091169063dd62ed3e9060440160206040518083038186803b15801561118157600080fd5b505afa158015611195573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b99190612a67565b811115801561124757506017546040516370a0823160e01b81526001600160a01b03909116906370a08231906111f3908590600401612acf565b60206040518083038186803b15801561120b57600080fd5b505afa15801561121f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112439190612a67565b8111155b6112925760405162461bcd60e51b815260206004820152601c60248201527b596f75206e65656420746f2073656e6420656e6f756768206567677360201b6044820152606401610811565b600c805461ffff1690849060006112a98385612da2565b825461ffff9182166101009390930a9283029190920219909116179055506017546040516323b872dd60e01b81526001600160a01b03858116600483015230602483015260448201859052909116906323b872dd90606401602060405180830381600087803b15801561131b57600080fd5b505af115801561132f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113539190612907565b61135c57600080fd5b60015b8461ffff168161ffff161161141157600061137e601954601a54611dc1565b90506040518060600160405280866001600160a01b031681526020018361ffff16856113aa9190612dc8565b815260006020918201819052928352600d8152604092839020825181546001600160a01b0319166001600160a01b039091161781559082015160018201559101516002909101805460ff19169115159190911790558061140981612f15565b91505061135f565b5050505050565b6114223383611b0c565b61143e5760405162461bcd60e51b815260040161081190612cc7565b61144a84848484611ffe565b50505050565b33611459610e43565b6001600160a01b03161461147f5760405162461bcd60e51b815260040161081190612c63565b60135460ff16156114d05760405162461bcd60e51b815260206004820152601b60248201527a26b0b4b71029b0b632903430b99030b63932b0b23c903132b3bab760291b6044820152606401610811565b600c5483906114e49061ffff166001612da2565b61ffff16146115295760405162461bcd60e51b8152602060048201526011602482015270125b98dbdc9c9958dd081d1bdad95b9259607a1b6044820152606401610811565b60008281526012602052604090205460ff16156115805760405162461bcd60e51b815260206004820152601560248201527454726169747320616c726561647920696e2075736560581b6044820152606401610811565b600c805461ffff1690600061159483612f15565b91906101000a81548161ffff021916908361ffff1602179055505080156115f1576000838152600e60205260408120805460ff19166001908117909155600f80549182018155909152600080516020613039833981519152018390555b6000828152601260209081526040808320805460ff191660011790558583526011909152902082905561144a8484612031565b6018546000828152600e602090815260408083205460119092528083205481516377153f1960e11b815260ff90931615156004840152602483015260448201859052516060936001600160a01b03169263ee2a7e329260648082019391829003018186803b15801561169557600080fd5b505afa1580156116a9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261071191908101906129b4565b60135460ff166116f35760405162461bcd60e51b815260040161081190612c2d565b3360008181526015602052604090205460059061171490849060ff16612de0565b60ff1611156117645760405162461bcd60e51b815260206004820152601c60248201527b596f752063616e27742066726565206d696e7420616e79206d6f726560201b6044820152606401610811565b326001600160a01b0382161461178c5760405162461bcd60e51b815260040161081190612c98565b600c54610bb8906117a59060ff85169061ffff16612da2565b61ffff1611156117c75760405162461bcd60e51b815260040161081190612d18565b60005b8260ff168160ff161015610942576001600160a01b0382166000908152601560205260408120805460ff16916117ff83612f52565b825460ff9182166101009390930a928302919092021990911617905550600c805461ffff1690600061183083612f15565b91906101000a81548161ffff021916908361ffff16021790555050600061185b601954601a54611dc1565b604080516060810182526001600160a01b038681168252600c5461ffff1660208084019182526000848601818152968152600d90915293909320915182546001600160a01b03191691161781559051600182015590516002909101805460ff191691151591909117905550806118d081612f52565b9150506117ca565b600c54600090610bb8906118f190849061ffff16612da2565b61ffff16101561190057600080fd5b600c54600090610bb89061191990859061ffff16612da2565b6119239190612e74565b90506119316101f482612e05565b61193c906001612da2565b6119539061ffff1668022b1c8c1227a00000612e45565b6001600160481b03169392505050565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b3361199a610e43565b6001600160a01b0316146119c05760405162461bcd60e51b815260040161081190612c63565b6001600160a01b038116611a255760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610811565b611a2e81611d6f565b50565b60006001600160e01b031982166380ac58cd60e01b1480611a6257506001600160e01b03198216635b5e139f60e01b145b8061071157506301ffc9a760e01b6001600160e01b0319831614610711565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611ad382610be7565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611b1782611a81565b611b785760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610811565b6000611b8383610be7565b9050806001600160a01b0316846001600160a01b03161480611bbe5750836001600160a01b0316611bb3846107a9565b6001600160a01b0316145b80611bce5750611bce8185611963565b949350505050565b826001600160a01b0316611be982610be7565b6001600160a01b031614611c515760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610811565b6001600160a01b038216611cb35760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610811565b611cbe83838361215d565b611cc9600082611a9e565b6001600160a01b0383166000908152600360205260408120805460019290611cf2908490612e97565b90915550506001600160a01b0382166000908152600360205260408120805460019290611d20908490612dc8565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915184939187169160008051602061301983398151915291a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001611e31929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401611e5e93929190612b20565b602060405180830381600087803b158015611e7857600080fd5b505af1158015611e8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eb09190612907565b506000838152600b6020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052611f0c906001612dc8565b6000858152600b6020526040902055611bce8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b6000828152600d6020526040902080546001600160a01b0316611f6e57600080fd5b611f7c816001015483612215565b50611f8b8160010154836122a5565b5060018101548154600091611fa9916001600160a01b031685612376565b82549091506001600160a01b03808316911614611ff0576010805461ffff16906000611fd483612f15565b91906101000a81548161ffff021916908361ffff160217905550505b61144a818360010154612031565b612009848484611bd6565b61201584848484612461565b61144a5760405162461bcd60e51b815260040161081190612bdb565b6001600160a01b0382166120875760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610811565b61209081611a81565b156120dc5760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610811565b6120e86000838361215d565b6001600160a01b0382166000908152600360205260408120805460019290612111908490612dc8565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020613019833981519152908290a45050565b6001600160a01b0383166121b8576121b381600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6121db565b816001600160a01b0316836001600160a01b0316146121db576121db838261256b565b6001600160a01b0382166121f25761094281612608565b826001600160a01b0316826001600160a01b0316146109425761094282826126b7565b600080600a83600260405160200161222e929190612d3a565b6040516020818303038152906040528051906020012060001c6122519190612f72565b90508061229b5750506000828152600e60205260408120805460ff19166001908117909155600f805480830182559252600080516020613039833981519152909101839055610711565b5060009392505050565b60008062010000905060008360016040516020016122c4929190612d3a565b60408051601f198184030181529190528051602090910120905060006122ea8383612f72565b90505b60008181526012602052604090205460ff161561234357816001604051602001612318929190612d3a565b60408051601f198184030181529190528051602090910120915061233c8383612f72565b90506122ed565b6000818152601260209081526040808320805460ff19166001179055888352601190915290208190559250505092915050565b6000610bb88411801561238b57506127108411155b80156123cd5750600a8260036040516020016123a8929190612d3a565b6040516020818303038152906040528051906020012060001c6123cb9190612f72565b155b15612457576000600f80805490508460046040516020016123ef929190612d3a565b6040516020818303038152906040528051906020012060001c6124129190612f72565b8154811061242257612422612fc8565b90600052602060002001549050600061243a82610be7565b90506001600160a01b0381161561245457915061245a9050565b50505b50815b9392505050565b60006001600160a01b0384163b1561256357604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906124a5903390899088908890600401612ae3565b602060405180830381600087803b1580156124bf57600080fd5b505af19250505080156124ef575060408051601f3d908101601f191682019092526124ec91810190612963565b60015b612549573d80801561251d576040519150601f19603f3d011682016040523d82523d6000602084013e612522565b606091505b5080516125415760405162461bcd60e51b815260040161081190612bdb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611bce565b506001611bce565b6000600161257884610c5e565b6125829190612e97565b6000838152600760205260409020549091508082146125d5576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061261a90600190612e97565b6000838152600960205260408120546008805493945090928490811061264257612642612fc8565b90600052602060002001549050806008838154811061266357612663612fc8565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061269b5761269b612fb2565b6001900381819060005260206000200160009055905550505050565b60006126c283610c5e565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b80356001600160a01b038116811461271257600080fd5b919050565b600082601f83011261272857600080fd5b813561273b61273682612d7b565b612d4b565b81815284602083860101111561275057600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561277f57600080fd5b61245a826126fb565b6000806040838503121561279b57600080fd5b6127a4836126fb565b91506127b2602084016126fb565b90509250929050565b6000806000606084860312156127d057600080fd5b6127d9846126fb565b92506127e7602085016126fb565b9150604084013590509250925092565b6000806000806080858703121561280d57600080fd5b612816856126fb565b9350612824602086016126fb565b92506040850135915060608501356001600160401b0381111561284657600080fd5b61285287828801612717565b91505092959194509250565b6000806040838503121561287157600080fd5b61287a836126fb565b9150602083013561288a81612ff4565b809150509250929050565b600080604083850312156128a857600080fd5b6128b1836126fb565b946020939093013593505050565b600080600080608085870312156128d557600080fd5b6128de856126fb565b9350602085013592506040850135915060608501356128fc81612ff4565b939692955090935050565b60006020828403121561291957600080fd5b815161245a81612ff4565b6000806040838503121561293757600080fd5b50508035926020909101359150565b60006020828403121561295857600080fd5b813561245a81613002565b60006020828403121561297557600080fd5b815161245a81613002565b60006020828403121561299257600080fd5b81356001600160401b038111156129a857600080fd5b611bce84828501612717565b6000602082840312156129c657600080fd5b81516001600160401b038111156129dc57600080fd5b8201601f810184136129ed57600080fd5b80516129fb61273682612d7b565b818152856020838501011115612a1057600080fd5b612a21826020830160208601612eae565b95945050505050565b600060208284031215612a3c57600080fd5b813561ffff8116811461245a57600080fd5b600060208284031215612a6057600080fd5b5035919050565b600060208284031215612a7957600080fd5b5051919050565b600060208284031215612a9257600080fd5b813560ff8116811461245a57600080fd5b60008151808452612abb816020860160208601612eae565b601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612b1690830184612aa3565b9695505050505050565b60018060a01b0384168152826020820152606060408201526000612a216060830184612aa3565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015612bba57888303603f19018552815180518452878101511515888501528601516060878501819052612ba681860183612aa3565b968901969450505090860190600101612b6e565b509098975050505050505050565b60208152600061245a6020830184612aa3565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252601c908201527b13585a5b8814d85b19481a185cdb89dd081cdd185c9d1959081e595d60221b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526015908201527410dbdb9d1c9858dd1cc81b9bdd08185b1b1bddd959605a1b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526008908201526714dbdb19081bdd5d60c21b604082015260600190565b91825260ff16602082015260400190565b604051601f8201601f191681016001600160401b0381118282101715612d7357612d73612fde565b604052919050565b60006001600160401b03821115612d9457612d94612fde565b50601f01601f191660200190565b600061ffff808316818516808303821115612dbf57612dbf612f86565b01949350505050565b60008219821115612ddb57612ddb612f86565b500190565b600060ff821660ff84168060ff03821115612dfd57612dfd612f86565b019392505050565b600061ffff80841680612e1a57612e1a612f9c565b92169190910492915050565b6000816000190483118215151615612e4057612e40612f86565b500290565b60006001600160481b0382811684821681151582840482111615612e6b57612e6b612f86565b02949350505050565b600061ffff83811690831681811015612e8f57612e8f612f86565b039392505050565b600082821015612ea957612ea9612f86565b500390565b60005b83811015612ec9578181015183820152602001612eb1565b8381111561144a5750506000910152565b600181811c90821680612eee57607f821691505b60208210811415612f0f57634e487b7160e01b600052602260045260246000fd5b50919050565b600061ffff80831681811415612f2d57612f2d612f86565b6001019392505050565b6000600019821415612f4b57612f4b612f86565b5060010190565b600060ff821660ff811415612f6957612f69612f86565b60010192915050565b600082612f8157612f81612f9c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114611a2e57600080fd5b6001600160e01b031981168114611a2e57600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802a2646970667358221220d310c8bf01f20ae03a49492a7ae539afb4f1084102c9d52d682e3b2824816f6f64736f6c634300080700330000000000000000000000004ac6e3cda66967f1286da690129a33638f9e70880000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae0000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f1f86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da00000000000000000000000000000000000000000000000000005af3107a4000000000000000000000000000ffd7d5b6877310f65e356f095f5f0bc2d5cc20e9

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

0000000000000000000000004ac6e3cda66967f1286da690129a33638f9e70880000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae0000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f1f86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da00000000000000000000000000000000000000000000000000005af3107a4000000000000000000000000000ffd7d5b6877310f65e356f095f5f0bc2d5cc20e9

-----Decoded View---------------
Arg [0] : _eggs (address): 0x4ac6e3cda66967f1286da690129a33638f9e7088
Arg [1] : _vrf (address): 0x3d2341adb2d31f1c5530cdc622016af293177ae0
Arg [2] : _link (address): 0xb0897686c545045afc77cf20ec7a532e3120e0f1
Arg [3] : _keyHash (bytes32): 0xf86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da
Arg [4] : _fee (uint256): 100000000000000
Arg [5] : _metadata (address): 0xffd7d5b6877310f65e356f095f5f0bc2d5cc20e9

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000004ac6e3cda66967f1286da690129a33638f9e7088
Arg [1] : 0000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae0
Arg [2] : 000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f1
Arg [3] : f86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da
Arg [4] : 00000000000000000000000000000000000000000000000000005af3107a4000
Arg [5] : 000000000000000000000000ffd7d5b6877310f65e356f095f5f0bc2d5cc20e9


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