Contract 0x654def7daa4e51c940ef664c7ab27fb4c257970a 2

 

Contract Overview

Balance:
0.00000518264937089 MATIC

MATIC Value:
Less Than $0.01 (@ $1.83/MATIC)

Token:
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x9e76a709baa21e59cf57c9d4e0354bb3c18de64b3254ca87b5914ce7fa3dad15Claim Many Hen R...239903642022-01-21 14:57:5723 mins ago0xf9c8626513055ab13181ae09c67648cbf9f91b8c IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.044104439834 364.36700567
0x66057ad8b7ab89bb0914ccc7556363a3ad27e89314f157bf40423e9ed1f8de72Multi Stake Hen239903382022-01-21 14:57:0524 mins ago0xf9c8626513055ab13181ae09c67648cbf9f91b8c IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.095237016677 539.421461297
0xc5ec17930e8075a8f2f5de122cb16d37f03b4f6879b34df8a0339e5343e14c24Claim Many Hen R...239896342022-01-21 14:28:3953 mins ago0x928f781bceda01bc783783026dc2c1f3742f157f IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.226267987754 329.667077662
0x4b5fcc9bd36562a6bb37c759e0fbd5eea9eeb99d13184c0e108d3d7dc150b9e5Multi Stake Hen239886512022-01-21 13:50:271 hr 31 mins ago0xd626db223ba553a11ba040c37694e8797de8a860 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.069726398846 394.929590078
0xb7639186052e01730b7dd527fce27dbd6e2885f80a8676dd1b4721890d008a40Claim Many Hen R...239886152022-01-21 13:49:151 hr 32 mins ago0xd626db223ba553a11ba040c37694e8797de8a860 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.057232500649 436.6593218
0xa5ba52312b58e233fd8388d37f4efa9fc730ec517625c80a2789b76ecf70159cClaim Many Hen R...239881472022-01-21 13:30:591 hr 50 mins ago0xc54d089e9848a82612821f8c67eb5bf7325f0e1c IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.099642480174 291.457956027
0x1b036df9cd09b3898b2e695bf3e390436f4b2a646093c9cc7a0ef4335a39cd9bClaim Many Hen R...239865532022-01-21 12:31:352 hrs 50 mins ago0x0fe9c73e1d53dd972b9ef03fc07d85751393a3e7 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.114558530251 206.347445304
0x6044945995e36add2c37c7360d3cf6a41356fa6f1102dfa862d5f18454fd256fClaim Many Hen R...239863862022-01-21 12:25:532 hrs 55 mins ago0xf8ca5153e449f6b9ead12bca09fc90f1b627e913 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.068130362583338.69247694
0x7fdd2059970beba0c3f0b6db246533e10f91556101a8ee215efd563589ff5083Claim Many Hen R...239857642022-01-21 12:02:413 hrs 18 mins ago0xeec47149bfec7c69f8379d59967a4496597ec8da IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.02074829838149.429588621
0x0db3d32a1a230c626669d7c95b25762ba1cdf04e0f3a68c265e2581be288df29Claim Many Hen R...239855952022-01-21 11:54:233 hrs 27 mins ago0x8b5b5951cdb0e6cc68b60b405b31aa7f551d00a6 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.005920701994 45.077139724
0xdda3ee0edd9e39954cd5e676306d349ac9b08e734f8c9000491e1806314b6914Claim Many Hen R...239851892022-01-21 11:40:203 hrs 41 mins ago0x858fa85aa7282544f41f242bd06207b2fd389e36 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.108275338608 85.169996192
0x0988f97c15bde1709ff4611d2228e57ca7ff89eec5ca70b85f115add9c287107Claim Many Hen R...239848762022-01-21 11:29:303 hrs 52 mins ago0x89a3ea664c4009196e1b098c0c369bbfe953e9b8 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.05690106391150.65039942
0xd28ff4b62b828b85e71b0874100d373380b0c98e79cd67208a9242aa03a7d24dClaim Many Hen R...239810282022-01-21 9:06:116 hrs 15 mins ago0x5c9b93f49eae52a183c490c84588dff0933c4624 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.006928065591 49.896043154
0x43b302c7e3c9b85e27bd57aa9e4e6111cf588a17efb6e708b4776dbc58a80306Multi Stake Hen239806292022-01-21 8:52:206 hrs 29 mins ago0x516ea7a2ba0306adef2db9889fe0047b98853956 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.00230308486 70.147565188
0x841c3baaaab9321a934d1aba63e5fe31b5a4318e4ebddb2b3b7dd19ed1d2c674Multi Stake Hen239806272022-01-21 8:52:166 hrs 29 mins ago0x516ea7a2ba0306adef2db9889fe0047b98853956 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.01282562551 72.644208064
0xb82ce01aafb739a8e05ddae2daf09a01679d3964170ced38814e76c0d589bb18Claim Many Hen R...239805972022-01-21 8:51:126 hrs 30 mins ago0x79202a395465b26426c8046cc1a6b813e28c4ac6 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.032494487508 53.084985524
0x957c34d0ad3bd47cfa96c134c4679fde0d02d27ddf0edd4ae8456b38109c6f50Claim Many Hen R...239805692022-01-21 8:50:166 hrs 31 mins ago0x516ea7a2ba0306adef2db9889fe0047b98853956 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.009810501099 74.849896615
0x1d1f82bb209d2a88163822584000a924005ecfeea81dff8e7a2000376f6a8183Claim Many Hen R...239803442022-01-21 8:42:306 hrs 39 mins ago0xe5e1deed199ad47d8e6544fc9330f18d88a0a39b IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.24852572374566.868513449
0x88b03677d410b2fbe678e5819f3f37e44de5b7efaf7a1d657e9b4e39dceff2e4Claim Many Hen R...239801932022-01-21 8:37:206 hrs 44 mins ago0xeec354e73c14850b12011a5efdd0929102457b55 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.028425030435 71.221042909
0xffd486709db2219ec5b830f1143a376507dcbfe960f6d89334600a262a9ab451Claim Many Hen R...239796222022-01-21 8:17:357 hrs 4 mins ago0xe1a752e18d9cb007630ec0d0833ad249a7e557bf IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.00900336522668.691797654
0x1fbe8b4d3446849163b3db20a3dcfc7bc9539461d76588e62dd5116cfde87604Claim Many Hen R...239785912022-01-21 7:41:307 hrs 40 mins ago0xd86219214f2403214484e5d228d1f4d2e5eef7ba IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.017355432951 59.936845826
0x7b41dff174155861bd12e8a9c087a14a023f0354002d5a61bceef0533ce6ace5Multi Stake Hen239785332022-01-21 7:39:307 hrs 42 mins ago0xd86219214f2403214484e5d228d1f4d2e5eef7ba IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.03785815773 80.412058
0x89f1c7b9184468485da30d249c3f1a212e557d3b843c853099f8e05885954dfbClaim Many Hen R...239778592022-01-21 7:16:228 hrs 5 mins ago0xf16667b721e0bc2ccfc112d1c04d844fa07c53ca IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.010504432948 79.975278642
0xe50c4daa647ff2d79077570da90ce5cf86803a13a2dfbb3108bd10d2c96bd6bcClaim Many Hen R...239778352022-01-21 7:15:308 hrs 6 mins ago0xa8aa728cd8c04041658b0c2036d222df1bcb7c11 IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.009840661857 74.921671445
0xaf106da6b274db7ea99af57bb72978f3da229fafe1340413b30a2e0af9599dd5Claim Many Hen R...239777982022-01-21 7:14:168 hrs 7 mins ago0xb02085504d80720fc4eefc44f9ad09cecd553e9c IN  0x654def7daa4e51c940ef664c7ab27fb4c257970a0 MATIC0.009342809178 71.131280572
[ Download CSV Export 
Latest 3 internal transactions
Parent Txn Hash Block From To Value
0x7eb272a0077b5cb5835b490271af1edf99bdd0c7ca8e0cad472d929e6cfe3d5f224383532021-12-12 13:51:0140 days 1 hr ago 0x654def7daa4e51c940ef664c7ab27fb4c257970a0x374ac6d99a2291347e5bd74df715460d97995d795.1197 MATIC
0x1691d4ba16911b6ea93c2c0e9a7d25d18a30061d056171837d2c4325090fe5a3223788362021-12-11 1:36:3541 days 13 hrs ago 0x654def7daa4e51c940ef664c7ab27fb4c257970a0x374ac6d99a2291347e5bd74df715460d97995d79228 MATIC
0xdb4f0e6c4b908c1d61368c03fee74c758f5ac5dcf67a54c6154ed71fada7a528223327522021-12-09 21:53:0442 days 17 hrs ago 0x654def7daa4e51c940ef664c7ab27fb4c257970a0x374ac6d99a2291347e5bd74df715460d97995d792.3 MATIC
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
HenHouse

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 20 : HenHouse.sol
// SPDX-License-Identifier: MIT LICENSE

pragma solidity ^0.8.0;

import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorInterface.sol";
import "./FoxHen.sol";

contract HenHouse is Ownable, VRFConsumerBase {
    FoxHen fh;
    IERC20 eggs;
    IERC20 weth;
    AggregatorInterface ethFeed;
    AggregatorInterface maticFeed;
    uint256[] public heistPrices = [5 * 10 ** 8, 10 * 10 ** 8, 20 * 10 ** 8, 40 * 10 ** 8, 80 * 10 ** 8];
    struct Staking {
        uint256 timestamp;
        address owner;
        uint16 stolen;
    }

    struct CurrentValue {
        uint256 tokenId;
        uint256 timestamp;
        uint256 value;
        string metadata;
    }

    struct Fox {
        uint256 timestamp;
        uint256 dailyCount;
        uint256 foxValue;
    }

    mapping(uint256 => Staking) public stakings;
    mapping(address => uint256[]) public stakingsByOwner;

    uint256 public foxValue;
    uint256 public foxCount;
    uint256 public eggsHeistedAmount;
    uint256 public heistAmount;
    uint256 public totalTaxAmount;
    mapping(uint256 => Fox) public foxes;
    mapping(bytes32 => uint256) heists;

    uint16 public taxPercentage = 15;
    uint16 public heistPercentage = 30;
    uint16 public taxFreeDays = 3;

    bytes32 internal keyHash;
    uint256 internal fee;

    bool public paused;

    event Heist(
        address indexed owner,
        uint256 indexed fox,
        uint256 hen,
        uint256 amount
    );

    constructor(
        address _fh,
        address _eggs,
        address _vrf,
        address _link,
        address _ethFeed,
        address _maticFeed,
        bytes32 _keyHash,
        uint256 _fee,
        address _weth
    ) VRFConsumerBase(_vrf, _link) {
        fh = FoxHen(_fh);
        eggs = IERC20(_eggs);
        weth = IERC20(_weth);
        ethFeed = AggregatorInterface(_ethFeed);
        maticFeed = AggregatorInterface(_maticFeed);
        IERC20(_link).approve(msg.sender, type(uint256).max);
        weth.approve(msg.sender, type(uint256).max);
        keyHash = _keyHash;
        fee = _fee;
    }

    // Reads
    function daysStaked(uint256 tokenId) public view returns (uint256) {
        Staking storage staking = stakings[tokenId];
        uint256 diff = block.timestamp - staking.timestamp;
        return uint256(diff) / 1 days;
    }

    function calculateReward(uint256 tokenId) public view returns (uint256) {
        require(fh.ownerOf(tokenId) == address(this), "The hen must be staked");
        uint256 balance = eggs.balanceOf(address(this));
        Staking storage staking = stakings[tokenId];
        uint256 baseReward = 100000 ether / uint256(1 days);
        uint256 diff = block.timestamp - staking.timestamp;
        uint256 dayCount = uint256(diff) / (1 days);
        if (dayCount < 1 || balance == 0) {
            return 0;
        }
        uint256 yesterday = dayCount - 1;
        uint256 dayRewards = (yesterday * yesterday + yesterday) / 2 + 10 * dayCount;
        uint256 ratio = (((dayRewards / dayCount) * (diff - dayCount * 1 days)) / 1 days) + dayRewards;
        uint256 reward = baseReward * ratio;
        return reward < balance ? reward : balance;
    }

    function tokenOfOwnerByIndex(address owner, uint256 index)
        public
        view
        returns (uint256)
    {
        return stakingsByOwner[owner][index];
    }

    function balanceOf(address owner) public view returns (uint256) {
        return stakingsByOwner[owner].length;
    }

    function allStakingsOfOwner(address owner)
        public
        view
        returns (CurrentValue[] memory)
    {
        uint256 balance = balanceOf(owner);
        CurrentValue[] memory list = new CurrentValue[](balance);
        for (uint16 i = 0; i < balance; i++) {
            uint256 tokenId = tokenOfOwnerByIndex(owner, i);
            Staking storage staking = stakings[tokenId];
            uint256 reward = calculateReward(tokenId) - staking.stolen;
            string memory metadata = fh.tokenURI(tokenId);
            list[i] = CurrentValue(tokenId, staking.timestamp, reward, metadata);
        }
        return list;
    }

    function batchFoxInfo(uint256[] memory foxIds) public view returns (Fox[] memory) {
        Fox[] memory info = new Fox[](foxIds.length);
        for (uint16 i = 0; i < foxIds.length; i++) {
            info[i] = foxes[foxIds[i]];
        }
        return info;
    }

    function ETHPrice(uint256 price) public view returns (uint256) {
        uint256 v = uint256(ethFeed.latestAnswer()); // Get real value
        return 1 ether * price / v;
    }

    function MATICPrice(uint256 price) public view returns (uint256) {
        uint256 v = uint256(maticFeed.latestAnswer()); // Get real value
        return 1 ether * price / v;
    }

    function heistCost(uint256 tokenId) public view returns (uint256) {
        Fox storage fox = foxes[tokenId];
        uint256 diff = block.timestamp - fox.timestamp;
        uint256 exp = diff > 1 days ? 0 : fox.dailyCount;
        return heistPrices[exp];
    }

    // Staking
    function stakeHen(uint256 tokenId) public {
        require(!paused, "Contract paused");
        require(fh.ownerOf(tokenId) == msg.sender, "You must own that hen");
        require(!fh.isFox(tokenId), "You can only stake hens");
        require(fh.isApprovedForAll(msg.sender, address(this)));

        Staking memory staking = Staking(block.timestamp, msg.sender, 0);
        stakings[tokenId] = staking;
        stakingsByOwner[msg.sender].push(tokenId);
        fh.transferFrom(msg.sender, address(this), tokenId);
    }

    function multiStakeHen(uint256[] memory henIds) public {
        for (uint8 i = 0; i < henIds.length; i++) {
            stakeHen(henIds[i]);
        }
    }

    function unstakeHen(uint256 tokenId) public {
        require(fh.ownerOf(tokenId) == address(this), "The hen must be staked");
        Staking storage staking = stakings[tokenId];
        require(staking.owner == msg.sender, "You must own that hen");
        uint256[] storage stakedHens = stakingsByOwner[msg.sender];
        uint16 index = 0;
        for (; index < stakedHens.length; index++) {
            if (stakedHens[index] == tokenId) {
                break;
            }
        }
        require(index < stakedHens.length, "Hen not found");
        stakedHens[index] = stakedHens[stakedHens.length - 1];
        stakedHens.pop();
        staking.owner = address(0);
        fh.transferFrom(address(this), msg.sender, tokenId);
    }

    function claimHenRewards(uint256 tokenId, bool unstake) public {
        require(!paused, "Contract paused");
        uint256 netRewards = _claimHenRewards(tokenId);
        if (unstake) {
            unstakeHen(tokenId);
        }
        if (netRewards > 0) {
            require(eggs.transfer(msg.sender, netRewards));
        }
    }

    function claimManyHenRewards(uint256[] calldata hens, bool unstake) public {
        require(!paused, "Contract paused");
        uint256 netRewards = 0;
        for (uint8 i = 0; i < hens.length; i++) {
            netRewards += _claimHenRewards(hens[i]);
        }
        if (netRewards > 0) {
            require(eggs.transfer(msg.sender, netRewards));
        }
        if (unstake) {
            for (uint8 i = 0; i < hens.length; i++) {
                unstakeHen(hens[i]);
            }
        }
    }

    function claimManyFoxesRewards(uint256[] calldata claimingFoxes) public {
        for (uint8 i = 0; i < claimingFoxes.length; i++) {
            heist(claimingFoxes[i], false);
        }
    }

    // Heists
    function heist(uint256 tokenId, bool enterHenHouse) public payable {
        require(!paused, "Contract paused");
        require(
            fh.ownerOf(tokenId) == msg.sender && fh.isFox(tokenId),
            "You must own that fox"
        );
        Fox storage fox = foxes[tokenId];

        if (fox.timestamp == 0) {
            fox.timestamp = block.timestamp;
            fox.foxValue = foxValue;
            foxCount++;
        }

        if (enterHenHouse) {
            require(fox.dailyCount < heistPrices.length, "You can heist a maximum of 5 times per day");
            uint256 cost = heistCost(tokenId);
            if (msg.value > 0) {
                uint256 maticCost = MATICPrice(cost);
                require(msg.value >= maticCost, "You must pay the correct amount of MATIC");
            } else {
                uint256 allowance = weth.allowance(msg.sender, address(this));
                uint256 balance = weth.balanceOf(msg.sender);
                uint256 ethCost = ETHPrice(cost);
                require(allowance >= ethCost && balance >= ethCost, "You must pay the correct amount of ETH");
                weth.transferFrom(msg.sender, address(this), ethCost);
            }

            uint256 diff = block.timestamp - fox.timestamp;
            if (diff > 1 days) {
                fox.timestamp = block.timestamp;
                fox.dailyCount = 1;
            } else {
                fox.dailyCount++;
            }

            heistAmount++;
            bytes32 requestId = requestRandomness(keyHash, fee);
            heists[requestId] = tokenId;
        }

        if (fox.foxValue < foxValue) {
            uint256 tax = foxValue - fox.foxValue;
            fox.foxValue = foxValue;
            totalTaxAmount += tax;
            eggs.transfer(msg.sender, tax);
        }
    }

    // Internal
    function fulfillRandomness(bytes32 requestId, uint256 randomness)
        internal
        override
    {
        uint256 foxId = heists[requestId];
        address foxOwner = fh.ownerOf(foxId);
        require(foxOwner != address(0));
        uint256 henIndex = randomness % fh.balanceOf(address(this));
        uint256 henId = fh.tokenOfOwnerByIndex(address(this), henIndex);
        Staking storage staking = stakings[henId];

        uint256 rewards = calculateReward(henId) - staking.stolen;
        uint256 stealAmount = (heistPercentage * rewards) / 100;

        if (stealAmount > 0) {
            eggsHeistedAmount += stealAmount;
            eggs.transfer(foxOwner, stealAmount);
        }
        emit Heist(foxOwner, foxId, henId, stealAmount);
    }

    function _claimHenRewards(uint256 tokenId) internal returns (uint256) {
        require(fh.ownerOf(tokenId) == address(this), "The hen must be staked");
        Staking storage staking = stakings[tokenId];
        require(staking.owner == msg.sender, "You must own that hen");

        uint256 rewards = calculateReward(tokenId);
        require(rewards >= staking.stolen, "You have no rewards at this time");
        rewards -= staking.stolen;

        uint256 tax = foxCount == 0 || daysStaked(tokenId) >= taxFreeDays
            ? 0
            : (taxPercentage * rewards) / 100;
        uint256 netRewards = rewards - tax;

        if (foxCount > 0 && tax > 0) {
            foxValue += tax / foxCount;
        }

        staking.stolen = 0;
        staking.timestamp = block.timestamp;

        return netRewards;
    }

    // Admin
    function withdraw(uint256 amount) external onlyOwner {
        payable(owner()).transfer(amount);
    }

    function togglePause() external onlyOwner {
        paused = !paused;
    }

    function setHeistPrice(uint8 index, uint256 price) external onlyOwner {
        require(index < heistPrices.length, "Incorrect index");
        heistPrices[index] = price;
    }
}

File 2 of 20 : 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 20 : 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 4 of 20 : 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 5 of 20 : 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 6 of 20 : 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 7 of 20 : 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 8 of 20 : 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 9 of 20 : 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 10 of 20 : 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 11 of 20 : 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 12 of 20 : 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 13 of 20 : 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 14 of 20 : 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 15 of 20 : 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 16 of 20 : 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 17 of 20 : 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 18 of 20 : AggregatorInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorInterface {
  function latestAnswer()
    external
    view
    returns (
      int256
    );
  
  function latestTimestamp()
    external
    view
    returns (
      uint256
    );

  function latestRound()
    external
    view
    returns (
      uint256
    );

  function getAnswer(
    uint256 roundId
  )
    external
    view
    returns (
      int256
    );

  function getTimestamp(
    uint256 roundId
  )
    external
    view
    returns (
      uint256
    );

  event AnswerUpdated(
    int256 indexed current,
    uint256 indexed roundId,
    uint256 updatedAt
  );

  event NewRound(
    uint256 indexed roundId,
    address indexed startedBy,
    uint256 startedAt
  );
}

File 19 of 20 : 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 20 of 20 : 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":"_fh","type":"address"},{"internalType":"address","name":"_eggs","type":"address"},{"internalType":"address","name":"_vrf","type":"address"},{"internalType":"address","name":"_link","type":"address"},{"internalType":"address","name":"_ethFeed","type":"address"},{"internalType":"address","name":"_maticFeed","type":"address"},{"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"fox","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"hen","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Heist","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"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"ETHPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"MATICPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"allStakingsOfOwner","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"string","name":"metadata","type":"string"}],"internalType":"struct HenHouse.CurrentValue[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"foxIds","type":"uint256[]"}],"name":"batchFoxInfo","outputs":[{"components":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"dailyCount","type":"uint256"},{"internalType":"uint256","name":"foxValue","type":"uint256"}],"internalType":"struct HenHouse.Fox[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"calculateReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"unstake","type":"bool"}],"name":"claimHenRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"claimingFoxes","type":"uint256[]"}],"name":"claimManyFoxesRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"hens","type":"uint256[]"},{"internalType":"bool","name":"unstake","type":"bool"}],"name":"claimManyHenRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"daysStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eggsHeistedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"foxCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"foxValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"foxes","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"dailyCount","type":"uint256"},{"internalType":"uint256","name":"foxValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"enterHenHouse","type":"bool"}],"name":"heist","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"heistAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"heistCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"heistPercentage","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"heistPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"henIds","type":"uint256[]"}],"name":"multiStakeHen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setHeistPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stakeHen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakings","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint16","name":"stolen","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakingsByOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxFreeDays","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxPercentage","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"togglePause","outputs":[],"stateMutability":"nonpayable","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":[],"name":"totalTaxAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unstakeHen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

