Contract 0xd226f4dd7bf520e3dca018d1080e3479b8941337

Contract Overview

Balance:
0 BNB
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4dFight87012662021-05-09 21:07:54136 days 5 hrs ago0xa222ce50c1b9e65121b1597250907a71e20689db IN  0xd226f4dd7bf520e3dca018d1080e3479b89413370 BNB0.00673502
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33fFight87012632021-05-09 21:07:45136 days 5 hrs ago0xa222ce50c1b9e65121b1597250907a71e20689db IN  0xd226f4dd7bf520e3dca018d1080e3479b89413370 BNB0.00750618
0x43c989ed219c79d830a7dffe6f5aac4b294b01b89aacda2926953842ea29c708Fight87012602021-05-09 21:07:36136 days 5 hrs ago0xa222ce50c1b9e65121b1597250907a71e20689db IN  0xd226f4dd7bf520e3dca018d1080e3479b89413370 BNB0.00750618
0xd5f17b08c9320026eb3af318e21fa8294f6c4c45adec97c41710c0c931cca001Fight87012572021-05-09 21:07:27136 days 5 hrs ago0xa222ce50c1b9e65121b1597250907a71e20689db IN  0xd226f4dd7bf520e3dca018d1080e3479b89413370 BNB0.00810618
0x5f835f1df8996c40707fb45ccc70e3c3c4c1d67cce6c0e1a8d6396b6212925d0Test87012532021-05-09 21:07:15136 days 5 hrs ago0xa222ce50c1b9e65121b1597250907a71e20689db IN  0xd226f4dd7bf520e3dca018d1080e3479b89413370 BNB0.0061436
0xd422b7375d11b84a8f0d7d5f75e454022eac49e5cb83812e4de9b5b816a21d630x6080604087012462021-05-09 21:06:54136 days 5 hrs ago0xa222ce50c1b9e65121b1597250907a71e20689db IN  Contract Creation0 BNB0.069626
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x006557fe4c9c269e977bfe2598a3de481015ff867820b8bf6e5de9809b2eef4d87012662021-05-09 21:07:54136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x1b35f82c304c1bcda65393a6c5f5816bc8fec32d1bf99d72709f1682f82ea33f87012632021-05-09 21:07:45136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x43c989ed219c79d830a7dffe6f5aac4b294b01b89aacda2926953842ea29c70887012602021-05-09 21:07:36136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x43c989ed219c79d830a7dffe6f5aac4b294b01b89aacda2926953842ea29c70887012602021-05-09 21:07:36136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
0x43c989ed219c79d830a7dffe6f5aac4b294b01b89aacda2926953842ea29c70887012602021-05-09 21:07:36136 days 5 hrs ago 0xd226f4dd7bf520e3dca018d1080e3479b8941337 0x70a97718c84673bc02993ca4285e7b655232fa970 BNB
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Arena

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 21 : Arena.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.0;
pragma experimental ABIEncoderV2;

import "../oz/utils/structs/EnumerableSet.sol";
import "../oz/access/Ownable.sol";
import "../oz/token/ERC20/ERC20.sol";
import "../oz/token/ERC20/IERC20.sol";
import "../oz/token/ERC20/utils/SafeERC20.sol";
import "../oz/token/ERC721/utils/ERC721Holder.sol";
import '../oz/token/ERC721/IERC721.sol';
import "../oz/utils/math/SafeMath.sol";
import "./BeastNFT.sol";
import "./Random.sol";

contract Arena is Ownable, ERC721Holder {
    using SafeERC20 for IERC20;
    using SafeMath for uint;
    using Random for Random.Seed;
    
    
    struct FighterInfo {
        address user;
        uint seed1;
        uint8 health1;
        uint seed2;
        uint8 health2;
        uint seed3;
        uint8 health3;
        uint coins;
        uint name;
        uint8 fights;
    }
    
    struct Log {
        address attacker;
        uint8 healthA1;
        uint8 healthA2;
        uint8 healthA3;
        address defender;
        uint8 healthD1;
        uint8 healthD2;
        uint8 healthD3;
        uint16[] kicks; // array 6 numbers ([damage] [enemyIndex] [myIndex])
        uint money;
        bool win;
    }
    
    enum State { IDLE, PREPARING, STARTED, FINISHED }
    uint public startPreparingBlock;
    uint public startFightBlock;
    uint public endFightBlock;
    
    BeastNFT public nft;
    IERC20 public gen;
    uint8 public maxTeam = 3;
    uint public pool;
    uint public cost;
    uint16 public usersCount = 0;
    uint16 public usersLimit = 30;    
    uint public minLevel = 1;
    uint public maxLevel = 3;
    event Fight(Log log);
    
    constructor(BeastNFT n, IERC20 g) {
        nft = n;
        gen = g;
    }
    
    mapping (address => uint[3]) public teams;
    mapping (uint => uint8) public health;
    mapping (address => uint8) public fightNumber; 
    mapping (address => uint) public money; 
    mapping (address => uint16) public fightersIndexer;
    mapping (uint16 => address) public allFighters;
     
    uint[] public T1;
    function test(address enemy) public {
        teams[msg.sender][0] = 21;
        teams[msg.sender][1] = 22;
        teams[msg.sender][2] = 23;
        
        teams[enemy][0] = 24;
        teams[enemy][1] = 25;
        teams[enemy][2] = 26;
        
        money[msg.sender] = 33;
        money[enemy] = 33;
        
        health[21] = 80;
        health[22] = 80;
        health[23] = 80;
        health[24] = 80;
        health[25] = 80;
        health[26] = 80;
        
    }
    
    function fight(address enemy) public {
        // require(getState() == State.STARTED,"Battle didn't start");
        require(fightNumber[msg.sender] < 7,"too much attacks");
        require(totalHealth(teams[msg.sender]) > 0,"You have 0 health");
        require(totalHealth(teams[enemy]) > 0,"You have 0 health");
        
        uint mySeed = uint(blockhash(block.number - 1)) / 100000;// >> 4 + userSeed >> 4 + ;
        uint enemySeed = mySeed / 10000000000;
        
        T1.push(mySeed);
        
        uint8 myDamage = 0;
        uint8 enemyDamage = 0;
        
        uint16[] memory kicks = new uint16[](6);
        
        for (uint8 i=0;i<3;i++) {
            if (health[teams[msg.sender][i]] > 0) {
                uint16 damage = attack(i,msg.sender,enemy, mySeed) * 10 + uint16(i);
                
                kicks[i * 2] = 10000 + damage;
                myDamage += uint8(damage / 100);
            } else {
                kicks[i * 2] = 0;
            }
            
            mySeed /= 1000;
                
            if (health[teams[enemy][i]] > 0) {
                uint16 damage = attack(i,enemy,msg.sender, enemySeed) * 10 + uint16(i);
                
                kicks[i * 2 + 1] = 10000 + damage;
                enemyDamage += uint8(damage / 100);
            } else {
                kicks[i * 2 + 1] = 0;
            }
            
            enemySeed /= 1000;
        }
        
        fightNumber[msg.sender]++;
        
        uint myMoney = moneyFor(msg.sender);
        uint enemyMoney = moneyFor(enemy);
        bool meAlive = totalHealth(teams[msg.sender]) > 0;
        bool enemyAlive = totalHealth(teams[enemy]) > 0;
        uint moneyChange = 0;
        bool isWin = false;
        if (meAlive) {
            if ((myDamage >= enemyDamage) || (enemyAlive == false)) {
                moneyChange = enemyMoney * 30 / 100;
                money[msg.sender] = myMoney + enemyMoney * 30 / 100;
                money[enemy] = enemyMoney - enemyMoney * 30 / 100;
                isWin = true;
            }
        }
        
        if (enemyAlive) {
            if ((myDamage < enemyDamage) || (meAlive == false)) {
                moneyChange = myMoney * 30 / 100;
                money[msg.sender] = myMoney - myMoney * 30 / 100;
                money[enemy] = enemyMoney + myMoney * 30 / 100;
            }
        }
        uint[3] memory enemyTeam = teams[enemy];
        
        emit Fight(Log(msg.sender,
        health[teams[msg.sender][0]],
        health[teams[msg.sender][1]],
        health[teams[msg.sender][2]],
        enemy,
        health[enemyTeam[0]],
        health[enemyTeam[1]],
        health[enemyTeam[2]],
        kicks, moneyChange, isWin));
    }
    
    function attack(uint8 index, address me, address enemy, uint mySeed) private returns (uint16) {//([damage] [enemyIndex])
        uint myId = teams[me][index];
        
        uint8 damage = 0;
      
            uint8 enemyIndex = index;
            
            if (health[teams[enemy][enemyIndex]] == 0) {
                for (uint8 i = 0; i<3; i++) {
                    if (health[teams[enemy][i]] > 0) {
                        enemyIndex = i;
                        break;
                    }
                }
            }
                
            uint enemyId = teams[enemy][enemyIndex];
                
            uint8 enemyHealth = health[enemyId];
            if (enemyHealth > 0) {
                if (mySeed % 10 >= defenceFor(teams[enemy][enemyIndex])) { //try block
                    damage = uint8(mySeed % 1000 % strengthFor(myId) + 1);
                    
                    if (enemyHealth > damage) {
                        health[enemyId] = enemyHealth - damage;
                    } else {
                        health[enemyId] = 0;
                        nft.kill(enemyId);
                    }
                }
            }
        
  
        return damage * 10 + enemyIndex;
    }
    
    function strengthFor(uint tokenId) view public returns (uint8) {
        BeastNFT.Ability[] memory abilities = nft.abilitiesFor(tokenId);
        uint strength = 5;
        for (uint i = 0; i< abilities.length; i++) {
            if (abilities[i].value.param == 2) {
                strength += abilities[i].value.amount;
            }
            
        }
        
        return uint8(strength);
    }
    
    function defenceFor(uint tokenId) view public returns (uint8) {
        BeastNFT.Ability[] memory abilities = nft.abilitiesFor(tokenId);
        uint defence = 0;
        for (uint i = 0; i< abilities.length; i++) {
            if (abilities[i].value.param == 3) {
                defence += abilities[i].value.amount;
            }
        }
        
        return uint8(defence);
    }
    
    function moneyFor(address user) view public returns (uint){
        return money[user];
    }
    
    function totalHealth(uint[3] memory team) view public returns (uint8) {
        return health[team[0]] +  health[team[1]] + health[team[2]];
    }
    
    function addMonsters(uint nftId1, uint nftId2, uint nftId3) public {
        require(block.number < startFightBlock,"Battle already started");
        
        require(nft.ownerOf(nftId1) == msg.sender, "you are not owner");
        require(nft.ownerOf(nftId2) == msg.sender, "you are not owner");
        require(nft.ownerOf(nftId3) == msg.sender, "you are not owner");
        
        uint abAmount1 = nft.abilitiesAmount(nftId1);
        uint abAmount2 = nft.abilitiesAmount(nftId2);
        uint abAmount3 = nft.abilitiesAmount(nftId3);
        
        require(abAmount1 >= minLevel, "don't fit");
        require(abAmount2 >= minLevel, "don't fit");
        require(abAmount3 >= minLevel, "don't fit");
        require(abAmount1 <= maxLevel, "don't fit");
        require(abAmount2 <= maxLevel, "don't fit");
        require(abAmount3 <= maxLevel, "don't fit");
        
        require(usersCount < usersLimit, "users Limit");
        
        teams[msg.sender][0] = nftId1;
        teams[msg.sender][1] = nftId2;
        teams[msg.sender][2] = nftId3;
        
        health[nftId1] = uint8(nft.statsFor(nftId1).health);
        health[nftId2] = uint8(nft.statsFor(nftId2).health);
        health[nftId3] = uint8(nft.statsFor(nftId3).health);
        
        allFighters[usersCount] = msg.sender; 
        fightersIndexer[msg.sender] = usersCount;
        usersCount++;
        
        nft.safeTransferFrom(address(msg.sender), address(this), nftId1);
        nft.safeTransferFrom(address(msg.sender), address(this), nftId2);
        nft.safeTransferFrom(address(msg.sender), address(this), nftId3);
        
        gen.transferFrom(msg.sender, address(this), cost);
        money[msg.sender] = cost;
        pool += cost;
    }
    
    function leave() public {
        require(getState() == State.FINISHED,"Battle already started");
        uint id0 = teams[msg.sender][0];
        uint id1 = teams[msg.sender][1];
        uint id2 = teams[msg.sender][2];
        
        bool alive = false;
        if (nft.isAlive(id0)) {
            nft.addEvolvePoint(id0,fightNumber[msg.sender] / 3);
            alive = true;
        } else {
            nft.revive(id0);
        }
        
    
        if (nft.isAlive(id1)) {
            nft.addEvolvePoint(id1,fightNumber[msg.sender] / 3);
            alive = true;
        } else {
            nft.revive(id1);
        }
        
        if (nft.isAlive(id2)) {
            nft.addEvolvePoint(id2,fightNumber[msg.sender] / 3);
            alive = true;
        } else {
            nft.revive(id2);
        }
        
        if ((fightNumber[msg.sender] >= 3) && (alive == true)) { 
            gen.transfer(msg.sender, moneyFor(msg.sender));
        }
        
        nft.safeTransferFrom(address(this), address(msg.sender), id0);
        nft.safeTransferFrom(address(this), address(msg.sender), id1);
        nft.safeTransferFrom(address(this), address(msg.sender), id2);
        
        teams[msg.sender][0] = 0;
        teams[msg.sender][1] = 0;
        teams[msg.sender][2] = 0;
    }
    
    function revive() public {
       
    }
    
    function getState() public view returns (State) {
        if (block.number < startPreparingBlock) return State.IDLE;
        if (block.number < startFightBlock) return State.PREPARING;
        if (block.number > endFightBlock) return State.FINISHED;
        return State.STARTED;
    }
    
    //start
    function start(uint beforePreparing, uint preparing, uint fighting, uint _cost) external onlyOwner {
        startPreparingBlock = block.number + beforePreparing * 20;
        startFightBlock = startPreparingBlock + preparing * 20;
        endFightBlock = startFightBlock + fighting * 20;
        cost = _cost * 1e18;
    }
    
    function withdrawAll() external onlyOwner {
        gen.safeTransfer(msg.sender, gen.balanceOf(address(this)));
    }
    
    
    function getFightersInfo() view external returns (FighterInfo[] memory) {
        FighterInfo[] memory info = new FighterInfo[](usersCount);
        
        for (uint16 i=0;i<usersCount; i++) {
            info[i] = getFighterInfo(allFighters[i]);
        }
        
        return info;
    }
    
    function getFighterInfo(address user) view public returns (FighterInfo memory) {
        
        return FighterInfo(user,
            nft.valuesSeedFor(teams[user][0]),
            health[teams[user][0]],
            nft.valuesSeedFor(teams[user][1]),
            health[teams[user][1]],
            nft.valuesSeedFor(teams[user][2]),
            health[teams[user][2]],
            moneyFor(user),
            fightersIndexer[user],
            fightNumber[user]);
    }
    
    function updateMinMax(uint min, uint max) public onlyOwner {
        minLevel = min;
        maxLevel = max;
    }
    
    //Trusted
    mapping(address=>bool) private _isTrusted;
    modifier onlyTrusted {
        require(_isTrusted[msg.sender] || msg.sender == owner(), "not trusted");
        _;
    }
    
    function addTrusted(address user) public onlyOwner {
        _isTrusted[user] = true;
    }
    
    function removeTrusted(address user) public onlyOwner {
        _isTrusted[user] = false;
    }
    
    // function revive(uint nftId, address owner) public onlyTrusted {
    //     nft.revive(nftId);
    //     nft.safeTransferFrom(address(this), owner, nftId);
    // }
}