610160604052631dcd650060c0908152633b9aca0060e05263773594006101005263ee6b2800610120526401dcd65000610140526200004390600790600562000278565b506011805465ffffffffffff19166403001e000f1790553480156200006757600080fd5b50604051620031bd380380620031bd8339810160408190526200008a9162000305565b8686620000973362000228565b606091821b6001600160601b031990811660a052911b16608052600280546001600160a01b03199081166001600160a01b038c8116919091179092556003805482168b8416179055600480548216848416178155600580548316898516179055600680549092168784161790915560405163095ea7b360e01b81529188169163095ea7b3916200012e9133916000199101620003d9565b602060405180830381600087803b1580156200014957600080fd5b505af11580156200015e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001849190620003ae565b506004805460405163095ea7b360e01b81526001600160a01b039091169163095ea7b391620001ba9133916000199101620003d9565b602060405180830381600087803b158015620001d557600080fd5b505af1158015620001ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002109190620003ae565b505060129190915560135550620003f2945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054828255906000526020600020908101928215620002bf579160200282015b82811115620002bf578251829064ffffffffff1690559160200191906001019062000299565b50620002cd929150620002d1565b5090565b5b80821115620002cd5760008155600101620002d2565b80516001600160a01b03811681146200030057600080fd5b919050565b60008060008060008060008060006101208a8c0312156200032557600080fd5b620003308a620002e8565b98506200034060208b01620002e8565b97506200035060408b01620002e8565b96506200036060608b01620002e8565b95506200037060808b01620002e8565b94506200038060a08b01620002e8565b935060c08a0151925060e08a015191506200039f6101008b01620002e8565b90509295985092959850929598565b600060208284031215620003c157600080fd5b81518015158114620003d257600080fd5b9392505050565b6001600160a01b03929092168252602082015260400190565b60805160601c60a05160601c612d9862000425600039600081816117670152611ef801526000611ec90152612d986000f3fe60806040526004361061019f5760003560e01c80631e0b0959146101a45780632390f258146101c6578063253ac986146101e65780632748fec81461021c5780632e1a7d4d146102735780632f745c59146102935780633ab952a6146102c15780635420b4b1146102e15780635c975abb146102f757806363caf9531461032157806370a0823114610334578063715018a614610354578063746a88f91461036957806374e673c0146103895780637acc9e29146103a95780637ca1682d146103c95780637d9dfe94146103df5780637decd3d8146103ff5780638a861b24146104155780638b50db25146104355780638da5cb5b1461046a57806392e474171461048c578063943fb1a4146104ac57806394985ddd146104d9578063a67cb62c146104f9578063a77edd5e14610519578063ae7b6d1614610539578063c4ae316814610554578063c4f0c1fc14610569578063c5994afb146105da578063ce577f8d146105fb578063d2d7231f1461061b578063d7384d831461063b578063dfb1e43d14610651578063ef45795014610667578063f2fde38b14610687575b600080fd5b3480156101b057600080fd5b506101c46101bf3660046128f6565b6106a7565b005b3480156101d257600080fd5b506101c46101e136600461267f565b61074c565b3480156101f257600080fd5b50610206610201366004612716565b610797565b6040516102139190612a6c565b60405180910390f35b34801561022857600080fd5b506102586102373660046128ad565b600f6020526000908152604090208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610213565b34801561027f57600080fd5b506101c461028e3660046128ad565b6108b0565b34801561029f57600080fd5b506102b36102ae366004612653565b610923565b604051908152602001610213565b3480156102cd57600080fd5b506102b36102dc366004612653565b610960565b3480156102ed57600080fd5b506102b3600e5481565b34801561030357600080fd5b506014546103119060ff1681565b6040519015158152602001610213565b6101c461032f3660046128c6565b610991565b34801561034057600080fd5b506102b361034f366004612619565b610f61565b34801561036057600080fd5b506101c4610f7c565b34801561037557600080fd5b506102b36103843660046128ad565b610fb7565b34801561039557600080fd5b506101c46103a4366004612716565b611066565b3480156103b557600080fd5b506101c46103c43660046128ad565b6110ac565b3480156103d557600080fd5b506102b3600d5481565b3480156103eb57600080fd5b506101c46103fa3660046126c0565b611398565b34801561040b57600080fd5b506102b3600b5481565b34801561042157600080fd5b506102b36104303660046128ad565b6114f0565b34801561044157600080fd5b5060115461045790600160201b900461ffff1681565b60405161ffff9091168152602001610213565b34801561047657600080fd5b5061047f611551565b6040516102139190612946565b34801561049857600080fd5b506102b36104a73660046128ad565b611560565b3480156104b857600080fd5b506104cc6104c7366004612619565b611593565b60405161021391906129e1565b3480156104e557600080fd5b506101c46104f43660046127df565b61175c565b34801561050557600080fd5b506102b36105143660046128ad565b6117de565b34801561052557600080fd5b506101c46105343660046128c6565b6117ff565b34801561054557600080fd5b506011546104579061ffff1681565b34801561056057600080fd5b506101c46118d1565b34801561057557600080fd5b506105b36105843660046128ad565b600860205260009081526040902080546001909101546001600160a01b03811690600160a01b900461ffff1683565b604080519384526001600160a01b03909216602084015261ffff1690820152606001610213565b3480156105e657600080fd5b506011546104579062010000900461ffff1681565b34801561060757600080fd5b506102b36106163660046128ad565b611914565b34801561062757600080fd5b506102b36106363660046128ad565b611965565b34801561064757600080fd5b506102b3600a5481565b34801561065d57600080fd5b506102b3600c5481565b34801561067357600080fd5b506101c46106823660046128ad565b611bb3565b34801561069357600080fd5b506101c46106a2366004612619565b611e25565b336106b0611551565b6001600160a01b0316146106df5760405162461bcd60e51b81526004016106d690612b1d565b60405180910390fd5b60075460ff8316106107255760405162461bcd60e51b815260206004820152600f60248201526e092dcc6dee4e4cac6e840d2dcc8caf608b1b60448201526064016106d6565b8060078360ff168154811061073c5761073c612cf3565b6000918252602090912001555050565b60005b60ff81168211156107925761078083838360ff1681811061077257610772612cf3565b905060200201356000610991565b8061078a81612c7d565b91505061074f565b505050565b6060600082516001600160401b038111156107b4576107b4612d09565b60405190808252806020026020018201604052801561080957816020015b6107f660405180606001604052806000815260200160008152602001600081525090565b8152602001906001900390816107d25790505b50905060005b83518161ffff1610156108a957600f6000858361ffff168151811061083657610836612cf3565b602002602001015181526020019081526020016000206040518060600160405290816000820154815260200160018201548152602001600282015481525050828261ffff168151811061088b5761088b612cf3565b602002602001018190525080806108a190612c40565b91505061080f565b5092915050565b336108b9611551565b6001600160a01b0316146108df5760405162461bcd60e51b81526004016106d690612b1d565b6108e7611551565b6001600160a01b03166108fc829081150290604051600060405180830381858888f1935050505015801561091f573d6000803e3d6000fd5b5050565b6001600160a01b038216600090815260096020526040812080548390811061094d5761094d612cf3565b9060005260206000200154905092915050565b6009602052816000526040600020818154811061097c57600080fd5b90600052602060002001600091509150505481565b60145460ff16156109b45760405162461bcd60e51b81526004016106d690612af4565b6002546040516331a9108f60e11b81526004810184905233916001600160a01b031690636352211e9060240160206040518083038186803b1580156109f857600080fd5b505afa158015610a0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a309190612636565b6001600160a01b0316148015610abd575060025460405163b82f74e160e01b8152600481018490526001600160a01b039091169063b82f74e19060240160206040518083038186803b158015610a8557600080fd5b505afa158015610a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abd91906127c2565b610b015760405162461bcd60e51b81526020600482015260156024820152740b2deea40daeae6e840deeedc40e8d0c2e840ccdef605b1b60448201526064016106d6565b6000828152600f602052604090208054610b3657428155600a546002820155600b8054906000610b3083612c62565b91905055505b8115610e9057600754600182015410610ba45760405162461bcd60e51b815260206004820152602a60248201527f596f752063616e2068656973742061206d6178696d756d206f6620352074696d6044820152696573207065722064617960b01b60648201526084016106d6565b6000610baf846114f0565b90503415610c19576000610bc282611914565b905080341015610c135760405162461bcd60e51b81526020600482015260286024820152600080516020612d438339815191526044820152676f66204d4154494360c01b60648201526084016106d6565b50610e14565b60048054604051636eb1769f60e11b81526000926001600160a01b039092169163dd62ed3e91610c4d91339130910161295a565b60206040518083038186803b158015610c6557600080fd5b505afa158015610c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9d9190612801565b600480546040516370a0823160e01b81529293506000926001600160a01b03909116916370a0823191610cd291339101612946565b60206040518083038186803b158015610cea57600080fd5b505afa158015610cfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d229190612801565b90506000610d2f84610fb7565b9050808310158015610d415750808210155b610d8a5760405162461bcd60e51b81526020600482015260266024820152600080516020612d438339815191526044820152650decc408aa8960d31b60648201526084016106d6565b600480546040516323b872dd60e01b81526001600160a01b03909116916323b872dd91610dbd9133913091879101612974565b602060405180830381600087803b158015610dd757600080fd5b505af1158015610deb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0f91906127c2565b505050505b8154600090610e239042612bfd565b905062015180811115610e3e57428355600180840155610e56565b600183018054906000610e5083612c62565b91905055505b600d8054906000610e6683612c62565b91905055506000610e7b601254601354611ec5565b60009081526010602052604090208690555050505b600a54816002015410156107925760008160020154600a54610eb29190612bfd565b9050600a54826002018190555080600e6000828254610ed19190612bb2565b909155505060035460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90610f089033908590600401612998565b602060405180830381600087803b158015610f2257600080fd5b505af1158015610f36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5a91906127c2565b5050505050565b6001600160a01b031660009081526009602052604090205490565b33610f85611551565b6001600160a01b031614610fab5760405162461bcd60e51b81526004016106d690612b1d565b610fb5600061204f565b565b600080600560009054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561100857600080fd5b505afa15801561101c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110409190612801565b90508061105584670de0b6b3a7640000612bde565b61105f9190612bca565b9392505050565b60005b81518160ff16101561091f5761109a828260ff168151811061108d5761108d612cf3565b60200260200101516110ac565b806110a481612c7d565b915050611069565b60145460ff16156110cf5760405162461bcd60e51b81526004016106d690612af4565b6002546040516331a9108f60e11b81526004810183905233916001600160a01b031690636352211e9060240160206040518083038186803b15801561111357600080fd5b505afa158015611127573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061114b9190612636565b6001600160a01b0316146111715760405162461bcd60e51b81526004016106d690612ac5565b60025460405163b82f74e160e01b8152600481018390526001600160a01b039091169063b82f74e19060240160206040518083038186803b1580156111b557600080fd5b505afa1580156111c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ed91906127c2565b156112345760405162461bcd60e51b8152602060048201526017602482015276596f752063616e206f6e6c79207374616b652068656e7360481b60448201526064016106d6565b60025460405163e985e9c560e01b81526001600160a01b039091169063e985e9c590611266903390309060040161295a565b60206040518083038186803b15801561127e57600080fd5b505afa158015611292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b691906127c2565b6112bf57600080fd5b6040805160608101825242815233602080830182815260008486018181528782526008845286822086518155925160019384018054925161ffff16600160a01b026001600160b01b03199093166001600160a01b039283161792909217909155848252600984528682208054938401815582529290200185905560025493516323b872dd60e01b8152929316916323b872dd916113629130908790600401612974565b600060405180830381600087803b15801561137c57600080fd5b505af1158015611390573d6000803e3d6000fd5b505050505050565b60145460ff16156113bb5760405162461bcd60e51b81526004016106d690612af4565b6000805b60ff811684111561140c576113ee85858360ff168181106113e2576113e2612cf3565b9050602002013561209f565b6113f89083612bb2565b91508061140481612c7d565b9150506113bf565b5080156114a05760035460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb906114459033908590600401612998565b602060405180830381600087803b15801561145f57600080fd5b505af1158015611473573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149791906127c2565b6114a057600080fd5b81156114ea5760005b60ff8116841115610f5a576114d885858360ff168181106114cc576114cc612cf3565b90506020020135611bb3565b806114e281612c7d565b9150506114a9565b50505050565b6000818152600f602052604081208054829061150c9042612bfd565b90506000620151808211611524578260010154611527565b60005b90506007818154811061153c5761153c612cf3565b90600052602060002001549350505050919050565b6000546001600160a01b031690565b60008181526008602052604081208054829061157c9042612bfd565b905061158b6201518082612bca565b949350505050565b606060006115a083610f61565b90506000816001600160401b038111156115bc576115bc612d09565b60405190808252806020026020018201604052801561161857816020015b6116056040518060800160405280600081526020016000815260200160008152602001606081525090565b8152602001906001900390816115da5790505b50905060005b828161ffff16101561175457600061163a868361ffff16610923565b6000818152600860205260408120600181015492935091600160a01b900461ffff1661166584611965565b61166f9190612bfd565b60025460405163c87b56dd60e01b8152600481018690529192506000916001600160a01b039091169063c87b56dd9060240160006040518083038186803b1580156116b957600080fd5b505afa1580156116cd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116f5919081019061281a565b905060405180608001604052808581526020018460000154815260200183815260200182815250868661ffff168151811061173257611732612cf3565b602002602001018190525050505050808061174c90612c40565b91505061161e565b509392505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146117d45760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c0060448201526064016106d6565b61091f82826122c4565b600781815481106117ee57600080fd5b600091825260209091200154905081565b60145460ff16156118225760405162461bcd60e51b81526004016106d690612af4565b600061182d8361209f565b9050811561183e5761183e83611bb3565b80156107925760035460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb906118769033908590600401612998565b602060405180830381600087803b15801561189057600080fd5b505af11580156118a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118c891906127c2565b61079257600080fd5b336118da611551565b6001600160a01b0316146119005760405162461bcd60e51b81526004016106d690612b1d565b6014805460ff19811660ff90911615179055565b600080600660009054906101000a90046001600160a01b03166001600160a01b03166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561100857600080fd5b6002546040516331a9108f60e11b81526004810183905260009130916001600160a01b0390911690636352211e9060240160206040518083038186803b1580156119ae57600080fd5b505afa1580156119c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e69190612636565b6001600160a01b031614611a0c5760405162461bcd60e51b81526004016106d690612b52565b6003546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611a3d903090600401612946565b60206040518083038186803b158015611a5557600080fd5b505afa158015611a69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8d9190612801565b6000848152600860205260408120919250611ab56201518069152d02c7e14af6800000612bca565b8254909150600090611ac79042612bfd565b90506000611ad86201518083612bca565b90506001811080611ae7575084155b15611af9575060009695505050505050565b6000611b06600183612bfd565b90506000611b1583600a612bde565b600283611b228180612bde565b611b2c9190612bb2565b611b369190612bca565b611b409190612bb2565b905060008162015180611b538682612bde565b611b5d9088612bfd565b611b678786612bca565b611b719190612bde565b611b7b9190612bca565b611b859190612bb2565b90506000611b938288612bde565b9050888110611ba25788611ba4565b805b9b9a5050505050505050505050565b6002546040516331a9108f60e11b81526004810183905230916001600160a01b031690636352211e9060240160206040518083038186803b158015611bf757600080fd5b505afa158015611c0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2f9190612636565b6001600160a01b031614611c555760405162461bcd60e51b81526004016106d690612b52565b600081815260086020526040902060018101546001600160a01b03163314611c8f5760405162461bcd60e51b81526004016106d690612ac5565b336000908152600960205260408120905b815461ffff82161015611cec5783828261ffff1681548110611cc457611cc4612cf3565b90600052602060002001541415611cda57611cec565b80611ce481612c40565b915050611ca0565b815461ffff821610611d305760405162461bcd60e51b815260206004820152600d60248201526c12195b881b9bdd08199bdd5b99609a1b60448201526064016106d6565b81548290611d4090600190612bfd565b81548110611d5057611d50612cf3565b9060005260206000200154828261ffff1681548110611d7157611d71612cf3565b906000526020600020018190555081805480611d8f57611d8f612cdd565b6000828152602081206000199083018101919091550190556001830180546001600160a01b03191690556002546040516323b872dd60e01b81526001600160a01b03909116906323b872dd90611ded90309033908990600401612974565b600060405180830381600087803b158015611e0757600080fd5b505af1158015611e1b573d6000803e3d6000fd5b5050505050505050565b33611e2e611551565b6001600160a01b031614611e545760405162461bcd60e51b81526004016106d690612b1d565b6001600160a01b038116611eb95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106d6565b611ec28161204f565b50565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001611f35929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401611f62939291906129b1565b602060405180830381600087803b158015611f7c57600080fd5b505af1158015611f90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fb491906127c2565b50600083815260016020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529082905261200f91612bb2565b60008581526001602052604090205561158b8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6002546040516331a9108f60e11b81526004810183905260009130916001600160a01b0390911690636352211e9060240160206040518083038186803b1580156120e857600080fd5b505afa1580156120fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121209190612636565b6001600160a01b0316146121465760405162461bcd60e51b81526004016106d690612b52565b600082815260086020526040902060018101546001600160a01b031633146121805760405162461bcd60e51b81526004016106d690612ac5565b600061218b84611965565b6001830154909150600160a01b900461ffff168110156121ed5760405162461bcd60e51b815260206004820181905260248201527f596f752068617665206e6f207265776172647320617420746869732074696d6560448201526064016106d6565b600182015461220790600160a01b900461ffff1682612bfd565b90506000600b54600014806122315750601154600160201b900461ffff1661222e86611560565b10155b6122595760115460649061224a90849061ffff16612bde565b6122549190612bca565b61225c565b60005b9050600061226a8284612bfd565b90506000600b5411801561227e5750600082115b156122a757600b546122909083612bca565b600a60008282546122a19190612bb2565b90915550505b60018401805461ffff60a01b191690554290935550909392505050565b6000828152601060205260408082205460025491516331a9108f60e11b8152600481018290529092916001600160a01b031690636352211e9060240160206040518083038186803b15801561231857600080fd5b505afa15801561232c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123509190612636565b90506001600160a01b03811661236557600080fd5b6002546040516370a0823160e01b81526000916001600160a01b0316906370a0823190612396903090600401612946565b60206040518083038186803b1580156123ae57600080fd5b505afa1580156123c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123e69190612801565b6123f09085612c9d565b600254604051632f745c5960e01b81529192506000916001600160a01b0390911690632f745c59906124289030908690600401612998565b60206040518083038186803b15801561244057600080fd5b505afa158015612454573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124789190612801565b6000818152600860205260408120600181015492935091600160a01b900461ffff166124a384611965565b6124ad9190612bfd565b6011549091506000906064906124ce90849062010000900461ffff16612bde565b6124d89190612bca565b9050801561257d5780600c60008282546124f29190612bb2565b909155505060035460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb906125299089908590600401612998565b602060405180830381600087803b15801561254357600080fd5b505af1158015612557573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257b91906127c2565b505b604080518581526020810183905288916001600160a01b038916917f442b8ff07e6b8e8008ebf53c4ce979a8ef762045727b158333bfe674b7a54f6c910160405180910390a3505050505050505050565b60008083601f8401126125e057600080fd5b5081356001600160401b038111156125f757600080fd5b6020830191508360208260051b850101111561261257600080fd5b9250929050565b60006020828403121561262b57600080fd5b813561105f81612d1f565b60006020828403121561264857600080fd5b815161105f81612d1f565b6000806040838503121561266657600080fd5b823561267181612d1f565b946020939093013593505050565b6000806020838503121561269257600080fd5b82356001600160401b038111156126a857600080fd5b6126b4858286016125ce565b90969095509350505050565b6000806000604084860312156126d557600080fd5b83356001600160401b038111156126eb57600080fd5b6126f7868287016125ce565b909450925050602084013561270b81612d34565b809150509250925092565b6000602080838503121561272957600080fd5b82356001600160401b038082111561274057600080fd5b818501915085601f83011261275457600080fd5b81358181111561276657612766612d09565b8060051b9150612777848301612b82565b8181528481019084860184860187018a101561279257600080fd5b600095505b838610156127b5578035835260019590950194918601918601612797565b5098975050505050505050565b6000602082840312156127d457600080fd5b815161105f81612d34565b600080604083850312156127f257600080fd5b50508035926020909101359150565b60006020828403121561281357600080fd5b5051919050565b60006020828403121561282c57600080fd5b81516001600160401b038082111561284357600080fd5b818401915084601f83011261285757600080fd5b81518181111561286957612869612d09565b61287c601f8201601f1916602001612b82565b915080825285602082850101111561289357600080fd5b6128a4816020840160208601612c14565b50949350505050565b6000602082840312156128bf57600080fd5b5035919050565b600080604083850312156128d957600080fd5b8235915060208301356128eb81612d34565b809150509250929050565b6000806040838503121561290957600080fd5b823560ff8116811461267157600080fd5b60008151808452612932816020860160208601612c14565b601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b60018060a01b03841681528260208201526060604082015260006129d8606083018461291a565b95945050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015612a5e57888303603f1901855281518051845287810151888501528681015187850152606090810151608091850182905290612a4a8186018361291a565b968901969450505090860190600101612a08565b509098975050505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612ab85781518051855286810151878601528501518585015260609093019290850190600101612a89565b5091979650505050505050565b6020808252601590820152742cb7ba9036bab9ba1037bbb7103a3430ba103432b760591b604082015260600190565b6020808252600f908201526e10dbdb9d1c9858dd081c185d5cd959608a1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b602080825260169082015275151a19481a195b881b5d5cdd081899481cdd185ad95960521b604082015260600190565b604051601f8201601f191681016001600160401b0381118282101715612baa57612baa612d09565b604052919050565b60008219821115612bc557612bc5612cb1565b500190565b600082612bd957612bd9612cc7565b500490565b6000816000190483118215151615612bf857612bf8612cb1565b500290565b600082821015612c0f57612c0f612cb1565b500390565b60005b83811015612c2f578181015183820152602001612c17565b838111156114ea5750506000910152565b600061ffff80831681811415612c5857612c58612cb1565b6001019392505050565b6000600019821415612c7657612c76612cb1565b5060010190565b600060ff821660ff811415612c9457612c94612cb1565b60010192915050565b600082612cac57612cac612cc7565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611ec257600080fd5b8015158114611ec257600080fdfe596f75206d757374207061792074686520636f727265637420616d6f756e7420a26469706673582212203f890ac0c13f9c3fc6af4dd083a23c451df6f9915b282ba1df9d0a74d140d5c364736f6c634300080700330000000000000000000000003803f8497f0446ed5362c73635e3d8e9eac83d250000000000000000000000004ac6e3cda66967f1286da690129a33638f9e70880000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae0000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f1000000000000000000000000f9680d99d6c9589e2a93a78a04a279e509205945000000000000000000000000ab594600376ec9fd91f8e885dadf0ce036862de0f86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da00000000000000000000000000000000000000000000000000005af3107a40000000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619

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