File 2 of 21 : BeastNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;
pragma experimental ABIEncoderV2;

import "../oz/utils/structs/EnumerableSet.sol";
import "../oz/access/Ownable.sol";
import "../oz/token/ERC721/extensions/ERC721Enumerable.sol";

contract BeastNFT is ERC721Enumerable, Ownable  {
    
    //// different types of features
    struct Value { 
        uint id;
        uint amount;   // how much boost
        uint param;  // what boost
    }
    
    struct Ability {
        uint feature; //body, horns, wings
        Value value;
    }
    
    struct Info {
        uint valuesSeed;
        uint abilitiesAmount;
        uint breedLeft;
        uint evolvePoints;
        bool dead;
    }
    
    struct Stats { 
        uint health;  //1
        uint strength;//2
        uint defence;//3
    }
    
    constructor() ERC721("Beast NFT","BeastNFT") {
        
    } 
    
    function addValueToFeature(uint featureId, uint id, uint value, uint param) public onlyOwner {
        if (featureId + 1 > featuresAmount) {
            featuresAmount = featureId + 1;
        }
        featureToValues[featureId].push(Value(id, value, param));
    }
    
        
    function updateBreedTimes(uint _maxBreedTimes) public onlyOwner {
        maxBreedTimes = _maxBreedTimes;
    }
    
    function updateEvolvePointsMultiplier(uint _evolvePointsMultiplier) public onlyOwner {
        evolvePointsMultiplier = _evolvePointsMultiplier;
    }
    
    uint public featuresAmount;
    uint public maxBreedTimes = 3;
    uint public evolvePointsMultiplier = 10;
    
    mapping (uint=>Value[]) public featureToValues;
    
    mapping (uint=>uint) public valuesSeedByTokenId;
    mapping (uint=>uint) public abilitiesAmountByTokenId;
    
    mapping (uint=>uint) public breedAmount;
    
    mapping (uint=>uint) public evolvePoints;
    mapping (uint=>bool) public dead;
    
    using EnumerableSet for EnumerableSet.UintSet;
    using Strings for uint256;
    
       //Trusted
    mapping(address=>bool) public _isTrusted;
    modifier onlyTrusted {
        require(_isTrusted[msg.sender] || msg.sender == owner(), "not trusted");
        _;
    }
    
    function addTrusted(address user) public onlyOwner {
        _isTrusted[user] = true;
    }
    
    function removeTrusted(address user) public onlyOwner {
        _isTrusted[user] = false;
    }
       
    uint nextTokenId = 0;
    
    function createToken(address holder) public onlyTrusted returns (uint tokenId) {
        tokenId = ++nextTokenId;
        _mint(holder, tokenId);
    }
    
    function updateAbilities(uint tokenId, uint amount, uint valuesSeed) public onlyTrusted {
        abilitiesAmountByTokenId[tokenId] = amount;
        valuesSeedByTokenId[tokenId] = valuesSeed;
    }
    
    function addEvolvePoint(uint tokenId, uint points) public onlyTrusted {
        evolvePoints[tokenId] += points;
    }
    
    function evolve(uint tokenId) public onlyTrusted {
        require(evolvePoints[tokenId] >= abilitiesAmountByTokenId[tokenId] * evolvePointsMultiplier / 10, "can't evolve");
        require(abilitiesAmountByTokenId[tokenId] < featuresAmount, "can't evolve");
        evolvePoints[tokenId] -= abilitiesAmountByTokenId[tokenId] * evolvePointsMultiplier / 10;
    }
    
    function kill(uint tokenId) public onlyTrusted {
        dead[tokenId] = true;
    }
    
    function revive(uint tokenId) public onlyTrusted {
        dead[tokenId] = false;
    }
    
    function breed(uint tokenId) public onlyTrusted {
        breedAmount[tokenId] = breedAmount[tokenId] + 1;
        if (breedAmount[tokenId] >= maxBreedTimes) {
            dead[tokenId] = true;
        }
    }
    
    function isAlive(uint tokenId) view public returns (bool) {
        return dead[tokenId] == false;
    }
    
     function canEvolve(uint tokenId) view public returns (bool) {
        return (dead[tokenId] == false) &&
        (abilitiesAmountByTokenId[tokenId] < featuresAmount) && 
        (abilitiesAmountByTokenId[tokenId] * evolvePointsMultiplier / 10 <= evolvePoints[tokenId]);
    }
    
    function valuesSeedFor(uint tokenId) view public returns (uint) {
        return valuesSeedByTokenId[tokenId];
    }
    
    function abilitiesAmount(uint tokenId) view public returns (uint) {
        return abilitiesAmountByTokenId[tokenId];
    }
    
    function valuesAmountFor(uint feature) view public returns (uint) {
        return featureToValues[feature].length;
    }
    
    function info(uint tokenId) view public returns (Info memory) {
        return Info(valuesSeedByTokenId[tokenId],
        abilitiesAmountByTokenId[tokenId],
        maxBreedTimes - breedAmount[tokenId],
        evolvePoints[tokenId],
        dead[tokenId]);
    }
    
    function statsFor(uint tokenId) view public returns (Stats memory) {//health,strength,defence
        Ability[] memory abilities = abilitiesFor(tokenId);
        uint[] memory stats = new uint[](4);
        for (uint i = 0; i< abilities.length; i++) {
            stats[abilities[i].value.param] += abilities[i].value.amount;
        }
        if (dead[tokenId] == true) {
            stats[1] = 0;
        }
        return Stats(stats[1],stats[2] + 5,stats[3]);
    }
    
    function abilitiesFor(uint tokenId) view public returns (Ability[] memory) {
        
        uint abilAmount = abilitiesAmountByTokenId[tokenId];
        uint valuesSeed = valuesSeedByTokenId[tokenId];
        
        Ability[] memory abilities = new Ability[](abilAmount);
        
        for (uint featureIndex = 0; featureIndex < abilAmount; featureIndex++) {
            
            uint valueNumber = valuesSeed % 1000;
            
            abilities[featureIndex] = Ability(featureIndex, featureToValues[featureIndex][valueNumber - 1]);
            
            valuesSeed /= 1000;
        }
        
        return abilities;
    }
    
    function allfeatureToValues() view public returns (Value[][] memory) {
        Value[][] memory all = new Value[][](featuresAmount);
        
        for (uint i = 0; i< featuresAmount; i++) {
            all[i] = featureToValues[i];
        }
        
        return all;
    }
    
    
    function _baseURI() internal view virtual override returns (string memory) {
        return "https://nft.evodefi.com/";
    }
    
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        string memory baseURI = ERC721.tokenURI(tokenId);
        return string(abi.encodePacked(
            baseURI, "/", valuesSeedByTokenId[tokenId].toString()));
    }
}

File 3 of 21 : Random.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0;
pragma experimental ABIEncoderV2;
library Random {

  struct Seed {
    uint blockNumber;
  }

  function isInitialized(Seed memory seed) internal pure returns (bool) {
    return seed.blockNumber > 0;
  }
  
  function isReady(Seed memory seed) internal view returns (bool) {
    return (block.number > seed.blockNumber + 1) && (seed.blockNumber > 0);
  }
    
  function init(Seed storage seed) internal {
    require(!isInitialized(seed), "Seed already initialized");
    seed.blockNumber = block.number;
  }
  
  function get(Seed storage seed) internal view returns (bytes32) {
    require(isInitialized(seed), "Seed is not initialized");
    require(block.number > seed.blockNumber, "Wait one more block to open this Seed");
    return blockhash(seed.blockNumber + 1);
  }

  function reset(Seed storage seed) internal {
    seed.blockNumber = 0;
  }

}

File 4 of 21 : 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 () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 5 of 21 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The defaut value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overloaded;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

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

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        _approve(sender, _msgSender(), currentAllowance - amount);

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        _approve(_msgSender(), spender, currentAllowance - subtractedValue);

        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        _balances[sender] = senderBalance - amount;
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        _balances[account] = accountBalance - amount;
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens 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 amount) internal virtual { }
}

File 6 of 21 : 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 7 of 21 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 8 of 21 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "./extensions/IERC721Enumerable.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}. 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 || ERC721.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 || ERC721.isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `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(to).onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    // solhint-disable-next-line no-inline-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * 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 { }
}

File 9 of 21 : 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 10 of 21 : 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 11 of 21 : 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 21 : 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 13 of 21 : 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 14 of 21 : ERC721Holder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

  /**
   * @dev Implementation of the {IERC721Receiver} interface.
   *
   * Accepts all token transfers.
   * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
   */
contract ERC721Holder is IERC721Receiver {

    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 15 of 21 : 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;
        // solhint-disable-next-line no-inline-assembly
        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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 16 of 21 : 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) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 17 of 21 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant alphabet = "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] = alphabet[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

}