0000000000000000000000003803f8497f0446ed5362c73635e3d8e9eac83d250000000000000000000000004ac6e3cda66967f1286da690129a33638f9e70880000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae0000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f1000000000000000000000000f9680d99d6c9589e2a93a78a04a279e509205945000000000000000000000000ab594600376ec9fd91f8e885dadf0ce036862de0f86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da00000000000000000000000000000000000000000000000000005af3107a40000000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619

-----Decoded View---------------
Arg [0] : _fh (address): 0x3803f8497f0446ed5362c73635e3d8e9eac83d25
Arg [1] : _eggs (address): 0x4ac6e3cda66967f1286da690129a33638f9e7088
Arg [2] : _vrf (address): 0x3d2341adb2d31f1c5530cdc622016af293177ae0
Arg [3] : _link (address): 0xb0897686c545045afc77cf20ec7a532e3120e0f1
Arg [4] : _ethFeed (address): 0xf9680d99d6c9589e2a93a78a04a279e509205945
Arg [5] : _maticFeed (address): 0xab594600376ec9fd91f8e885dadf0ce036862de0
Arg [6] : _keyHash (bytes32): 0xf86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da
Arg [7] : _fee (uint256): 100000000000000
Arg [8] : _weth (address): 0x7ceb23fd6bc0add59e62ac25578270cff1b9f619

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000003803f8497f0446ed5362c73635e3d8e9eac83d25
Arg [1] : 0000000000000000000000004ac6e3cda66967f1286da690129a33638f9e7088
Arg [2] : 0000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae0
Arg [3] : 000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f1
Arg [4] : 000000000000000000000000f9680d99d6c9589e2a93a78a04a279e509205945
Arg [5] : 000000000000000000000000ab594600376ec9fd91f8e885dadf0ce036862de0
Arg [6] : f86195cf7690c55907b2b611ebb7343a6f649bff128701cc542f0569e2c549da
Arg [7] : 00000000000000000000000000000000000000000000000000005af3107a4000
Arg [8] : 0000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619


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.