File 18 of 21 : 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 19 of 21 : 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 20 of 21 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 21 of 21 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

    struct Set {
        // Storage of set values
        bytes32[] _values;

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

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

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

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

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

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"contract BeastNFT","name":"n","type":"address"},{"internalType":"contract IERC20","name":"g","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"attacker","type":"address"},{"internalType":"uint8","name":"healthA1","type":"uint8"},{"internalType":"uint8","name":"healthA2","type":"uint8"},{"internalType":"uint8","name":"healthA3","type":"uint8"},{"internalType":"address","name":"defender","type":"address"},{"internalType":"uint8","name":"healthD1","type":"uint8"},{"internalType":"uint8","name":"healthD2","type":"uint8"},{"internalType":"uint8","name":"healthD3","type":"uint8"},{"internalType":"uint16[]","name":"kicks","type":"uint16[]"},{"internalType":"uint256","name":"money","type":"uint256"},{"internalType":"bool","name":"win","type":"bool"}],"indexed":false,"internalType":"struct Arena.Log","name":"log","type":"tuple"}],"name":"Fight","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":"","type":"uint256"}],"name":"T1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId1","type":"uint256"},{"internalType":"uint256","name":"nftId2","type":"uint256"},{"internalType":"uint256","name":"nftId3","type":"uint256"}],"name":"addMonsters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"addTrusted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"allFighters","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"defenceFor","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endFightBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"enemy","type":"address"}],"name":"fight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"fightNumber","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"fightersIndexer","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gen","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getFighterInfo","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"seed1","type":"uint256"},{"internalType":"uint8","name":"health1","type":"uint8"},{"internalType":"uint256","name":"seed2","type":"uint256"},{"internalType":"uint8","name":"health2","type":"uint8"},{"internalType":"uint256","name":"seed3","type":"uint256"},{"internalType":"uint8","name":"health3","type":"uint8"},{"internalType":"uint256","name":"coins","type":"uint256"},{"internalType":"uint256","name":"name","type":"uint256"},{"internalType":"uint8","name":"fights","type":"uint8"}],"internalType":"struct Arena.FighterInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFightersInfo","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"seed1","type":"uint256"},{"internalType":"uint8","name":"health1","type":"uint8"},{"internalType":"uint256","name":"seed2","type":"uint256"},{"internalType":"uint8","name":"health2","type":"uint8"},{"internalType":"uint256","name":"seed3","type":"uint256"},{"internalType":"uint8","name":"health3","type":"uint8"},{"internalType":"uint256","name":"coins","type":"uint256"},{"internalType":"uint256","name":"name","type":"uint256"},{"internalType":"uint8","name":"fights","type":"uint8"}],"internalType":"struct Arena.FighterInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"internalType":"enum Arena.State","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"health","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"leave","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTeam","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"money","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"moneyFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nft","outputs":[{"internalType":"contract BeastNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"removeTrusted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"beforePreparing","type":"uint256"},{"internalType":"uint256","name":"preparing","type":"uint256"},{"internalType":"uint256","name":"fighting","type":"uint256"},{"internalType":"uint256","name":"_cost","type":"uint256"}],"name":"start","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startFightBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startPreparingBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"strengthFor","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"teams","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"enemy","type":"address"}],"name":"test","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[3]","name":"team","type":"uint256[3]"}],"name":"totalHealth","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"min","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"updateMinMax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usersCount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usersLimit","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526005805460ff60a01b1916600360a01b1790556008805463ffffffff1916621e000017905560016009556003600a553480156200004057600080fd5b5060405162003cf438038062003cf48339810160408190526200006391620000ef565b60006200006f620000eb565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600480546001600160a01b039384166001600160a01b0319918216179091556005805492909316911617905562000146565b3390565b6000806040838503121562000102578182fd5b82516200010f816200012d565b602084015190925062000122816200012d565b809150509250929050565b6001600160a01b03811681146200014357600080fd5b50565b613b9e80620001566000396000f3fe608060405234801561001057600080fd5b50600436106102485760003560e01c8063853828b61161013b578063c7672e4f116100b8578063d55e62a01161007c578063d55e62a014610493578063d66d9e19146104a6578063dc48384c146104ae578063f0ee1cc4146104c1578063f2fde38b146104d457610248565b8063c7672e4f1461044a578063cc06c35914610452578063d0d05c9c1461045a578063d1f3e67f1461046d578063d4d0d6e61461048057610248565b8063af156f0e116100ff578063af156f0e146103ff578063b42dfa0d14610407578063bb29998e1461040f578063bdf0983d14610422578063bf03a5751461044257610248565b8063853828b6146103d75780638da5cb5b146103df57806395851a65146103e757806395c71157146103ef57806396fe4288146103f757610248565b80634d4ca7d4116101c9578063707a4e961161018d578063707a4e9614610383578063715018a614610396578063751fb3021461039e5780637621724e146103b1578063783b6d60146103c457610248565b80634d4ca7d4146103205780635b6887c714610333578063644b375e1461034657806367877474146103595780636ba13a821461036e57610248565b8063188a135311610210578063188a1353146102bb5780632302da80146102db5780633bbd391e146102ee57806347ccca02146103035780634ae3b5761461031857610248565b806313faede61461024d578063150b7a021461026b57806315e1f7cd1461028b57806316f0115b1461029e5780631865c57d146102a6575b600080fd5b6102556104e7565b60405161026291906138b9565b60405180910390f35b61027e61027936600461300b565b6104ed565b604051610262919061350d565b610255610299366004612fd3565b6104fd565b61025561050f565b6102ae610515565b6040516102629190613522565b6102ce6102c9366004612fd3565b610554565b60405161026291906138d3565b6102ce6102e93660046131dc565b610569565b6103016102fc3660046132eb565b6105b7565b005b61030b61060a565b604051610262919061346d565b610255610619565b6102ce61032e3660046132bb565b61061f565b61030161034136600461330c565b610745565b610301610354366004612fd3565b611046565b6103616118a6565b60405161026291906134be565b610376611998565b60405161026291906138aa565b610301610391366004613337565b6119a2565b610301611a4a565b6102556103ac3660046132bb565b611ad3565b6102ce6103bf3660046132bb565b611af4565b6102ce6103d23660046132bb565b611c11565b610301611c26565b61030b611d00565b610301611cfe565b6102ce611d0f565b610255611d1f565b610255611d25565b61030b611d2b565b61030161041d366004612fd3565b611d3a565b610435610430366004612fd3565b611eac565b60405161026291906137b7565b61037661214d565b61025561215d565b610255612163565b610376610468366004612fd3565b612169565b61030b61047b366004613299565b61217f565b61030161048e366004612fd3565b61219a565b6103016104a1366004612fd3565b6121fd565b61030161225d565b6102556104bc366004612fd3565b61292c565b6102556104cf3660046130c7565b612947565b6103016104e2366004612fd3565b61296c565b60075481565b630a85bd0160e11b949350505050565b600e6020526000908152604090205481565b60065481565b600060015443101561052957506000610551565b60025443101561053b57506001610551565b60035443111561054d57506003610551565b5060025b90565b600d6020526000908152604090205460ff1681565b6040808201516000908152600c602090815282822054908401518252828220548451835292822054919260ff918216926105a7929182169116613949565b6105b19190613949565b92915050565b6105bf612a2c565b6001600160a01b03166105d0611d00565b6001600160a01b0316146105ff5760405162461bcd60e51b81526004016105f6906136de565b60405180910390fd5b600991909155600a55565b6004546001600160a01b031681565b60025481565b6004805460405163154edcb960e01b815260009283926001600160a01b03169163154edcb991610651918791016138b9565b60006040518083038186803b15801561066957600080fd5b505afa15801561067d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106a591908101906130f2565b9050600560005b825181101561073d578281815181106106d557634e487b7160e01b600052603260045260246000fd5b602002602001015160200151604001516002141561072b5782818151811061070d57634e487b7160e01b600052603260045260246000fd5b60200260200101516020015160200151826107289190613931565b91505b8061073581613abf565b9150506106ac565b509392505050565b60025443106107665760405162461bcd60e51b81526004016105f690613683565b600480546040516331a9108f60e11b815233926001600160a01b0390921691636352211e91610797918891016138b9565b60206040518083038186803b1580156107af57600080fd5b505afa1580156107c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e79190612fef565b6001600160a01b03161461080d5760405162461bcd60e51b81526004016105f6906136b3565b600480546040516331a9108f60e11b815233926001600160a01b0390921691636352211e9161083e918791016138b9565b60206040518083038186803b15801561085657600080fd5b505afa15801561086a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088e9190612fef565b6001600160a01b0316146108b45760405162461bcd60e51b81526004016105f6906136b3565b600480546040516331a9108f60e11b815233926001600160a01b0390921691636352211e916108e5918691016138b9565b60206040518083038186803b1580156108fd57600080fd5b505afa158015610911573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109359190612fef565b6001600160a01b03161461095b5760405162461bcd60e51b81526004016105f6906136b3565b60048054604051632518058d60e01b81526000926001600160a01b0390921691632518058d9161098d918891016138b9565b60206040518083038186803b1580156109a557600080fd5b505afa1580156109b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109dd91906132d3565b60048054604051632518058d60e01b81529293506000926001600160a01b0390911691632518058d91610a12918891016138b9565b60206040518083038186803b158015610a2a57600080fd5b505afa158015610a3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6291906132d3565b60048054604051632518058d60e01b81529293506000926001600160a01b0390911691632518058d91610a97918891016138b9565b60206040518083038186803b158015610aaf57600080fd5b505afa158015610ac3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae791906132d3565b9050600954831015610b0b5760405162461bcd60e51b81526004016105f690613713565b600954821015610b2d5760405162461bcd60e51b81526004016105f690613713565b600954811015610b4f5760405162461bcd60e51b81526004016105f690613713565b600a54831115610b715760405162461bcd60e51b81526004016105f690613713565b600a54821115610b935760405162461bcd60e51b81526004016105f690613713565b600a54811115610bb55760405162461bcd60e51b81526004016105f690613713565b60085461ffff6201000082048116911610610be25760405162461bcd60e51b81526004016105f690613633565b336000908152600b6020526040908190208781556001810187905560020185905560048054915163d6fafde560e01b81526001600160a01b039092169163d6fafde591610c31918a91016138b9565b60606040518083038186803b158015610c4957600080fd5b505afa158015610c5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c81919061327e565b516000878152600c602052604090819020805460ff191660ff9093169290921790915560048054915163d6fafde560e01b81526001600160a01b039092169163d6fafde591610cd2918991016138b9565b60606040518083038186803b158015610cea57600080fd5b505afa158015610cfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d22919061327e565b516000868152600c602052604090819020805460ff191660ff9093169290921790915560048054915163d6fafde560e01b81526001600160a01b039092169163d6fafde591610d73918891016138b9565b60606040518083038186803b158015610d8b57600080fd5b505afa158015610d9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc3919061327e565b516000858152600c60209081526040808320805460ff90951660ff19909516949094179093556008805461ffff90811684526010835284842080546001600160a01b031916339081179091558254908552600f909352938320805461ffff19169285169290921790915580549092169190610e3d83613a9d565b825461ffff9182166101009390930a92830291909202199091161790555060048054604051632142170760e11b81526001600160a01b03909116916342842e0e91610e8e91339130918c9101613481565b600060405180830381600087803b158015610ea857600080fd5b505af1158015610ebc573d6000803e3d6000fd5b505060048054604051632142170760e11b81526001600160a01b0390911693506342842e0e9250610ef391339130918b9101613481565b600060405180830381600087803b158015610f0d57600080fd5b505af1158015610f21573d6000803e3d6000fd5b505060048054604051632142170760e11b81526001600160a01b0390911693506342842e0e9250610f5891339130918a9101613481565b600060405180830381600087803b158015610f7257600080fd5b505af1158015610f86573d6000803e3d6000fd5b50506005546007546040516323b872dd60e01b81526001600160a01b0390921693506323b872dd9250610fbf9133913091600401613481565b602060405180830381600087803b158015610fd957600080fd5b505af1158015610fed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611011919061325e565b50600754336000908152600e6020526040812082905560068054909190611039908490613931565b9091555050505050505050565b336000908152600d6020526040902054600760ff9091161061107a5760405162461bcd60e51b81526004016105f690613609565b336000908152600b6020526040808220815160608101928390526110be9290919060039082845b8154815260200190600101908083116110a1575050505050610569565b60ff16116110de5760405162461bcd60e51b81526004016105f690613658565b6001600160a01b0381166000908152600b602090815260408083208151606081019283905281548152611128939092600391600184019085018083116110a1575050505050610569565b60ff16116111485760405162461bcd60e51b81526004016105f690613658565b6000620186a0611159600143613a37565b61116491904061398f565b905060006111776402540be4008361398f565b6011805460018101825560009182527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c680184905560408051600680825260e08201909252929350909182918291906020820160c08036833701905050905060005b60038160ff16101561148757336000908152600b60205260408120600c90829060ff85166003811061121a57634e487b7160e01b600052603260045260246000fd5b0154815260208101919091526040016000205460ff1611156112c85760008160ff1661124883338b8b612a30565b61125390600a6139c5565b61125d919061390b565b905061126b8161271061390b565b83611277846002613a0e565b60ff168151811061129857634e487b7160e01b600052603260045260246000fd5b61ffff909216602092830291909101909101526112b660648261396e565b6112c09086613949565b94505061130e565b6000826112d6836002613a0e565b60ff16815181106112f757634e487b7160e01b600052603260045260246000fd5b602002602001019061ffff16908161ffff16815250505b61131a6103e88761398f565b6001600160a01b0388166000908152600b6020526040812091975090600c90829060ff85166003811061135d57634e487b7160e01b600052603260045260246000fd5b0154815260208101919091526040016000205460ff1611156114165760008160ff1661138b838a338a612a30565b61139690600a6139c5565b6113a0919061390b565b90506113ae8161271061390b565b836113ba846002613a0e565b6113c5906001613949565b60ff16815181106113e657634e487b7160e01b600052603260045260246000fd5b61ffff9092166020928302919091019091015261140460648261396e565b61140e9085613949565b935050611467565b600082611424836002613a0e565b61142f906001613949565b60ff168151811061145057634e487b7160e01b600052603260045260246000fd5b602002602001019061ffff16908161ffff16815250505b6114736103e88661398f565b94508061147f81613ada565b9150506111d8565b50336000908152600d60205260408120805460ff16916114a683613ada565b91906101000a81548160ff021916908360ff1602179055505060006114ca3361292c565b905060006114d78861292c565b336000908152600b6020526040808220815160608101909252929350909182916115239160038282826020028201918154815260200190600101908083116110a1575050505050610569565b6001600160a01b038b166000908152600b60209081526040808320815160608101928390528154815260ff959095169590951195509193849361157e93909260039190600184019085018083116110a1575050505050610569565b60ff16119050600080831561162d578760ff168960ff161015806115a0575082155b1561162d5760646115b286601e6139ef565b6115bc919061398f565b915060646115cb86601e6139ef565b6115d5919061398f565b6115df9087613931565b336000908152600e602052604090205560646115fc86601e6139ef565b611606919061398f565b6116109086613a37565b6001600160a01b038d166000908152600e60205260409020555060015b82156116cf578760ff168960ff161080611645575083155b156116cf57606461165787601e6139ef565b611661919061398f565b9150606461167087601e6139ef565b61167a919061398f565b6116849087613a37565b336000908152600e602052604090205560646116a187601e6139ef565b6116ab919061398f565b6116b59086613931565b6001600160a01b038d166000908152600e60205260409020555b6001600160a01b038c166000908152600b6020526040808220815160608101928390529160039082845b8154815260200190600101908083116116f95750506040805161016081018252338082526000908152600b60209081529281209697507fd482f73a7a77263cb58176e057e49f963f99b6bd36be0d0b3c9e7fe05d89c5e4969195509185019350600c92508101548152602080820192909252604090810160009081205460ff168452338152600b83529081209290910191600c9190600101548152602080820192909252604090810160009081205460ff168452338152600b83529081209290910191600c919060020154815260200190815260200160002060009054906101000a900460ff1660ff1681526020018f6001600160a01b03168152602001600c60008560006003811061181c57634e487b7160e01b600052603260045260246000fd5b60209081029190910151825281810192909252604090810160009081205460ff9081168552878401518252600c808552838320548216868601528884015183529093528190205490911682820152606082018c90526080820187905285151560a0909201919091525161188f91906137c6565b60405180910390a150505050505050505050505050565b60085460609060009061ffff1667ffffffffffffffff8111156118d957634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561191257816020015b6118ff612f10565b8152602001906001900390816118f75790505b50905060005b60085461ffff90811690821610156119925761ffff8116600090815260106020526040902054611950906001600160a01b0316611eac565b828261ffff168151811061197457634e487b7160e01b600052603260045260246000fd5b6020026020010181905250808061198a90613a9d565b915050611918565b50905090565b60085461ffff1681565b6119aa612a2c565b6001600160a01b03166119bb611d00565b6001600160a01b0316146119e15760405162461bcd60e51b81526004016105f6906136de565b6119ec8460146139ef565b6119f69043613931565b600155611a048360146139ef565b600154611a119190613931565b600255611a1f8260146139ef565b600254611a2c9190613931565b600355611a4181670de0b6b3a76400006139ef565b60075550505050565b611a52612a2c565b6001600160a01b0316611a63611d00565b6001600160a01b031614611a895760405162461bcd60e51b81526004016105f6906136de565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60118181548110611ae357600080fd5b600091825260209091200154905081565b6004805460405163154edcb960e01b815260009283926001600160a01b03169163154edcb991611b26918791016138b9565b60006040518083038186803b158015611b3e57600080fd5b505afa158015611b52573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b7a91908101906130f2565b90506000805b825181101561073d57828181518110611ba957634e487b7160e01b600052603260045260246000fd5b6020026020010151602001516040015160031415611bff57828181518110611be157634e487b7160e01b600052603260045260246000fd5b6020026020010151602001516020015182611bfc9190613931565b91505b80611c0981613abf565b915050611b80565b600c6020526000908152604090205460ff1681565b611c2e612a2c565b6001600160a01b0316611c3f611d00565b6001600160a01b031614611c655760405162461bcd60e51b81526004016105f6906136de565b6005546040516370a0823160e01b8152611cfe9133916001600160a01b03909116906370a0823190611c9b90309060040161346d565b60206040518083038186803b158015611cb357600080fd5b505afa158015611cc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ceb91906132d3565b6005546001600160a01b03169190612d0e565b565b6000546001600160a01b031690565b600554600160a01b900460ff1681565b60095481565b60035481565b6005546001600160a01b031681565b336000818152600b6020908152604080832060158155601660018083019190915560176002928301556001600160a01b039690961680855282852060188155601997810197909755601a96909101869055938352600e8252808320602190819055938352822092909255600c9091527ff77830ee6ca813461e84e66f2fead14ff7f40269cd63d8faab5b6ce1c3d8c07e8054605060ff1991821681179092557f9fe279e833bcb8beab045538c3e47062dba2173d3cb9299210a3ae3478eac49d80548216831790557f6422c4859a0e1cfb624515c5474fb4780841aa90bef78e8ffd8411f6df3c00a780548216831790557f591a7551fcdfca13c6240947c6945b1b81f85a820d3ef46ea582217b1dd8071980548216831790557f40f1108237696bbe60a17fe2a155c116be4dd3f1a51814bfd40efec622f2b4bc8054821683179055929091527fd8dac8cb0b26825dac24b42aca725ffacbadc03e2a42734896eb984ce196259d8054909216179055565b611eb4612f10565b60408051610140810182526001600160a01b03848116808352600480546000928352600b602090815292869020549551630c4e4ae560e01b8152949592860194931692630c4e4ae592611f09929091016138b9565b60206040518083038186803b158015611f2157600080fd5b505afa158015611f35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5991906132d3565b81526001600160a01b038481166000818152600b6020818152604080842080548552600c83528185205460ff16838901526004805496909552929091526001909101548151630c4e4ae560e01b815291909501949290931692630c4e4ae592611fc4929091016138b9565b60206040518083038186803b158015611fdc57600080fd5b505afa158015611ff0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061201491906132d3565b81526001600160a01b038481166000818152600b6020818152604080842060018101548552600c83528185205460ff16838901526004805496909552929091526002909101548151630c4e4ae560e01b815291909501949290931692630c4e4ae592612082929091016138b9565b60206040518083038186803b15801561209a57600080fd5b505afa1580156120ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d291906132d3565b81526001600160a01b0384166000908152600b60209081526040808320600201548352600c8252918290205460ff16908301520161210f8461292c565b81526001600160a01b0384166000818152600f602090815260408083205461ffff1682860152928252600d90528190205460ff169101529050919050565b60085462010000900461ffff1681565b60015481565b600a5481565b600f6020526000908152604090205461ffff1681565b6010602052600090815260409020546001600160a01b031681565b6121a2612a2c565b6001600160a01b03166121b3611d00565b6001600160a01b0316146121d95760405162461bcd60e51b81526004016105f6906136de565b6001600160a01b03166000908152601260205260409020805460ff19166001179055565b612205612a2c565b6001600160a01b0316612216611d00565b6001600160a01b03161461223c5760405162461bcd60e51b81526004016105f6906136de565b6001600160a01b03166000908152601260205260409020805460ff19169055565b6003612267610515565b600381111561228657634e487b7160e01b600052602160045260246000fd5b146122a35760405162461bcd60e51b81526004016105f690613683565b336000908152600b60205260408082208054600182015460029092015460048054945163d84b236160e01b8152929593949193926001600160a01b039092169163d84b2361916122f5918891016138b9565b60206040518083038186803b15801561230d57600080fd5b505afa158015612321573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612345919061325e565b156123d857600454336000908152600d60205260409020546001600160a01b039091169063adcbf3299086906123809060039060ff166139a3565b6040518363ffffffff1660e01b815260040161239d9291906138c2565b600060405180830381600087803b1580156123b757600080fd5b505af11580156123cb573d6000803e3d6000fd5b505050506001905061243a565b60048054604051638baecc2160e01b81526001600160a01b0390911691638baecc2191612407918891016138b9565b600060405180830381600087803b15801561242157600080fd5b505af1158015612435573d6000803e3d6000fd5b505050505b6004805460405163d84b236160e01b81526001600160a01b039091169163d84b236191612469918791016138b9565b60206040518083038186803b15801561248157600080fd5b505afa158015612495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124b9919061325e565b1561254c57600454336000908152600d60205260409020546001600160a01b039091169063adcbf3299085906124f49060039060ff166139a3565b6040518363ffffffff1660e01b81526004016125119291906138c2565b600060405180830381600087803b15801561252b57600080fd5b505af115801561253f573d6000803e3d6000fd5b50505050600190506125ae565b60048054604051638baecc2160e01b81526001600160a01b0390911691638baecc219161257b918791016138b9565b600060405180830381600087803b15801561259557600080fd5b505af11580156125a9573d6000803e3d6000fd5b505050505b6004805460405163d84b236160e01b81526001600160a01b039091169163d84b2361916125dd918691016138b9565b60206040518083038186803b1580156125f557600080fd5b505afa158015612609573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262d919061325e565b156126c057600454336000908152600d60205260409020546001600160a01b039091169063adcbf3299084906126689060039060ff166139a3565b6040518363ffffffff1660e01b81526004016126859291906138c2565b600060405180830381600087803b15801561269f57600080fd5b505af11580156126b3573d6000803e3d6000fd5b5050505060019050612722565b60048054604051638baecc2160e01b81526001600160a01b0390911691638baecc21916126ef918691016138b9565b600060405180830381600087803b15801561270957600080fd5b505af115801561271d573d6000803e3d6000fd5b505050505b336000908152600d6020526040902054600360ff9091161080159061274957506001811515145b156127da576005546001600160a01b031663a9059cbb336127698161292c565b6040518363ffffffff1660e01b81526004016127869291906134a5565b602060405180830381600087803b1580156127a057600080fd5b505af11580156127b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d8919061325e565b505b60048054604051632142170760e11b81526001600160a01b03909116916342842e0e9161280d91309133918a9101613481565b600060405180830381600087803b15801561282757600080fd5b505af115801561283b573d6000803e3d6000fd5b505060048054604051632142170760e11b81526001600160a01b0390911693506342842e0e92506128729130913391899101613481565b600060405180830381600087803b15801561288c57600080fd5b505af11580156128a0573d6000803e3d6000fd5b505060048054604051632142170760e11b81526001600160a01b0390911693506342842e0e92506128d79130913391889101613481565b600060405180830381600087803b1580156128f157600080fd5b505af1158015612905573d6000803e3d6000fd5b5050336000908152600b602052604081208181556001810182905560020155505050505050565b6001600160a01b03166000908152600e602052604090205490565b600b602052816000526040600020816003811061296357600080fd5b01549150829050565b612974612a2c565b6001600160a01b0316612985611d00565b6001600160a01b0316146129ab5760405162461bcd60e51b81526004016105f6906136de565b6001600160a01b0381166129d15760405162461bcd60e51b81526004016105f69061357d565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b0383166000908152600b60205260408120819060ff871660038110612a6c57634e487b7160e01b600052603260045260246000fd5b01546001600160a01b0385166000908152600b60205260408120919250908790600c90839060ff841660038110612ab357634e487b7160e01b600052603260045260246000fd5b0154815260208101919091526040016000205460ff16612b535760005b60038160ff161015612b51576001600160a01b0387166000908152600b60205260408120600c90829060ff851660038110612b1b57634e487b7160e01b600052603260045260246000fd5b0154815260208101919091526040016000205460ff161115612b3f57809150612b51565b80612b4981613ada565b915050612ad0565b505b6001600160a01b0386166000908152600b6020526040812060ff831660038110612b8d57634e487b7160e01b600052603260045260246000fd5b01546000818152600c602052604090205490915060ff168015612ce7576001600160a01b0388166000908152600b60205260409020612bef9060ff851660038110612be857634e487b7160e01b600052603260045260246000fd5b0154611af4565b60ff16612bfd600a89613afa565b10612ce757612c0b8561061f565b60ff16612c1a6103e889613afa565b612c249190613afa565b612c2f906001613931565b93508360ff168160ff161115612c6e57612c498482613a4e565b6000838152600c60205260409020805460ff191660ff92909216919091179055612ce7565b6000828152600c602052604090819020805460ff1916905560048054915163d29a002560e01b81526001600160a01b039092169163d29a002591612cb4918691016138b9565b600060405180830381600087803b158015612cce57600080fd5b505af1158015612ce2573d6000803e3d6000fd5b505050505b82612cf385600a613a0e565b612cfd9190613949565b60ff169a9950505050505050505050565b612d648363a9059cbb60e01b8484604051602401612d2d9291906134a5565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612d69565b505050565b6000612dbe826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612df89092919063ffffffff16565b805190915015612d645780806020019051810190612ddc919061325e565b612d645760405162461bcd60e51b81526004016105f69061376d565b6060612e078484600085612e11565b90505b9392505050565b606082471015612e335760405162461bcd60e51b81526004016105f6906135c3565b612e3c85612ed1565b612e585760405162461bcd60e51b81526004016105f690613736565b600080866001600160a01b03168587604051612e749190613451565b60006040518083038185875af1925050503d8060008114612eb1576040519150601f19603f3d011682016040523d82523d6000602084013e612eb6565b606091505b5091509150612ec6828286612ed7565b979650505050505050565b3b151590565b60608315612ee6575081612e0a565b825115612ef65782518084602001fd5b8160405162461bcd60e51b81526004016105f6919061354a565b60405180610140016040528060006001600160a01b0316815260200160008152602001600060ff16815260200160008152602001600060ff16815260200160008152602001600060ff1681526020016000815260200160008152602001600060ff1681525090565b600060608284031215612f89578081fd5b6040516060810181811067ffffffffffffffff82111715612fac57612fac613b3a565b80604052508091508251815260208301516020820152604083015160408201525092915050565b600060208284031215612fe4578081fd5b8135612e0a81613b50565b600060208284031215613000578081fd5b8151612e0a81613b50565b60008060008060808587031215613020578283fd5b843561302b81613b50565b935060208581013561303c81613b50565b935060408601359250606086013567ffffffffffffffff8082111561305f578384fd5b818801915088601f830112613072578384fd5b81358181111561308457613084613b3a565b613096601f8201601f191685016138e1565b915080825289848285010111156130ab578485fd5b8084840185840137810190920192909252939692955090935050565b600080604083850312156130d9578182fd5b82356130e481613b50565b946020939093013593505050565b60006020808385031215613104578182fd5b825167ffffffffffffffff8082111561311b578384fd5b818501915085601f83011261312e578384fd5b81518181111561314057613140613b3a565b61314d84858302016138e1565b818152848101908486016080808502870188018b101561316b578889fd5b8896505b848710156131cd5780828c031215613185578889fd5b6040805181810181811089821117156131a0576131a0613b3a565b8252835181526131b28d8b8601612f78565b818b015285525060019690960195928701929081019061316f565b50909998505050505050505050565b6000606082840312156131ed578081fd5b82601f8301126131fb578081fd5b6040516060810181811067ffffffffffffffff8211171561321e5761321e613b3a565b604052808360608101861015613232578384fd5b835b6003811015613253578135835260209283019290910190600101613234565b509195945050505050565b60006020828403121561326f578081fd5b81518015158114612e0a578182fd5b60006060828403121561328f578081fd5b612e0a8383612f78565b6000602082840312156132aa578081fd5b813561ffff81168114612e0a578182fd5b6000602082840312156132cc578081fd5b5035919050565b6000602082840312156132e4578081fd5b5051919050565b600080604083850312156132fd578182fd5b50508035926020909101359150565b600080600060608486031215613320578081fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561334c578182fd5b5050823594602084013594506040840135936060013592509050565b6001600160a01b03169052565b6000815180845260208085019450808401835b838110156133a857815161ffff1687529582019590820190600101613388565b509495945050505050565b15159052565b6133c4828251613368565b6020810151602083015260408101516133e0604084018261344a565b506060810151606083015260808101516133fd608084018261344a565b5060a081015160a083015260c081015161341a60c084018261344a565b5060e081015160e0830152610100808201518184015250610120808201516134448285018261344a565b50505050565b60ff169052565b60008251613463818460208701613a71565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015613501576134ed8385516133b9565b9284019261014092909201916001016134da565b50909695505050505050565b6001600160e01b031991909116815260200190565b602081016004831061354457634e487b7160e01b600052602160045260246000fd5b91905290565b6000602082528251806020840152613569816040850160208701613a71565b601f01601f19169190910160400192915050565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b60208082526010908201526f746f6f206d7563682061747461636b7360801b604082015260600190565b6020808252600b908201526a1d5cd95c9cc8131a5b5a5d60aa1b604082015260600190565b6020808252601190820152700b2deea40d0c2ecca406040d0cac2d8e8d607b1b604082015260600190565b60208082526016908201527510985d1d1b1948185b1c9958591e481cdd185c9d195960521b604082015260600190565b6020808252601190820152703cb7ba9030b932903737ba1037bbb732b960791b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b602080825260099082015268191bdb89dd08199a5d60ba1b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b61014081016105b182846133b9565b6000602082526137da602083018451613368565b60208301516137ec604084018261344a565b5060408301516137ff606084018261344a565b506060830151613812608084018261344a565b50608083015161382560a0840182613368565b5060a083015161383860c084018261344a565b5060c083015161384b60e084018261344a565b5060e08301516101006138608185018361344a565b808501519150506101606101208181860152613880610180860184613375565b90860151610140868101919091528601519092506138a0828601826133b3565b5090949350505050565b61ffff91909116815260200190565b90815260200190565b91825260ff16602082015260400190565b60ff91909116815260200190565b60405181810167ffffffffffffffff8111828210171561390357613903613b3a565b604052919050565b600061ffff80831681851680830382111561392857613928613b0e565b01949350505050565b6000821982111561394457613944613b0e565b500190565b600060ff821660ff84168060ff0382111561396657613966613b0e565b019392505050565b600061ffff8084168061398357613983613b24565b92169190910492915050565b60008261399e5761399e613b24565b500490565b600060ff8316806139b6576139b6613b24565b8060ff84160491505092915050565b600061ffff808316818516818304811182151516156139e6576139e6613b0e565b02949350505050565b6000816000190483118215151615613a0957613a09613b0e565b500290565b600060ff821660ff84168160ff0481118215151615613a2f57613a2f613b0e565b029392505050565b600082821015613a4957613a49613b0e565b500390565b600060ff821660ff841680821015613a6857613a68613b0e565b90039392505050565b60005b83811015613a8c578181015183820152602001613a74565b838111156134445750506000910152565b600061ffff80831681811415613ab557613ab5613b0e565b6001019392505050565b6000600019821415613ad357613ad3613b0e565b5060010190565b600060ff821660ff811415613af157613af1613b0e565b60010192915050565b600082613b0957613b09613b24565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114613b6557600080fd5b5056fea2646970667358221220afa97d4a4118389305e0cd38857f4523ff76e0afa10035a5192f11bed21a275564736f6c6343000800003300000000000000000000000070a97718c84673bc02993ca4285e7b655232fa97000000000000000000000000b0f2939a1c0e43683e5954c9fe142f7df9f8d967

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

00000000000000000000000070a97718c84673bc02993ca4285e7b655232fa97000000000000000000000000b0f2939a1c0e43683e5954c9fe142f7df9f8d967
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000070a97718c84673bc02993ca4285e7b655232fa97
Arg [1] : 000000000000000000000000b0f2939a1c0e43683e5954c9fe142f7df9f8d967


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading