ETH Price: $3,243.71 (-9.60%)
Gas: 58 Gwei

Contract

0x57f0B53926dd62f2E26bc40B30140AbEA474DA94
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Set Approval For...190698102024-01-23 13:57:1155 days ago1706018231IN
VeryNifty: VNFT Token
0 ETH0.0004046916.63145776
Set Approval For...186472652023-11-25 7:37:11115 days ago1700897831IN
VeryNifty: VNFT Token
0 ETH0.0013336128.89042568
Set Approval For...182088072023-09-24 23:03:11176 days ago1695596591IN
VeryNifty: VNFT Token
0 ETH0.000333667.22838694
Set Approval For...181976242023-09-23 9:27:35178 days ago1695461255IN
VeryNifty: VNFT Token
0 ETH0.00036337.87046359
Safe Transfer Fr...181970732023-09-23 7:36:59178 days ago1695454619IN
VeryNifty: VNFT Token
0 ETH0.0026747422.38689271
Set Approval For...181319112023-09-14 3:42:35187 days ago1694662955IN
VeryNifty: VNFT Token
0 ETH0.000371515.26737269
Safe Transfer Fr...177588012023-07-23 22:29:47239 days ago1690151387IN
VeryNifty: VNFT Token
0 ETH0.0025598122.20234795
Set Approval For...175213072023-06-20 13:48:35272 days ago1687268915IN
VeryNifty: VNFT Token
0 ETH0.0004396118.06672186
Set Approval For...170100482023-04-09 10:06:59345 days ago1681034819IN
VeryNifty: VNFT Token
0 ETH0.0004904720.15663568
Set Approval For...169563162023-04-01 19:16:23352 days ago1680376583IN
VeryNifty: VNFT Token
0 ETH0.0008805519.04107345
Set Approval For...169245002023-03-28 7:57:47357 days ago1679990267IN
VeryNifty: VNFT Token
0 ETH0.0011639325.16881161
Set Approval For...167901752023-03-09 10:51:59376 days ago1678359119IN
VeryNifty: VNFT Token
0 ETH0.0010155422
Transfer From167899812023-03-09 10:13:11376 days ago1678356791IN
VeryNifty: VNFT Token
0 ETH0.0027663824.7382773
Set Approval For...167438992023-03-02 22:41:35382 days ago1677796895IN
VeryNifty: VNFT Token
0 ETH0.0011048623.93510332
Set Approval For...167071112023-02-25 18:36:23387 days ago1677350183IN
VeryNifty: VNFT Token
0 ETH0.000902219.54483296
Recover ERC20165785952023-02-07 18:08:59405 days ago1675793339IN
VeryNifty: VNFT Token
0 ETH0.0029495569.18485773
Recover ERC20165785892023-02-07 18:07:35405 days ago1675793255IN
VeryNifty: VNFT Token
0 ETH0.0024034356.37495613
Set Approval For...163802652023-01-11 1:24:23433 days ago1673400263IN
VeryNifty: VNFT Token
0 ETH0.0009526620.63778073
Add Care Taker163263452023-01-03 12:45:47440 days ago1672749947IN
VeryNifty: VNFT Token
0 ETH0.0008153414.86232024
Claim Mining Rew...163262952023-01-03 12:35:47440 days ago1672749347IN
VeryNifty: VNFT Token
0 ETH0.0009201115.35182606
Safe Transfer Fr...163262352023-01-03 12:23:47440 days ago1672748627IN
VeryNifty: VNFT Token
0 ETH0.0016750714.60672989
Set Approval For...162931422022-12-29 21:36:47445 days ago1672349807IN
VeryNifty: VNFT Token
0 ETH0.0007377715.98258733
Set Approval For...162026862022-12-17 6:40:35458 days ago1671259235IN
VeryNifty: VNFT Token
0 ETH0.0006302613.65366381
Set Approval For...160841912022-11-30 17:07:59474 days ago1669828079IN
VeryNifty: VNFT Token
0 ETH0.0006088913.16673185
Set Approval For...159402522022-11-10 14:36:11494 days ago1668090971IN
VeryNifty: VNFT Token
0 ETH0.0028284461.27356938
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VNFT

Compiler Version
v0.6.6+commit.6c089d02

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 18 of 43 : VNFT.sol
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155Holder.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/presets/ERC721PresetMinterPauserAutoId.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

contract TokenRecover is Ownable {
    /**
     * @dev Remember that only owner can call so be careful when use on contracts generated from other contracts.
     * @param tokenAddress The token contract address
     * @param tokenAmount Number of tokens to be sent
     */
    function recoverERC20(address tokenAddress, uint256 tokenAmount)
        public
        onlyOwner
    {
        IERC20(tokenAddress).transfer(owner(), tokenAmount);
    }
}

// Interface for our erc20 token
interface IMuseToken {
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    function mintingFinished() external view returns (bool);

    function mint(address to, uint256 amount) external;

    function burn(uint256 amount) external;

    function burnFrom(address account, uint256 amount) external;
}

/*
 * Deployment checklist::
 *  1. Deploy all contracts
 *  2. Give minter role to the claiming contract
 *  3. Add objects (most basic cost 5 and give 1 day and 1 score)
 *  4.
 */

// ERC721,
contract VNFT is
    Ownable,
    ERC721PresetMinterPauserAutoId,
    TokenRecover,
    ERC1155Holder
{
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
    IMuseToken public muse;

    struct VNFTObj {
        address token;
        uint256 id;
        uint256 standard; //the type
    }

    // Mapping from token ID to NFT struct details
    mapping(uint256 => VNFTObj) public vnftDetails;

    // max dev allocation is 10% of total supply
    uint256 public maxDevAllocation = 100000 * 10**18;
    uint256 public devAllocation = 0;

    // External NFTs
    struct NFTInfo {
        address token; // Address of LP token contract.
        bool active;
        uint256 standard; //the nft standard ERC721 || ERC1155
    }

    NFTInfo[] public supportedNfts;

    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;
    Counters.Counter private _itemIds;

    // how many tokens to burn every time the VNFT is given an accessory, the remaining goes to the community and devs
    uint256 public burnPercentage = 90;
    uint256 public giveLifePrice = 5 * 10**18;

    bool public gameStopped = false;

    // mining tokens
    mapping(uint256 => uint256) public lastTimeMined;

    // VNFT properties
    mapping(uint256 => uint256) public timeUntilStarving;
    mapping(uint256 => uint256) public vnftScore;
    mapping(uint256 => uint256) public timeVnftBorn;

    // items/benefits for the VNFT could be anything in the future.
    mapping(uint256 => uint256) public itemPrice;
    mapping(uint256 => uint256) public itemPoints;
    mapping(uint256 => string) public itemName;
    mapping(uint256 => uint256) public itemTimeExtension;

    // mapping(uint256 => address) public careTaker;
    mapping(uint256 => mapping(address => address)) public careTaker;

    event BurnPercentageChanged(uint256 percentage);
    event ClaimedMiningRewards(uint256 who, address owner, uint256 amount);
    event VnftConsumed(uint256 nftId, address giver, uint256 itemId);
    event VnftMinted(address to);
    event VnftFatalized(uint256 nftId, address killer);
    event ItemCreated(uint256 id, string name, uint256 price, uint256 points);
    event LifeGiven(address forSupportedNFT, uint256 id);
    event Unwrapped(uint256 nftId);
    event CareTakerAdded(uint256 nftId, address _to);
    event CareTakerRemoved(uint256 nftId);

    constructor(address _museToken)
        public
        ERC721PresetMinterPauserAutoId(
            "VNFT",
            "VNFT",
            "https://gallery.verynify.io/api/"
        )
    {
        _setupRole(OPERATOR_ROLE, _msgSender());
        muse = IMuseToken(_museToken);
    }

    modifier notPaused() {
        require(!gameStopped, "Contract is paused");
        _;
    }

    modifier onlyOperator() {
        require(
            hasRole(OPERATOR_ROLE, _msgSender()),
            "Roles: caller does not have the OPERATOR role"
        );
        _;
    }

    modifier onlyMinter() {
        require(
            hasRole(MINTER_ROLE, _msgSender()),
            "Roles: caller does not have the MINTER role"
        );
        _;
    }

    function contractURI() public pure returns (string memory) {
        return "https://gallery.verynifty.io/api";
    }

    // in case a bug happens or we upgrade to another smart contract
    function pauseGame(bool _pause) external onlyOperator {
        gameStopped = _pause;
    }

    // change how much to burn on each buy and how much goes to community.
    function changeBurnPercentage(uint256 percentage) external onlyOperator {
        require(percentage <= 100);
        burnPercentage = burnPercentage;
        emit BurnPercentageChanged(burnPercentage);
    }

    function changeGiveLifePrice(uint256 _newPrice) external onlyOperator {
        giveLifePrice = _newPrice * 10**18;
    }

    function changeMaxDevAllocation(uint256 amount) external onlyOperator {
        maxDevAllocation = amount;
    }

    function itemExists(uint256 itemId) public view returns (bool) {
        if (bytes(itemName[itemId]).length > 0) {
            return true;
        }
    }

    // check that VNFT didn't starve
    function isVnftAlive(uint256 _nftId) public view returns (bool) {
        uint256 _timeUntilStarving = timeUntilStarving[_nftId];
        if (_timeUntilStarving != 0 && _timeUntilStarving >= block.timestamp) {
            return true;
        }
    }

    function getVnftScore(uint256 _nftId) public view returns (uint256) {
        return vnftScore[_nftId];
    }

    function getItemInfo(uint256 _itemId)
        public
        view
        returns (
            string memory _name,
            uint256 _price,
            uint256 _points,
            uint256 _timeExtension
        )
    {
        _name = itemName[_itemId];
        _price = itemPrice[_itemId];
        _timeExtension = itemTimeExtension[_itemId];
        _points = itemPoints[_itemId];
    }

    function getVnftInfo(uint256 _nftId)
        public
        view
        returns (
            uint256 _vNFT,
            bool _isAlive,
            uint256 _score,
            uint256 _level,
            uint256 _expectedReward,
            uint256 _timeUntilStarving,
            uint256 _lastTimeMined,
            uint256 _timeVnftBorn,
            address _owner,
            address _token,
            uint256 _tokenId,
            uint256 _fatalityReward
        )
    {
        _vNFT = _nftId;
        _isAlive = this.isVnftAlive(_nftId);
        _score = this.getVnftScore(_nftId);
        _level = this.level(_nftId);
        _expectedReward = this.getRewards(_nftId);
        _timeUntilStarving = timeUntilStarving[_nftId];
        _lastTimeMined = lastTimeMined[_nftId];
        _timeVnftBorn = timeVnftBorn[_nftId];
        _owner = this.ownerOf(_nftId);
        _token = vnftDetails[_nftId].token;
        _tokenId = vnftDetails[_nftId].id;
        _fatalityReward = getFatalityReward(_nftId);
    }

    function editCurves(
        uint256 _la,
        uint256 _lb,
        uint256 _ra,
        uint256 _rb
    ) external onlyOperator {
        la = _la;
        lb = _lb;
        ra = _ra;
        lb = _rb;
    }

    uint256 la = 2;
    uint256 lb = 2;
    uint256 ra = 6;
    uint256 rb = 7;

    // get the level the vNFT is on to calculate points
    function level(uint256 tokenId) external view returns (uint256) {
        // This is the formula L(x) = 2 * sqrt(x * 2)
        uint256 _score = vnftScore[tokenId].div(100);
        if (_score == 0) {
            return 1;
        }
        uint256 _level = sqrtu(_score.mul(la));
        return (_level.mul(lb));
    }

    // get the level the vNFT is on to calculate the token reward
    function getRewards(uint256 tokenId) external view returns (uint256) {
        // This is the formula to get token rewards R(level)=(level)*6/7+6
        uint256 _level = this.level(tokenId);
        if (_level == 1) {
            return 6 ether;
        }
        _level = _level.mul(1 ether).mul(ra).div(rb);
        return (_level.add(5 ether));
    }

    // edit specific item in case token goes up in value and the price for items gets to expensive for normal users.
    function editItem(
        uint256 _id,
        uint256 _price,
        uint256 _points,
        string calldata _name,
        uint256 _timeExtension
    ) external onlyOperator {
        itemPrice[_id] = _price;
        itemPoints[_id] = _points;
        itemName[_id] = _name;
        itemTimeExtension[_id] = _timeExtension;
    }

    //can mine once every 24 hours per token.
    function claimMiningRewards(uint256 nftId) external notPaused {
        require(isVnftAlive(nftId), "Your vNFT is dead, you can't mine");
        require(
            block.timestamp >= lastTimeMined[nftId].add(1 days) ||
                lastTimeMined[nftId] == 0,
            "Current timestamp is over the limit to claim the tokens"
        );
        require(
            ownerOf(nftId) == msg.sender ||
                careTaker[nftId][ownerOf(nftId)] == msg.sender,
            "You must own the vNFT to claim rewards"
        );

        //reset last start mined so can't remine and cheat
        lastTimeMined[nftId] = block.timestamp;
        uint256 _reward = this.getRewards(nftId);
        muse.mint(msg.sender, _reward);
        emit ClaimedMiningRewards(nftId, msg.sender, _reward);
    }

    // Buy accesory to the VNFT
    function buyAccesory(uint256 nftId, uint256 itemId) external notPaused {
        require(itemExists(itemId), "This item doesn't exist");
        uint256 amount = itemPrice[itemId];
        require(
            ownerOf(nftId) == msg.sender ||
                careTaker[nftId][ownerOf(nftId)] == msg.sender,
            "You must own the vNFT or be a care taker to buy items"
        );
        // require(isVnftAlive(nftId), "Your vNFT is dead");
        uint256 amountToBurn = amount.mul(burnPercentage).div(100);

        if (!isVnftAlive(nftId)) {
            vnftScore[nftId] = itemPoints[itemId];
            timeUntilStarving[nftId] = block.timestamp.add(
                itemTimeExtension[itemId]
            );
        } else {
            //recalculate timeUntilStarving.
            timeUntilStarving[nftId] = block.timestamp.add(
                itemTimeExtension[itemId]
            );
            vnftScore[nftId] = vnftScore[nftId].add(itemPoints[itemId]);
        }
        // burn 90% so they go back to community mining and staking, and send 10% to devs

        if (devAllocation <= maxDevAllocation) {
            devAllocation = devAllocation.add(amount.sub(amountToBurn));
            muse.transferFrom(msg.sender, address(this), amount);
            // burn 90% of token, 10% stay for dev and community fund
            muse.burn(amountToBurn);
        } else {
            muse.burnFrom(msg.sender, amount);
        }
        emit VnftConsumed(nftId, msg.sender, itemId);
    }

    function setBaseURI(string memory baseURI_) public onlyOperator {
        _setBaseURI(baseURI_);
    }

    function mint(address player) public override onlyMinter {
        //pet minted has 3 days until it starves at first
        timeUntilStarving[_tokenIds.current()] = block.timestamp.add(3 days);
        timeVnftBorn[_tokenIds.current()] = block.timestamp;

        vnftDetails[_tokenIds.current()] = VNFTObj(
            address(this),
            _tokenIds.current(),
            721
        );
        super._mint(player, _tokenIds.current());
        _tokenIds.increment();
        emit VnftMinted(msg.sender);
    }

    // kill starverd NFT and get 10% of his points.
    function fatality(uint256 _deadId, uint256 _tokenId) external notPaused {
        require(
            !isVnftAlive(_deadId),
            "The vNFT has to be starved to claim his points"
        );
        vnftScore[_tokenId] = vnftScore[_tokenId].add(
            (vnftScore[_deadId].mul(60).div(100))
        );
        // delete vnftDetails[_deadId];
        _burn(_deadId);
        emit VnftFatalized(_deadId, msg.sender);
    }

    // Check how much score you'll get by fatality someone.
    function getFatalityReward(uint256 _deadId) public view returns (uint256) {
        if (isVnftAlive(_deadId)) {
            return 0;
        } else {
            return (vnftScore[_deadId].mul(60).div(100));
        }
    }

    // add items/accessories
    function createItem(
        string calldata name,
        uint256 price,
        uint256 points,
        uint256 timeExtension
    ) external onlyOperator returns (bool) {
        _itemIds.increment();
        uint256 newItemId = _itemIds.current();
        itemName[newItemId] = name;
        itemPrice[newItemId] = price * 10**18;
        itemPoints[newItemId] = points;
        itemTimeExtension[newItemId] = timeExtension;
        emit ItemCreated(newItemId, name, price, points);
    }

    //  *****************************
    //  LOGIC FOR EXTERNAL NFTS
    //  ****************************
    // support an external nft to mine rewards and play
    function addNft(address _nftToken, uint256 _type) public onlyOperator {
        supportedNfts.push(
            NFTInfo({token: _nftToken, active: true, standard: _type})
        );
    }

    function supportedNftLength() external view returns (uint256) {
        return supportedNfts.length;
    }

    function updateSupportedNFT(
        uint256 index,
        bool _active,
        address _address
    ) public onlyOperator {
        supportedNfts[index].active = _active;
        supportedNfts[index].token = _address;
    }

    // aka WRAP: lets give life to your erc721 token and make it fun to mint $muse!
    function giveLife(
        uint256 index,
        uint256 _id,
        uint256 nftType
    ) external notPaused {
        uint256 amountToBurn = giveLifePrice.mul(burnPercentage).div(100);

        if (devAllocation <= maxDevAllocation) {
            devAllocation = devAllocation.add(giveLifePrice.sub(amountToBurn));
            muse.transferFrom(msg.sender, address(this), giveLifePrice);
            // burn 90% of token, 10% stay for dev and community fund
            muse.burn(amountToBurn);
        } else {
            muse.burnFrom(msg.sender, giveLifePrice);
        }

        if (nftType == 721) {
            IERC721(supportedNfts[index].token).transferFrom(
                msg.sender,
                address(this),
                _id
            );
        } else if (nftType == 1155) {
            IERC1155(supportedNfts[index].token).safeTransferFrom(
                msg.sender,
                address(this),
                _id,
                1, //the amount of tokens to transfer which always be 1
                "0x0"
            );
        }

        // mint a vNFT
        vnftDetails[_tokenIds.current()] = VNFTObj(
            supportedNfts[index].token,
            _id,
            nftType
        );

        timeUntilStarving[_tokenIds.current()] = block.timestamp.add(3 days);
        timeVnftBorn[_tokenIds.current()] = block.timestamp;

        super._mint(msg.sender, _tokenIds.current());
        _tokenIds.increment();
        emit LifeGiven(supportedNfts[index].token, _id);
    }

    // unwrap your vNFT if it is not dead, and get back your original NFT
    function unwrap(uint256 _vnftId) external {
        require(isVnftAlive(_vnftId), "Your vNFT is dead, you can't unwrap it");
        transferFrom(msg.sender, address(this), _vnftId);
        VNFTObj memory details = vnftDetails[_vnftId];
        timeUntilStarving[_vnftId] = 1;
        vnftScore[_vnftId] = 0;
        emit Unwrapped(_vnftId);
        _withdraw(details.id, details.token, msg.sender, details.standard);
    }

    // withdraw dead wrapped NFTs or send them to the burn address.
    function withdraw(
        uint256 _id,
        address _contractAddr,
        address _to,
        uint256 _type
    ) external onlyOperator {
        _withdraw(_id, _contractAddr, _to, _type);
    }

    function _withdraw(
        uint256 _id,
        address _contractAddr,
        address _to,
        uint256 _type
    ) internal {
        if (_type == 1155) {
            IERC1155(_contractAddr).safeTransferFrom(
                address(this),
                _to,
                _id,
                1,
                ""
            );
        } else if (_type == 721) {
            IERC721(_contractAddr).transferFrom(address(this), _to, _id);
        }
    }

    // add care taker so in the future if vNFTs are sent to tokenizing platforms like niftex we can whitelist and the previous owner could still mine and do interesting stuff.
    function addCareTaker(uint256 _tokenId, address _careTaker) external {
        require(
            hasRole(OPERATOR_ROLE, _msgSender()) ||
                ownerOf(_tokenId) == msg.sender,
            "Roles: caller does not have the OPERATOR role"
        );
        careTaker[_tokenId][msg.sender] = _careTaker;
        emit CareTakerAdded(_tokenId, _careTaker);
    }

    function clearCareTaker(uint256 _tokenId) external {
        require(
            hasRole(OPERATOR_ROLE, _msgSender()) ||
                ownerOf(_tokenId) == msg.sender,
            "Roles: caller does not have the OPERATOR role"
        );
        delete careTaker[_tokenId][msg.sender];
        emit CareTakerRemoved(_tokenId);
    }

    /**
     * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer
     * number.
     *
     * @param x unsigned 256-bit integer number
     * @return unsigned 128-bit integer number
     */
    function sqrtu(uint256 x) private pure returns (uint128) {
        if (x == 0) return 0;
        else {
            uint256 xx = x;
            uint256 r = 1;
            if (xx >= 0x100000000000000000000000000000000) {
                xx >>= 128;
                r <<= 64;
            }
            if (xx >= 0x10000000000000000) {
                xx >>= 64;
                r <<= 32;
            }
            if (xx >= 0x100000000) {
                xx >>= 32;
                r <<= 16;
            }
            if (xx >= 0x10000) {
                xx >>= 16;
                r <<= 8;
            }
            if (xx >= 0x100) {
                xx >>= 8;
                r <<= 4;
            }
            if (xx >= 0x10) {
                xx >>= 4;
                r <<= 2;
            }
            if (xx >= 0x8) {
                r <<= 1;
            }
            r = (r + x / r) >> 1;
            r = (r + x / r) >> 1;
            r = (r + x / r) >> 1;
            r = (r + x / r) >> 1;
            r = (r + x / r) >> 1;
            r = (r + x / r) >> 1;
            r = (r + x / r) >> 1; // Seven iterations should be enough
            uint256 r1 = x / r;
            return uint128(r < r1 ? r : r1);
        }
    }
}

File 2 of 43 : MasterChef.sol
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
// import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
// import "@openzeppelin/contracts/GSN/Context.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

// ******************
// this is for staking lp tokens and getting back $pet tokens
// We can use this "MasterChef.sol" conract introduced by SuhiSwap, they do exactly what we need and the code is already used by many smart contracts and battle tested with $100s of millions staked in sushiswap
// *******************

// @TODO maybe lets add the roles library to this also to have more then one wallet being able to run this

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, _msgSender()));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index)
        public
        view
        returns (address)
    {
        return _roles[role].members.at(index);
    }

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

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(
            hasRole(_roles[role].adminRole, _msgSender()),
            "AccessControl: sender must be an admin to grant"
        );

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(
            hasRole(_roles[role].adminRole, _msgSender()),
            "AccessControl: sender must be an admin to revoke"
        );

        _revokeRole(role, account);
    }

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

        _revokeRole(role, account);
    }

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

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

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

// File: contracts/access/Roles.sol

pragma solidity ^0.6.0;

contract Roles is AccessControl {
    bytes32 public constant MINTER_ROLE = keccak256("MINTER");
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR");

    constructor() public {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(OPERATOR_ROLE, _msgSender());
    }

    modifier onlyMinter() {
        require(
            hasRole(MINTER_ROLE, _msgSender()),
            "Roles: caller does not have the MINTER role"
        );
        _;
    }

    modifier onlyOperator() {
        require(
            hasRole(OPERATOR_ROLE, _msgSender()),
            "Roles: caller does not have the OPERATOR role"
        );
        _;
    }
}

interface IMigratorChef {
    // Perform LP token migration from legacy UniswapV2 to SushiSwap.
    // Take the current LP token address and return the new LP token address.
    // Migrator should have full access to the caller's LP token.
    // Return the new LP token address.
    //
    // XXX Migrator must have allowance access to UniswapV2 LP tokens.
    // SushiSwap must mint EXACTLY the same amount of SushiSwap LP tokens or
    // else something bad will happen. Traditional UniswapV2 does not
    // do that so be careful!
    function migrate(IERC20 token) external returns (IERC20);
}

// Interface for our erc20 token
interface IMuseToken {
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    function mint(address to, uint256 amount) external;
}

// MasterChef is the master of Sushi. He can make Sushi and he is a fair guy.
//
// Note that it's ownable and the owner wields tremendous power. The ownership
// will be transferred to a governance smart contract once SUSHI is sufficiently
// distributed and the community can show to govern itself.
//
// Have fun reading it. Hopefully it's bug-free. God bless.
contract MasterChef is Ownable, Roles {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    // Info of each user.
    struct UserInfo {
        uint256 amount; // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.
        //
        // We do some fancy math here. Basically, any point in time, the amount of SUSHIs
        // entitled to a user but is pending to be distributed is:
        //
        //   pending reward = (user.amount * pool.accSushiPerShare) - user.rewardDebt
        //
        // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
        //   1. The pool's `accSushiPerShare` (and `lastRewardBlock`) gets updated.
        //   2. User receives the pending reward sent to his/her address.
        //   3. User's `amount` gets updated.
        //   4. User's `rewardDebt` gets updated.
    }

    // Info of each pool.
    struct PoolInfo {
        IERC20 lpToken; // Address of LP token contract.
        uint256 allocPoint; // How many allocation points assigned to this pool. SUSHIs to distribute per block.
        uint256 lastRewardBlock; // Last block number that SUSHIs distribution occurs.
        uint256 accSushiPerShare; // Accumulated SUSHIs per share, times 1e12. See below.
    }

    // The Muse TOKEN!
    IMuseToken public museToken;
    // adding this just in case of nobody using the game but degens hacking the farming
    bool devFee = false;
    // Dev address.
    address public devaddr;
    // Block number when bonus SUSHI period ends.
    uint256 public bonusEndBlock;
    // SUSHI tokens created per block.
    uint256 public sushiPerBlock;
    // Bonus muliplier for early sushi makers.
    uint256 public constant BONUS_MULTIPLIER = 10;
    // The migrator contract. It has a lot of power. Can only be set through governance (owner).
    IMigratorChef public migrator;

    // Info of each pool.
    PoolInfo[] public poolInfo;
    // Info of each user that stakes LP tokens.
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;
    // Total allocation poitns. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint = 0;
    // The block number when SUSHI mining starts.
    uint256 public startBlock;

    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(
        address indexed user,
        uint256 indexed pid,
        uint256 amount
    );

    constructor(
        IMuseToken _museToken,
        // address _devaddr,
        uint256 _sushiPerBlock,
        uint256 _startBlock,
        uint256 _bonusEndBlock
    ) public {
        museToken = _museToken;
        devaddr = msg.sender;
        sushiPerBlock = _sushiPerBlock;
        bonusEndBlock = _bonusEndBlock;
        startBlock = _startBlock;
    }

    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    function allowDevFee(bool _allow) public onlyOperator {
        devFee = _allow;
    }

    // Add a new lp to the pool. Can only be called by the owner.
    // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
    function add(
        uint256 _allocPoint,
        IERC20 _lpToken,
        bool _withUpdate
    ) public onlyOperator {
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 lastRewardBlock = block.number > startBlock
            ? block.number
            : startBlock;
        totalAllocPoint = totalAllocPoint.add(_allocPoint);
        poolInfo.push(
            PoolInfo({
                lpToken: _lpToken,
                allocPoint: _allocPoint,
                lastRewardBlock: lastRewardBlock,
                accSushiPerShare: 0
            })
        );
    }

    // Update the given pool's SUSHI allocation point. Can only be called by the owner.
    function set(
        uint256 _pid,
        uint256 _allocPoint,
        bool _withUpdate
    ) public onlyOperator {
        if (_withUpdate) {
            massUpdatePools();
        }
        totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(
            _allocPoint
        );
        poolInfo[_pid].allocPoint = _allocPoint;
    }

    // Set the migrator contract. Can only be called by the owner.
    function setMigrator(IMigratorChef _migrator) public onlyOwner {
        migrator = _migrator;
    }

    // Migrate lp token to another lp contract. Can be called by anyone. We trust that migrator contract is good.
    function migrate(uint256 _pid) public {
        require(address(migrator) != address(0), "migrate: no migrator");
        PoolInfo storage pool = poolInfo[_pid];
        IERC20 lpToken = pool.lpToken;
        uint256 bal = lpToken.balanceOf(address(this));
        lpToken.safeApprove(address(migrator), bal);
        IERC20 newLpToken = migrator.migrate(lpToken);
        require(bal == newLpToken.balanceOf(address(this)), "migrate: bad");
        pool.lpToken = newLpToken;
    }

    // Return reward multiplier over the given _from to _to block.
    function getMultiplier(uint256 _from, uint256 _to)
        public
        view
        returns (uint256)
    {
        if (_to <= bonusEndBlock) {
            return _to.sub(_from).mul(BONUS_MULTIPLIER);
        } else if (_from >= bonusEndBlock) {
            return _to.sub(_from);
        } else {
            return
                bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add(
                    _to.sub(bonusEndBlock)
                );
        }
    }

    // View function to see pending SUSHIs on frontend.
    function pendingSushi(uint256 _pid, address _user)
        external
        view
        returns (uint256)
    {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accSushiPerShare = pool.accSushiPerShare;
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (block.number > pool.lastRewardBlock && lpSupply != 0) {
            uint256 multiplier = getMultiplier(
                pool.lastRewardBlock,
                block.number
            );
            uint256 sushiReward = multiplier
                .mul(sushiPerBlock)
                .mul(pool.allocPoint)
                .div(totalAllocPoint);
            accSushiPerShare = accSushiPerShare.add(
                sushiReward.mul(1e12).div(lpSupply)
            );
        }
        return user.amount.mul(accSushiPerShare).div(1e12).sub(user.rewardDebt);
    }

    // Update reward vairables for all pools. Be careful of gas spending!
    function massUpdatePools() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            updatePool(pid);
        }
    }

    // Update reward variables of the given pool to be up-to-date.
    function updatePool(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        if (block.number <= pool.lastRewardBlock) {
            return;
        }
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (lpSupply == 0) {
            pool.lastRewardBlock = block.number;
            return;
        }
        uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
        uint256 sushiReward = multiplier
            .mul(sushiPerBlock)
            .mul(pool.allocPoint)
            .div(totalAllocPoint);

        //no dev fee as of now
        if (devFee) {
            museToken.mint(devaddr, sushiReward.div(10));
        }
        museToken.mint(address(this), sushiReward);
        pool.accSushiPerShare = pool.accSushiPerShare.add(
            sushiReward.mul(1e12).div(lpSupply)
        );
        pool.lastRewardBlock = block.number;
    }

    // Deposit LP tokens to MasterChef for SUSHI allocation.
    function deposit(uint256 _pid, uint256 _amount) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        updatePool(_pid);
        if (user.amount > 0) {
            uint256 pending = user
                .amount
                .mul(pool.accSushiPerShare)
                .div(1e12)
                .sub(user.rewardDebt);
            safeSushiTransfer(msg.sender, pending);
        }
        pool.lpToken.safeTransferFrom(
            address(msg.sender),
            address(this),
            _amount
        );
        user.amount = user.amount.add(_amount);
        user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12);
        emit Deposit(msg.sender, _pid, _amount);
    }

    // Withdraw LP tokens from MasterChef.
    function withdraw(uint256 _pid, uint256 _amount) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: not good");
        updatePool(_pid);
        uint256 pending = user.amount.mul(pool.accSushiPerShare).div(1e12).sub(
            user.rewardDebt
        );
        safeSushiTransfer(msg.sender, pending);
        user.amount = user.amount.sub(_amount);
        user.rewardDebt = user.amount.mul(pool.accSushiPerShare).div(1e12);
        pool.lpToken.safeTransfer(address(msg.sender), _amount);
        emit Withdraw(msg.sender, _pid, _amount);
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        pool.lpToken.safeTransfer(address(msg.sender), user.amount);
        emit EmergencyWithdraw(msg.sender, _pid, user.amount);
        user.amount = 0;
        user.rewardDebt = 0;
    }

    // Safe sushi transfer function, just in case if rounding error causes pool to not have enough SUSHIs.
    function safeSushiTransfer(address _to, uint256 _amount) internal {
        uint256 sushiBal = museToken.balanceOf(address(this));
        if (_amount > sushiBal) {
            museToken.transfer(_to, sushiBal);
        } else {
            museToken.transfer(_to, _amount);
        }
    }

    // Update dev address by the previous dev.
    function dev(address _devaddr) public {
        require(msg.sender == devaddr, "dev: wut?");
        devaddr = _devaddr;
    }
}

File 3 of 43 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 4 of 43 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _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 5 of 43 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @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) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @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 sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @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) {
        // 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 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     *
     * 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) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * 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) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts 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 mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 6 of 43 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

/**
 * @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 in 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");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        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 7 of 43 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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.0.0, only sets of type `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];
    }

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

File 8 of 43 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../GSN/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.
 */
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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view 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 9 of 43 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 10 of 43 : MuseToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol";

contract MuseToken is ERC20PresetMinterPauser {
    // Cap at 1 million
    uint256 internal _cap = 1000000 * 10**18;

    constructor() public ERC20PresetMinterPauser("Muse", "MUSE") {}

    /**
     * @dev Returns the cap on the token's total supply.
     */
    function cap() public view returns (uint256) {
        return _cap;
    }

    // change cap in case of decided by the community
    function changeCap(uint256 _newCap) external {
        require(
            hasRole(MINTER_ROLE, _msgSender()),
            "ERC20PresetMinterPauser: must have minter role to mint"
        );
        _cap = _newCap;
    }

    /**
     * @dev See {ERC20-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - minted tokens must not cause the total supply to go over the cap.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override(ERC20PresetMinterPauser) {
        super._beforeTokenTransfer(from, to, amount);

        if (from == address(0)) {
            // When minting tokens
            require(
                totalSupply().add(amount) <= _cap,
                "ERC20Capped: cap exceeded"
            );
        }
    }
}

File 11 of 43 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.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 {
    using SafeMath for uint256;
    using Address for address;

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name, string memory symbol) public {
        _name = name;
        _symbol = symbol;
        _decimals = 18;
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view 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 {_setupDecimals} is
     * called.
     *
     * 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 returns (uint8) {
        return _decimals;
    }

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

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view 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);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        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].add(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) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        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);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(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 = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(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);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(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 Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

    /**
     * @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 12 of 43 : ERC20PresetMinterPauser.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../access/AccessControl.sol";
import "../GSN/Context.sol";
import "../token/ERC20/ERC20.sol";
import "../token/ERC20/ERC20Burnable.sol";
import "../token/ERC20/ERC20Pausable.sol";

/**
 * @dev {ERC20} token, including:
 *
 *  - ability for holders to burn (destroy) their tokens
 *  - a minter role that allows for token minting (creation)
 *  - a pauser role that allows to stop all token transfers
 *
 * This contract uses {AccessControl} to lock permissioned functions using the
 * different roles - head to its documentation for details.
 *
 * The account that deploys the contract will be granted the minter and pauser
 * roles, as well as the default admin role, which will let it grant both minter
 * and pauser roles to other accounts.
 */
contract ERC20PresetMinterPauser is Context, AccessControl, ERC20Burnable, ERC20Pausable {
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

    /**
     * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the
     * account that deploys the contract.
     *
     * See {ERC20-constructor}.
     */
    constructor(string memory name, string memory symbol) public ERC20(name, symbol) {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());

        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(PAUSER_ROLE, _msgSender());
    }

    /**
     * @dev Creates `amount` new tokens for `to`.
     *
     * See {ERC20-_mint}.
     *
     * Requirements:
     *
     * - the caller must have the `MINTER_ROLE`.
     */
    function mint(address to, uint256 amount) public virtual {
        require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint");
        _mint(to, amount);
    }

    /**
     * @dev Pauses all token transfers.
     *
     * See {ERC20Pausable} and {Pausable-_pause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function pause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause");
        _pause();
    }

    /**
     * @dev Unpauses all token transfers.
     *
     * See {ERC20Pausable} and {Pausable-_unpause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function unpause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause");
        _unpause();
    }

    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override(ERC20, ERC20Pausable) {
        super._beforeTokenTransfer(from, to, amount);
    }
}

File 13 of 43 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../utils/EnumerableSet.sol";
import "../utils/Address.sol";
import "../GSN/Context.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

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

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

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

        _revokeRole(role, account);
    }

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

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

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 14 of 43 : ERC20Burnable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../../GSN/Context.sol";
import "./ERC20.sol";

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        uint256 decreasedAllowance = allowance(account, _msgSender()).sub(amount, "ERC20: burn amount exceeds allowance");

        _approve(account, _msgSender(), decreasedAllowance);
        _burn(account, amount);
    }
}

File 15 of 43 : ERC20Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./ERC20.sol";
import "../../utils/Pausable.sol";

/**
 * @dev ERC20 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC20Pausable is ERC20, Pausable {
    /**
     * @dev See {ERC20-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
        super._beforeTokenTransfer(from, to, amount);

        require(!paused(), "ERC20Pausable: token transfer while paused");
    }
}

File 16 of 43 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../GSN/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor () internal {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!_paused, "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(_paused, "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 17 of 43 : PetAirdrop.sol
pragma solidity ^0.6.2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/cryptography/MerkleProof.sol";
import "./VNFT.sol";

contract PetAirdrop {
    event Claimed(uint256 index, address owner);

    VNFT public immutable petMinter;
    bytes32 public immutable merkleRoot;

    // This is a packed array of booleans.
    mapping(uint256 => uint256) private claimedBitMap;

    constructor(VNFT pet_minter_, bytes32 merkleRoot_) public {
        petMinter = pet_minter_;
        merkleRoot = merkleRoot_;
    }

    function isClaimed(uint256 index) public view returns (bool) {
        uint256 claimedWordIndex = index / 256;
        uint256 claimedBitIndex = index % 256;
        uint256 claimedWord = claimedBitMap[claimedWordIndex];
        uint256 mask = (1 << claimedBitIndex);
        return claimedWord & mask == mask;
    }

    function _setClaimed(uint256 index) private {
        uint256 claimedWordIndex = index / 256;
        uint256 claimedBitIndex = index % 256;
        claimedBitMap[claimedWordIndex] =
            claimedBitMap[claimedWordIndex] |
            (1 << claimedBitIndex);
    }

    function claim(uint256 index, bytes32[] calldata merkleProof) external {
        require(!isClaimed(index), "MerkleDistributor: Drop already claimed.");
        // console.logBytes(abi.encodePacked(index));
        // Verify the merkle proof.
        bytes32 node = keccak256(abi.encodePacked(bytes32(index)));
        // console.logBytes32(node);
        require(
            MerkleProof.verify(merkleProof, merkleRoot, node),
            "MerkleDistributor: Invalid proof."
        );

        // Mark it claimed and send the token.
        _setClaimed(index);

        petMinter.mint(msg.sender);

        emit Claimed(index, msg.sender);
    }
}

File 18 of 43 : MerkleProof.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev These functions deal with verification of Merkle trees (hash trees),
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        bytes32 computedHash = leaf;

        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }

        // Check if the computed hash (root) is equal to the provided root
        return computedHash == root;
    }
}

File 19 of 43 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../../GSN/Context.sol";
import "./IERC721.sol";
import "./IERC721Metadata.sol";
import "./IERC721Enumerable.sol";
import "./IERC721Receiver.sol";
import "../../introspection/ERC165.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../utils/EnumerableSet.sol";
import "../../utils/EnumerableMap.sol";
import "../../utils/Strings.sol";

/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using SafeMath for uint256;
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.UintToAddressMap;
    using Strings for uint256;

    // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

    // Mapping from holder address to their (enumerable) set of owned tokens
    mapping (address => EnumerableSet.UintSet) private _holderTokens;

    // Enumerable mapping from token ids to their owners
    EnumerableMap.UintToAddressMap private _tokenOwners;

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Optional mapping for token URIs
    mapping (uint256 => string) private _tokenURIs;

    // Base URI
    string private _baseURI;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

    /*
     *     bytes4(keccak256('name()')) == 0x06fdde03
     *     bytes4(keccak256('symbol()')) == 0x95d89b41
     *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
     *
     *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
     */
    bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;

    /*
     *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
     *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
     *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
     *
     *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
     */
    bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;

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

        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }

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

        return _holderTokens[owner].length();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

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

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

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

        string memory _tokenURI = _tokenURIs[tokenId];

        // If there is no base URI, return the token URI.
        if (bytes(_baseURI).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(_baseURI, _tokenURI));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(_baseURI, tokenId.toString()));
    }

    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a prefix in {tokenURI} to each token's URI, or
    * to the token ID if no specific URI is set for that token ID.
    */
    function baseURI() public view returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
        return _holderTokens[owner].at(index);
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenOwners.length();
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

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

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view 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 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 returns (bool) {
        return _tokenOwners.contains(tokenId);
    }

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

        _holderTokens[to].add(tokenId);

        _tokenOwners.set(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 = ownerOf(tokenId);

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

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

        // Clear metadata (if any)
        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }

        _holderTokens[owner].remove(tokenId);

        _tokenOwners.remove(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(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);

        _holderTokens[from].remove(tokenId);
        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI},
     * or to the token ID if {tokenURI} is empty.
     */
    function _setBaseURI(string memory baseURI_) internal virtual {
        _baseURI = baseURI_;
    }

    /**
     * @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()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }

    function _approve(address to, uint256 tokenId) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(ownerOf(tokenId), to, tokenId);
    }

    /**
     * @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 20 of 43 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

import "../../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 21 of 43 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 22 of 43 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

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 23 of 43 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

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 24 of 43 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 25 of 43 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

File 26 of 43 : EnumerableMap.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct MapEntry {
        bytes32 _key;
        bytes32 _value;
    }

    struct Map {
        // Storage of map keys and values
        MapEntry[] _entries;

        // Position of the entry defined by a key in the `entries` array, plus 1
        // because index 0 means a key is not in the map.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex == 0) { // Equivalent to !contains(map, key)
            map._entries.push(MapEntry({ _key: key, _value: value }));
            // The entry is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            map._indexes[key] = map._entries.length;
            return true;
        } else {
            map._entries[keyIndex - 1]._value = value;
            return false;
        }
    }

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

        if (keyIndex != 0) { // Equivalent to contains(map, key)
            // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
            // in the array, and then remove the last entry (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = keyIndex - 1;
            uint256 lastIndex = map._entries.length - 1;

            // When the entry 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.

            MapEntry storage lastEntry = map._entries[lastIndex];

            // Move the last entry to the index where the entry to delete is
            map._entries[toDeleteIndex] = lastEntry;
            // Update the index for the moved entry
            map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved entry was stored
            map._entries.pop();

            // Delete the index for the deleted slot
            delete map._indexes[key];

            return true;
        } else {
            return false;
        }
    }

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

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._entries.length;
    }

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

        MapEntry storage entry = map._entries[index];
        return (entry._key, entry._value);
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        return _get(map, key, "EnumerableMap: nonexistent key");
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     */
    function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(value)));
    }

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

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

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

   /**
    * @dev Returns the element 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = _at(map._inner, index);
        return (uint256(key), address(uint256(value)));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint256(_get(map._inner, bytes32(key))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     */
    function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
        return address(uint256(_get(map._inner, bytes32(key), errorMessage)));
    }
}

File 27 of 43 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

/**
 * @dev String operations.
 */
library Strings {
    /**
     * @dev Converts a `uint256` to its ASCII `string` 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);
        uint256 index = digits - 1;
        temp = value;
        while (temp != 0) {
            buffer[index--] = byte(uint8(48 + temp % 10));
            temp /= 10;
        }
        return string(buffer);
    }
}

File 28 of 43 : IERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;
}

File 29 of 43 : ERC1155Holder.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./ERC1155Receiver.sol";

/**
 * @dev _Available since v3.1._
 */
contract ERC1155Holder is ERC1155Receiver {
    function onERC1155Received(address, address, uint256, uint256, bytes memory) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(address, address, uint256[] memory, uint256[] memory, bytes memory) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }
}

File 30 of 43 : ERC1155Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./IERC1155Receiver.sol";
import "../../introspection/ERC165.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
    constructor() public {
        _registerInterface(
            ERC1155Receiver(0).onERC1155Received.selector ^
            ERC1155Receiver(0).onERC1155BatchReceived.selector
        );
    }
}

File 31 of 43 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

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

/**
 * _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {

    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    )
        external
        returns(bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    )
        external
        returns(bytes4);
}

File 32 of 43 : ERC721Burnable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../../GSN/Context.sol";
import "./ERC721.sol";

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
    }
}

File 33 of 43 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../math/SafeMath.sol";

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
 * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
 * directly accessed.
 */
library Counters {
    using SafeMath for uint256;

    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        // The {SafeMath} overflow check can be skipped here, see the comment at the top
        counter._value += 1;
    }

    function decrement(Counter storage counter) internal {
        counter._value = counter._value.sub(1);
    }
}

File 34 of 43 : ERC721PresetMinterPauserAutoId.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../access/AccessControl.sol";
import "../GSN/Context.sol";
import "../utils/Counters.sol";
import "../token/ERC721/ERC721.sol";
import "../token/ERC721/ERC721Burnable.sol";
import "../token/ERC721/ERC721Pausable.sol";

/**
 * @dev {ERC721} token, including:
 *
 *  - ability for holders to burn (destroy) their tokens
 *  - a minter role that allows for token minting (creation)
 *  - a pauser role that allows to stop all token transfers
 *  - token ID and URI autogeneration
 *
 * This contract uses {AccessControl} to lock permissioned functions using the
 * different roles - head to its documentation for details.
 *
 * The account that deploys the contract will be granted the minter and pauser
 * roles, as well as the default admin role, which will let it grant both minter
 * and pauser roles to other accounts.
 */
contract ERC721PresetMinterPauserAutoId is Context, AccessControl, ERC721Burnable, ERC721Pausable {
    using Counters for Counters.Counter;

    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

    Counters.Counter private _tokenIdTracker;

    /**
     * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the
     * account that deploys the contract.
     *
     * Token URIs will be autogenerated based on `baseURI` and their token IDs.
     * See {ERC721-tokenURI}.
     */
    constructor(string memory name, string memory symbol, string memory baseURI) public ERC721(name, symbol) {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());

        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(PAUSER_ROLE, _msgSender());

        _setBaseURI(baseURI);
    }

    /**
     * @dev Creates a new token for `to`. Its token ID will be automatically
     * assigned (and available on the emitted {IERC721-Transfer} event), and the token
     * URI autogenerated based on the base URI passed at construction.
     *
     * See {ERC721-_mint}.
     *
     * Requirements:
     *
     * - the caller must have the `MINTER_ROLE`.
     */
    function mint(address to) public virtual {
        require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint");

        // We cannot just use balanceOf to create the new tokenId because tokens
        // can be burned (destroyed), so we need a separate counter.
        _mint(to, _tokenIdTracker.current());
        _tokenIdTracker.increment();
    }

    /**
     * @dev Pauses all token transfers.
     *
     * See {ERC721Pausable} and {Pausable-_pause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function pause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause");
        _pause();
    }

    /**
     * @dev Unpauses all token transfers.
     *
     * See {ERC721Pausable} and {Pausable-_unpause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function unpause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to unpause");
        _unpause();
    }

    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721, ERC721Pausable) {
        super._beforeTokenTransfer(from, to, tokenId);
    }
}

File 35 of 43 : ERC721Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./ERC721.sol";
import "../../utils/Pausable.sol";

/**
 * @dev ERC721 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC721Pausable is ERC721, Pausable {
    /**
     * @dev See {ERC721-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        require(!paused(), "ERC721Pausable: token transfer while paused");
    }
}

File 36 of 43 : StakeForVnfts.sol
pragma solidity ^0.6.2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/introspection/IERC165.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

contract Roles is AccessControl {
    bytes32 public constant MINTER_ROLE = keccak256("MINTER");
    bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR");

    constructor() public {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(OPERATOR_ROLE, _msgSender());
    }

    modifier onlyMinter() {
        require(
            hasRole(MINTER_ROLE, _msgSender()),
            "Roles: caller does not have the MINTER role"
        );
        _;
    }

    modifier onlyOperator() {
        require(
            hasRole(OPERATOR_ROLE, _msgSender()),
            "Roles: caller does not have the OPERATOR role"
        );
        _;
    }
}

interface IERC721 is IERC165 {
    event Transfer(
        address indexed from,
        address indexed to,
        uint256 indexed tokenId
    );

    event Approval(
        address indexed owner,
        address indexed approved,
        uint256 indexed tokenId
    );

    event ApprovalForAll(
        address indexed owner,
        address indexed operator,
        bool approved
    );

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

    function ownerOf(uint256 tokenId) external view returns (address owner);

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    function approve(address to, uint256 tokenId) external;

    function getApproved(uint256 tokenId)
        external
        view
        returns (address operator);

    function setApprovalForAll(address operator, bool _approved) external;

    function isApprovedForAll(address owner, address operator)
        external
        view
        returns (bool);

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    function mint(address to) external;
}

// Stake to get vnfts
contract StakeForVnfts is Roles {
    using SafeMath for uint256;

    IERC20 public museToken;
    IERC721 public vNFT;

    // min $muse amount required to stake
    uint256 public minStake = 5 * 10**18;

    // amount of points needed to redeem a vnft, roughly 1 point is given each day;
    uint256 public vnftPrice = 5 * 10**18;
    uint256 public totalStaked;

    mapping(address => uint256) public balance;
    mapping(address => uint256) public lastUpdateTime;
    mapping(address => uint256) public points;

    event Staked(address who, uint256 amount);
    event Withdrawal(address who, uint256 amount);
    event VnftMinted(address to);

    event StakeReqChanged(uint256 newAmount);
    event PriceOfvnftChanged(uint256 newAmount);

    constructor(address _vNFT, address _museToken) public {
        vNFT = IERC721(_vNFT);
        museToken = IERC20(_museToken);
    }

    // changes stake requirement
    function changeStakeReq(uint256 _newAmount) external onlyOperator {
        minStake = _newAmount;
        emit StakeReqChanged(_newAmount);
    }

    function changePriceOfNFT(uint256 _newAmount) external onlyOperator {
        vnftPrice = _newAmount;
        emit PriceOfvnftChanged(_newAmount);
    }

    modifier updateReward(address account) {
        if (account != address(0)) {
            points[account] = earned(account);
            lastUpdateTime[account] = block.timestamp;
        }
        _;
    }

    //calculate how many points earned so far, this needs to give roughly 1 point a day per 5 tokens staked?.
    function earned(address account) public view returns (uint256) {
        uint256 blockTime = block.timestamp;
        return
            balance[account]
                .mul(blockTime.sub(lastUpdateTime[account]).mul(2314814814000))
                .div(1e18)
                .add(points[account]);
    }

    function stake(uint256 _amount) external updateReward(msg.sender) {
        require(
            _amount >= minStake,
            "You need to stake at least the min $muse"
        );

        // transfer tokens to this address to stake them
        totalStaked = totalStaked.add(_amount);
        balance[msg.sender] = balance[msg.sender].add(_amount);
        museToken.transferFrom(msg.sender, address(this), _amount);
        emit Staked(msg.sender, _amount);
    }

    // withdraw part of your stake
    function withdraw(uint256 amount) public updateReward(msg.sender) {
        require(amount > 0, "Amount can't be 0");
        require(totalStaked >= amount);
        balance[msg.sender] = balance[msg.sender].sub(amount);
        totalStaked = totalStaked.sub(amount);
        // transfer erc20 back from the contract to the user
        museToken.transfer(msg.sender, amount);
        emit Withdrawal(msg.sender, amount);
    }

    // withdraw all your amount staked
    function exit() external {
        withdraw(balance[msg.sender]);
    }

    //redeem a vNFT based on a set points price
    function redeem() public updateReward(msg.sender) {
        require(
            points[msg.sender] >= vnftPrice,
            "Not enough points to redeem vNFT"
        );
        points[msg.sender] = points[msg.sender].sub(vnftPrice);
        vNFT.mint(msg.sender);
        emit VnftMinted(msg.sender);
    }
}

File 37 of 43 : TestERC1155.sol
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/presets/ERC1155PresetMinterPauser.sol";

contract TestERC1155 is ERC1155PresetMinterPauser {
    constructor(string memory uri) public ERC1155PresetMinterPauser(uri) {}
}

File 38 of 43 : ERC1155PresetMinterPauser.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../access/AccessControl.sol";
import "../GSN/Context.sol";
import "../token/ERC1155/ERC1155.sol";
import "../token/ERC1155/ERC1155Burnable.sol";
import "../token/ERC1155/ERC1155Pausable.sol";

/**
 * @dev {ERC1155} token, including:
 *
 *  - ability for holders to burn (destroy) their tokens
 *  - a minter role that allows for token minting (creation)
 *  - a pauser role that allows to stop all token transfers
 *
 * This contract uses {AccessControl} to lock permissioned functions using the
 * different roles - head to its documentation for details.
 *
 * The account that deploys the contract will be granted the minter and pauser
 * roles, as well as the default admin role, which will let it grant both minter
 * and pauser roles to other accounts.
 */
contract ERC1155PresetMinterPauser is Context, AccessControl, ERC1155Burnable, ERC1155Pausable {
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

    /**
     * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE`, and `PAUSER_ROLE` to the account that
     * deploys the contract.
     */
    constructor(string memory uri) public ERC1155(uri) {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());

        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(PAUSER_ROLE, _msgSender());
    }

    /**
     * @dev Creates `amount` new tokens for `to`, of token type `id`.
     *
     * See {ERC1155-_mint}.
     *
     * Requirements:
     *
     * - the caller must have the `MINTER_ROLE`.
     */
    function mint(address to, uint256 id, uint256 amount, bytes memory data) public virtual {
        require(hasRole(MINTER_ROLE, _msgSender()), "ERC1155PresetMinterPauser: must have minter role to mint");

        _mint(to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] variant of {mint}.
     */
    function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) public virtual {
        require(hasRole(MINTER_ROLE, _msgSender()), "ERC1155PresetMinterPauser: must have minter role to mint");

        _mintBatch(to, ids, amounts, data);
    }

    /**
     * @dev Pauses all token transfers.
     *
     * See {ERC1155Pausable} and {Pausable-_pause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function pause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC1155PresetMinterPauser: must have pauser role to pause");
        _pause();
    }

    /**
     * @dev Unpauses all token transfers.
     *
     * See {ERC1155Pausable} and {Pausable-_unpause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function unpause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC1155PresetMinterPauser: must have pauser role to unpause");
        _unpause();
    }

    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        internal virtual override(ERC1155, ERC1155Pausable)
    {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }
}

File 39 of 43 : ERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./IERC1155.sol";
import "./IERC1155MetadataURI.sol";
import "./IERC1155Receiver.sol";
import "../../GSN/Context.sol";
import "../../introspection/ERC165.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

/**
 *
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using SafeMath for uint256;
    using Address for address;

    // Mapping from token ID to account balances
    mapping (uint256 => mapping(address => uint256)) private _balances;

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

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /*
     *     bytes4(keccak256('balanceOf(address,uint256)')) == 0x00fdd58e
     *     bytes4(keccak256('balanceOfBatch(address[],uint256[])')) == 0x4e1273f4
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,uint256,bytes)')) == 0xf242432a
     *     bytes4(keccak256('safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)')) == 0x2eb2c2d6
     *
     *     => 0x00fdd58e ^ 0x4e1273f4 ^ 0xa22cb465 ^
     *        0xe985e9c5 ^ 0xf242432a ^ 0x2eb2c2d6 == 0xd9b67a26
     */
    bytes4 private constant _INTERFACE_ID_ERC1155 = 0xd9b67a26;

    /*
     *     bytes4(keccak256('uri(uint256)')) == 0x0e89341c
     */
    bytes4 private constant _INTERFACE_ID_ERC1155_METADATA_URI = 0x0e89341c;

    /**
     * @dev See {_setURI}.
     */
    constructor (string memory uri) public {
        _setURI(uri);

        // register the supported interfaces to conform to ERC1155 via ERC165
        _registerInterface(_INTERFACE_ID_ERC1155);

        // register the supported interfaces to conform to ERC1155MetadataURI via ERC165
        _registerInterface(_INTERFACE_ID_ERC1155_METADATA_URI);
    }

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) external view override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view override returns (uint256) {
        require(account != address(0), "ERC1155: balance query for the zero address");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] memory accounts,
        uint256[] memory ids
    )
        public
        view
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            require(accounts[i] != address(0), "ERC1155: batch balance query for the zero address");
            batchBalances[i] = _balances[ids[i]][accounts[i]];
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(_msgSender() != operator, "ERC1155: setting approval status for self");

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    )
        public
        virtual
        override
    {
        require(to != address(0), "ERC1155: transfer to the zero address");
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][from] = _balances[id][from].sub(amount, "ERC1155: insufficient balance for transfer");
        _balances[id][to] = _balances[id][to].add(amount);

        emit TransferSingle(operator, from, to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        public
        virtual
        override
    {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            _balances[id][from] = _balances[id][from].sub(
                amount,
                "ERC1155: insufficient balance for transfer"
            );
            _balances[id][to] = _balances[id][to].add(amount);
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual {
        require(account != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][account] = _balances[id][account].add(amount);
        emit TransferSingle(operator, address(0), account, id, amount);

        _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] = amounts[i].add(_balances[ids[i]][to]);
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `account`
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens of token type `id`.
     */
    function _burn(address account, uint256 id, uint256 amount) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        _balances[id][account] = _balances[id][account].sub(
            amount,
            "ERC1155: burn amount exceeds balance"
        );

        emit TransferSingle(operator, account, address(0), id, amount);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), ids, amounts, "");

        for (uint i = 0; i < ids.length; i++) {
            _balances[ids[i]][account] = _balances[ids[i]][account].sub(
                amounts[i],
                "ERC1155: burn amount exceeds balance"
            );
        }

        emit TransferBatch(operator, account, address(0), ids, amounts);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        internal virtual
    { }

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    )
        private
    {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver(to).onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        private
    {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (bytes4 response) {
                if (response != IERC1155Receiver(to).onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

File 40 of 43 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

import "./IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 41 of 43 : ERC1155Burnable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./ERC1155.sol";

/**
 * @dev Extension of {ERC1155} that allows token holders to destroy both their
 * own tokens and those that they have been approved to use.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155Burnable is ERC1155 {
    function burn(address account, uint256 id, uint256 value) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burn(account, id, value);
    }

    function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burnBatch(account, ids, values);
    }
}

File 42 of 43 : ERC1155Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./ERC1155.sol";
import "../../utils/Pausable.sol";

/**
 * @dev ERC1155 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155Pausable is ERC1155, Pausable {
    /**
     * @dev See {ERC1155-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        internal virtual override
    {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

        require(!paused(), "ERC1155Pausable: token transfer while paused");
    }
}

File 43 of 43 : TestERC721.sol
pragma solidity ^0.6.0;

import "@openzeppelin/contracts/presets/ERC721PresetMinterPauserAutoId.sol";

contract TestERC721 is ERC721PresetMinterPauserAutoId {
    constructor()
        public
        ERC721PresetMinterPauserAutoId("test721", "t721", "google.com")
    {}
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_museToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"percentage","type":"uint256"}],"name":"BurnPercentageChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"address","name":"_to","type":"address"}],"name":"CareTakerAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"CareTakerRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"who","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimedMiningRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"points","type":"uint256"}],"name":"ItemCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"forSupportedNFT","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"LifeGiven","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"Unwrapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"address","name":"giver","type":"address"},{"indexed":false,"internalType":"uint256","name":"itemId","type":"uint256"}],"name":"VnftConsumed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"address","name":"killer","type":"address"}],"name":"VnftFatalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"VnftMinted","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_careTaker","type":"address"}],"name":"addCareTaker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftToken","type":"address"},{"internalType":"uint256","name":"_type","type":"uint256"}],"name":"addNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnPercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"uint256","name":"itemId","type":"uint256"}],"name":"buyAccesory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"careTaker","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"percentage","type":"uint256"}],"name":"changeBurnPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newPrice","type":"uint256"}],"name":"changeGiveLifePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"changeMaxDevAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"claimMiningRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"clearCareTaker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"points","type":"uint256"},{"internalType":"uint256","name":"timeExtension","type":"uint256"}],"name":"createItem","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_la","type":"uint256"},{"internalType":"uint256","name":"_lb","type":"uint256"},{"internalType":"uint256","name":"_ra","type":"uint256"},{"internalType":"uint256","name":"_rb","type":"uint256"}],"name":"editCurves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_points","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"uint256","name":"_timeExtension","type":"uint256"}],"name":"editItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deadId","type":"uint256"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"fatality","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gameStopped","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deadId","type":"uint256"}],"name":"getFatalityReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_itemId","type":"uint256"}],"name":"getItemInfo","outputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_points","type":"uint256"},{"internalType":"uint256","name":"_timeExtension","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"}],"name":"getVnftInfo","outputs":[{"internalType":"uint256","name":"_vNFT","type":"uint256"},{"internalType":"bool","name":"_isAlive","type":"bool"},{"internalType":"uint256","name":"_score","type":"uint256"},{"internalType":"uint256","name":"_level","type":"uint256"},{"internalType":"uint256","name":"_expectedReward","type":"uint256"},{"internalType":"uint256","name":"_timeUntilStarving","type":"uint256"},{"internalType":"uint256","name":"_lastTimeMined","type":"uint256"},{"internalType":"uint256","name":"_timeVnftBorn","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_fatalityReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"}],"name":"getVnftScore","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"nftType","type":"uint256"}],"name":"giveLife","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"giveLifePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_nftId","type":"uint256"}],"name":"isVnftAlive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"itemId","type":"uint256"}],"name":"itemExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"itemName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"itemPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"itemPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"itemTimeExtension","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lastTimeMined","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"level","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxDevAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"player","type":"address"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"muse","outputs":[{"internalType":"contract IMuseToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_pause","type":"bool"}],"name":"pauseGame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supportedNftLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"supportedNfts","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint256","name":"standard","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"timeUntilStarving","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"timeVnftBorn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_vnftId","type":"uint256"}],"name":"unwrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bool","name":"_active","type":"bool"},{"internalType":"address","name":"_address","type":"address"}],"name":"updateSupportedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vnftDetails","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"standard","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vnftScore","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"address","name":"_contractAddr","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_type","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405269152d02c7e14af6800000600f556000601055605a601455674563918244f400006015556016805460ff1916905560026020819055602155600660225560076023553480156200005357600080fd5b506040516200645338038062006453833981810160405260208110156200007957600080fd5b50516040805180820182526004808252631593919560e21b6020838101829052845180860186529283528281019190915283518085019094528084527f68747470733a2f2f67616c6c6572792e766572796e6966792e696f2f6170692f9084015290918282620000f96301ffc9a760e01b6001600160e01b036200031916565b81516200010e906007906020850190620004ef565b50805162000124906008906020840190620004ef565b50620001406380ac58cd60e01b6001600160e01b036200031916565b6200015b635b5e139f60e01b6001600160e01b036200031916565b6200017663780e9d6360e01b6001600160e01b036200031916565b5050600b805460ff191690556000620001976001600160e01b03620003a116565b600b8054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350620002156000620002066001600160e01b03620003a116565b6001600160e01b03620003a616565b604080516a4d494e5445525f524f4c4560a81b8152905190819003600b0190206200024d90620002066001600160e01b03620003a116565b604080516a5041555345525f524f4c4560a81b8152905190819003600b0190206200028590620002066001600160e01b03620003a116565b62000299816001600160e01b03620003bf16565b50620002b99150630271189760e51b90506001600160e01b036200031916565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d019020620002f390620002066001600160e01b03620003a116565b600d80546001600160a01b0319166001600160a01b039290921691909117905562000591565b6001600160e01b0319808216141562000379576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152600160208190526040909120805460ff19169091179055565b335b90565b620003bb82826001600160e01b03620003d416565b5050565b8051620003bb90600a906020840190620004ef565b600082815260208181526040909120620003f99183906200505362000456821b17901c565b15620003bb57620004126001600160e01b03620003a116565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000476836001600160a01b0384166001600160e01b036200047f16565b90505b92915050565b60006200049683836001600160e01b03620004d716565b620004ce5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000479565b50600062000479565b60009081526001919091016020526040902054151590565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200053257805160ff191683800117855562000562565b8280016001018555821562000562579182015b828111156200056257825182559160200191906001019062000545565b506200057092915062000574565b5090565b620003a391905b808211156200057057600081556001016200057b565b615eb280620005a16000396000f3fe608060405234801561001057600080fd5b50600436106104ac5760003560e01c8063843bd6411161026d578063c8098e1211610151578063de7fe3e7116100ce578063f23a6e6111610092578063f23a6e611461131d578063f2fde38b146113e6578063f362ce981461140c578063f41c075214611438578063f5b541a614611440578063f8e1f51e14611448576104ac565b8063de7fe3e71461122d578063e63ab1e9146112d7578063e8a3d485146112df578063e985e9c5146112e7578063f01f20df14611315576104ac565b8063d539139311610115578063d53913931461117a578063d547741f14611182578063dcb49299146111ae578063de0e9a3e146111f3578063de5f749314611210576104ac565b8063c8098e12146110da578063c87b56dd146110f7578063c88a7c2f14611114578063ca15c87314611140578063d4f291a31461115d576104ac565b8063a09091df116101ea578063b6d7f610116101ae578063b6d7f61014610dbe578063b88d4fde14610ddb578063bc197c8114610e9f578063bc721e061461107d578063c071e267146110a0578063c0d8012c146110bd576104ac565b8063a09091df14610cea578063a217fddf14610d2f578063a22cb46514610d37578063a318c1a414610d65578063adcb005c14610da1576104ac565b80639010d07c116102315780639010d07c14610be957806391d1485414610c0c578063921b9ea814610c3857806395d89b4114610c6157806399cc726d14610c69576104ac565b8063843bd64114610b735780638456cb5914610b905780638652e49c14610b985780638980f11f14610bb55780638da5cb5b14610be1576104ac565b806342842e0e116103945780636352211e11610311578063715018a6116102d5578063715018a614610a1557806371701a4414610a1d5780637310dc8a14610a2557806377fe73e314610a4257806379c5cb1c14610a715780637a99c2b114610aeb576104ac565b80636352211e146109875780636a627842146109a45780636c0360eb146109ca5780636d855065146109d257806370a08231146109ef576104ac565b806350f70af91161035857806350f70af91461088457806355f804b3146108a157806356031c7814610945578063574dd8b9146109625780635c975abb1461097f576104ac565b806342842e0e146107ed57806342966c68146108235780634c20179e146108405780634f53126a146108485780634f6ccce714610867576104ac565b80632030c4b01161042d57806328b0eb0f116103f157806328b0eb0f146107185780632f2ff15d146107445780632f745c591461077057806331a198e41461079c57806336568abe146107b95780633f4ba83a146107e5576104ac565b80632030c4b01461068357806323b872dd146106a057806323bee768146106d6578063243dd6c0146106f3578063248a9ca3146106fb576104ac565b8063095ea7b311610474578063095ea7b3146105d957806310b220381461060757806310cc610c1461063b57806318160ddd1461065e57806319660d2114610666576104ac565b806301ffc9a7146104b15780630430e405146104ec57806305c58df2146104f457806306fdde0314610523578063081812fc146105a0575b600080fd5b6104d8600480360360208110156104c757600080fd5b50356001600160e01b031916611450565b604080519115158252519081900360200190f35b6104d8611473565b6105116004803603602081101561050a57600080fd5b503561147c565b60408051918252519081900360200190f35b61052b6114ff565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561056557818101518382015260200161054d565b50505050905090810190601f1680156105925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105bd600480360360208110156105b657600080fd5b5035611596565b604080516001600160a01b039092168252519081900360200190f35b610605600480360360408110156105ef57600080fd5b506001600160a01b0381351690602001356115f8565b005b6106056004803603606081101561061d57600080fd5b508035906020810135151590604001356001600160a01b03166116d3565b6106056004803603604081101561065157600080fd5b50803590602001356117b8565b610511611bbb565b6105116004803603602081101561067c57600080fd5b5035611bcc565b6105116004803603602081101561069957600080fd5b5035611bde565b610605600480360360608110156106b657600080fd5b506001600160a01b03813581169160208101359091169060400135611bf0565b610511600480360360208110156106ec57600080fd5b5035611c47565b610511611c59565b6105116004803603602081101561071157600080fd5b5035611c5f565b6106056004803603604081101561072e57600080fd5b506001600160a01b038135169060200135611c74565b6106056004803603604081101561075a57600080fd5b50803590602001356001600160a01b0316611d91565b6105116004803603604081101561078657600080fd5b506001600160a01b038135169060200135611df8565b610605600480360360208110156107b257600080fd5b5035611e29565b610605600480360360408110156107cf57600080fd5b50803590602001356001600160a01b0316611e97565b610605611ef8565b6106056004803603606081101561080357600080fd5b506001600160a01b03813581169160208101359091169060400135611f69565b6106056004803603602081101561083957600080fd5b5035611f84565b610511611fd6565b6106056004803603602081101561085e57600080fd5b50351515611fdc565b6105116004803603602081101561087d57600080fd5b5035612058565b6106056004803603602081101561089a57600080fd5b5035612074565b610605600480360360208110156108b757600080fd5b810190602081018135600160201b8111156108d157600080fd5b8201836020820111156108e357600080fd5b803590602001918460018302840111600160201b8311171561090457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550612333945050505050565b6106056004803603602081101561095b57600080fd5b50356123a5565b6105116004803603602081101561097857600080fd5b503561241d565b6104d861242f565b6105bd6004803603602081101561099d57600080fd5b5035612438565b610605600480360360208110156109ba57600080fd5b50356001600160a01b0316612466565b61052b6125f4565b610605600480360360208110156109e857600080fd5b5035612655565b61051160048036036020811015610a0557600080fd5b50356001600160a01b0316612704565b61060561276c565b61051161282b565b61052b60048036036020811015610a3b57600080fd5b5035612831565b61060560048036036080811015610a5857600080fd5b50803590602081013590604081013590606001356128cc565b6104d860048036036080811015610a8757600080fd5b810190602081018135600160201b811115610aa157600080fd5b820183602082011115610ab357600080fd5b803590602001918460018302840111600160201b83111715610ad457600080fd5b919350915080359060208101359060400135612944565b610b0860048036036020811015610b0157600080fd5b5035612a9a565b604080519c8d529a151560208d01528b8b019990995260608b019790975260808a019590955260a089019390935260c088019190915260e08701526001600160a01b039081166101008701521661012085015261014084015261016083015251908190036101800190f35b6104d860048036036020811015610b8957600080fd5b5035612da5565b610605612dd4565b61051160048036036020811015610bae57600080fd5b5035612e43565b61060560048036036040811015610bcb57600080fd5b506001600160a01b038135169060200135612e55565b6105bd612f5b565b6105bd60048036036040811015610bff57600080fd5b5080359060200135612f6f565b6104d860048036036040811015610c2257600080fd5b50803590602001356001600160a01b0316612f8d565b61060560048036036060811015610c4e57600080fd5b5080359060208101359060400135612fab565b61052b613444565b610605600480360360a0811015610c7f57600080fd5b81359160208101359160408201359190810190608081016060820135600160201b811115610cac57600080fd5b820183602082011115610cbe57600080fd5b803590602001918460018302840111600160201b83111715610cdf57600080fd5b9193509150356134a5565b610d0760048036036020811015610d0057600080fd5b5035613558565b604080516001600160a01b039094168452911515602084015282820152519081900360600190f35b610511613598565b61060560048036036040811015610d4d57600080fd5b506001600160a01b038135169060200135151561359d565b61060560048036036080811015610d7b57600080fd5b508035906001600160a01b036020820135811691604081013590911690606001356136a2565b61051160048036036020811015610db757600080fd5b5035613717565b6104d860048036036020811015610dd457600080fd5b5035613729565b61060560048036036080811015610df157600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b811115610e2b57600080fd5b820183602082011115610e3d57600080fd5b803590602001918460018302840111600160201b83111715610e5e57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061375c945050505050565b611060600480360360a0811015610eb557600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b811115610ee857600080fd5b820183602082011115610efa57600080fd5b803590602001918460208302840111600160201b83111715610f1b57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610f6a57600080fd5b820183602082011115610f7c57600080fd5b803590602001918460208302840111600160201b83111715610f9d57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610fec57600080fd5b820183602082011115610ffe57600080fd5b803590602001918460018302840111600160201b8311171561101f57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506137b4945050505050565b604080516001600160e01b03199092168252519081900360200190f35b6106056004803603604081101561109357600080fd5b50803590602001356137c5565b610605600480360360208110156110b657600080fd5b50356138f3565b610511600480360360208110156110d357600080fd5b50356139d3565b610511600480360360208110156110f057600080fd5b5035613ab6565b61052b6004803603602081101561110d57600080fd5b5035613afc565b6105bd6004803603604081101561112a57600080fd5b50803590602001356001600160a01b0316613da3565b6105116004803603602081101561115657600080fd5b5035613dc9565b6105116004803603602081101561117357600080fd5b5035613de0565b610511613df2565b6106056004803603604081101561119857600080fd5b50803590602001356001600160a01b0316613e15565b6111cb600480360360208110156111c457600080fd5b5035613e6e565b604080516001600160a01b039094168452602084019290925282820152519081900360600190f35b6106056004803603602081101561120957600080fd5b5035613e99565b6105116004803603602081101561122657600080fd5b5035613f8e565b61124a6004803603602081101561124357600080fd5b5035613fa0565b6040518080602001858152602001848152602001838152602001828103825286818151815260200191508051906020019080838360005b83811015611299578181015183820152602001611281565b50505050905090810190601f1680156112c65780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b61051161406b565b61052b61408e565b6104d8600480360360408110156112fd57600080fd5b506001600160a01b03813581169160200135166140c5565b6105116140f3565b611060600480360360a081101561133357600080fd5b6001600160a01b03823581169260208101359091169160408201359160608101359181019060a081016080820135600160201b81111561137257600080fd5b82018360208201111561138457600080fd5b803590602001918460018302840111600160201b831117156113a557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506140f9945050505050565b610605600480360360208110156113fc57600080fd5b50356001600160a01b031661410a565b6106056004803603604081101561142257600080fd5b50803590602001356001600160a01b0316614225565b610511614319565b61051161431f565b6105bd614344565b6001600160e01b0319811660009081526001602052604090205460ff165b919050565b60165460ff1681565b600081815260196020526040812054819061149e90606463ffffffff61435316565b9050806114af57600191505061146e565b60006114ce6114c96020548461439590919063ffffffff16565b6143ee565b6fffffffffffffffffffffffffffffffff1690506114f76021548261439590919063ffffffff16565b949350505050565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561158b5780601f106115605761010080835404028352916020019161158b565b820191906000526020600020905b81548152906001019060200180831161156e57829003601f168201915b505050505090505b90565b60006115a182614534565b6115dc5760405162461bcd60e51b815260040180806020018281038252602c815260200180615c87602c913960400191505060405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600061160382612438565b9050806001600160a01b0316836001600160a01b031614156116565760405162461bcd60e51b8152600401808060200182810382526021815260200180615d0b6021913960400191505060405180910390fd5b806001600160a01b0316611668614547565b6001600160a01b03161480611689575061168981611684614547565b6140c5565b6116c45760405162461bcd60e51b8152600401808060200182810382526038815260200180615b826038913960400191505060405180910390fd5b6116ce838361454b565b505050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061170690611701614547565b612f8d565b6117415760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b816011848154811061174f57fe5b906000526020600020906002020160000160146101000a81548160ff021916908315150217905550806011848154811061178557fe5b6000918252602090912060029091020180546001600160a01b0319166001600160a01b0392909216919091179055505050565b60165460ff1615611805576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604482015290519081900360640190fd5b61180e81612da5565b61185f576040805162461bcd60e51b815260206004820152601760248201527f54686973206974656d20646f65736e2774206578697374000000000000000000604482015290519081900360640190fd5b6000818152601b60205260409020543361187884612438565b6001600160a01b031614806118c057506000838152601f6020526040812033916118a186612438565b6001600160a01b03908116825260208201929092526040016000205416145b6118fb5760405162461bcd60e51b8152600401808060200182810382526035815260200180615d2c6035913960400191505060405180910390fd5b600061192360646119176014548561439590919063ffffffff16565b9063ffffffff61435316565b905061192e84613729565b61197f576000838152601c60209081526040808320548784526019835281842055858352601e90915290205461196b90429063ffffffff6145b916565b6000858152601860205260409020556119ea565b6000838152601e602052604090205461199f90429063ffffffff6145b916565b600085815260186020908152604080832093909355858252601c8152828220548783526019909152919020546119da9163ffffffff6145b916565b6000858152601960205260409020555b600f5460105411611b0a57611a17611a08838363ffffffff61461316565b6010549063ffffffff6145b916565b601055600d54604080516323b872dd60e01b81523360048201523060248201526044810185905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015611a7457600080fd5b505af1158015611a88573d6000803e3d6000fd5b505050506040513d6020811015611a9e57600080fd5b5050600d5460408051630852cd8d60e31b81526004810184905290516001600160a01b03909216916342966c689160248082019260009290919082900301818387803b158015611aed57600080fd5b505af1158015611b01573d6000803e3d6000fd5b50505050611b76565b600d546040805163079cc67960e41b81523360048201526024810185905290516001600160a01b03909216916379cc67909160448082019260009290919082900301818387803b158015611b5d57600080fd5b505af1158015611b71573d6000803e3d6000fd5b505050505b6040805185815233602082015280820185905290517f439f4bb7e1078ad47b0525c8cc0b23ca53c71806a612c490a11dc1192f7cb6719181900360600190a150505050565b6000611bc76003614655565b905090565b601e6020526000908152604090205481565b601c6020526000908152604090205481565b611c01611bfb614547565b82614660565b611c3c5760405162461bcd60e51b8152600401808060200182810382526031815260200180615d876031913960400191505060405180910390fd5b6116ce8383836146fc565b60009081526019602052604090205490565b60115490565b60009081526020819052604090206002015490565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d019020611ca290611701614547565b611cdd5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b604080516060810182526001600160a01b039384168152600160208201818152928201938452601180549182018155600052905160029091027f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c688101805493511515600160a01b0260ff60a01b19939096166001600160a01b03199094169390931791909116939093179055517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6990910155565b600082815260208190526040902060020154611daf90611701614547565b611dea5760405162461bcd60e51b815260040180806020018281038252602f8152602001806159c3602f913960400191505060405180910390fd5b611df4828261485a565b5050565b6001600160a01b0382166000908152600260205260408120611e20908363ffffffff6148c916565b90505b92915050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d019020611e5790611701614547565b611e925760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b600f55565b611e9f614547565b6001600160a01b0316816001600160a01b031614611eee5760405162461bcd60e51b815260040180806020018281038252602f815260200180615e4e602f913960400191505060405180910390fd5b611df482826148d5565b604080516a5041555345525f524f4c4560a81b8152905190819003600b019020611f2490611701614547565b611f5f5760405162461bcd60e51b8152600401808060200182810382526040815260200180615e0e6040913960400191505060405180910390fd5b611f67614944565b565b6116ce8383836040518060200160405280600081525061375c565b611f8f611bfb614547565b611fca5760405162461bcd60e51b8152600401808060200182810382526030815260200180615dde6030913960400191505060405180910390fd5b611fd3816149e2565b50565b60105481565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061200a90611701614547565b6120455760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6016805460ff1916911515919091179055565b60008061206c60038463ffffffff614abb16565b509392505050565b60165460ff16156120c1576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604482015290519081900360640190fd5b6120ca81613729565b6121055760405162461bcd60e51b81526004018080602001828103825260218152602001806159f26021913960400191505060405180910390fd5b600081815260176020526040902054612127906201518063ffffffff6145b916565b421015806121415750600081815260176020526040902054155b61217c5760405162461bcd60e51b8152600401808060200182810382526037815260200180615c0d6037913960400191505060405180910390fd5b3361218682612438565b6001600160a01b031614806121ce57506000818152601f6020526040812033916121af84612438565b6001600160a01b03908116825260208201929092526040016000205416145b6122095760405162461bcd60e51b8152600401808060200182810382526026815260200180615db86026913960400191505060405180910390fd5b60008181526017602090815260408083204290558051633036004b60e21b8152600481018590529051309263c0d8012c9260248082019391829003018186803b15801561225557600080fd5b505afa158015612269573d6000803e3d6000fd5b505050506040513d602081101561227f57600080fd5b5051600d54604080516340c10f1960e01b81523360048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b1580156122d757600080fd5b505af11580156122eb573d6000803e3d6000fd5b50506040805185815233602082015280820185905290517f4c15960103575e0473c012f6f5aebaf77622874ce56298ba74b4019c0783e0879350908190036060019150a15050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061236190611701614547565b61239c5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b611fd381614ad7565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d0190206123d390611701614547565b61240e5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b670de0b6b3a764000002601555565b60176020526000908152604090205481565b600b5460ff1690565b6000611e2382604051806060016040528060298152602001615be4602991396003919063ffffffff614aea16565b604080516a4d494e5445525f524f4c4560a81b8152905190819003600b01902061249290611701614547565b6124cd5760405162461bcd60e51b815260040180806020018281038252602b815260200180615b57602b913960400191505060405180910390fd5b6124e0426203f48063ffffffff6145b916565b601860006124ee6012614af7565b81526020019081526020016000208190555042601a600061250f6012614af7565b8152602001908152602001600020819055506040518060600160405280306001600160a01b031681526020016125456012614af7565b81526020016102d1815250600e600061255e6012614af7565b81526020808201929092526040908101600020835181546001600160a01b0319166001600160a01b0390911617815591830151600183015591909101516002909101556125b4816125af6012614af7565b614afb565b6125be6012614c35565b6040805133815290517fdef35ba68b5333d80978286d243080e34d68d867d7c392df8856ecb9f20ca7719181900360200190a150565b600a8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561158b5780601f106115605761010080835404028352916020019161158b565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061268390611701614547565b6126be5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b60648111156126cc57600080fd5b60145460408051918252517f68f2e5b1fa981c819fba40e54107320778c80025b1390f427b61521f812c539e9181900360200190a150565b60006001600160a01b03821661274b5760405162461bcd60e51b815260040180806020018281038252602a815260200180615bba602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600260205260409020611e2390614655565b612774614547565b600b5461010090046001600160a01b039081169116146127db576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600b5460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600b8054610100600160a81b0319169055565b60155481565b601d6020908152600091825260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156128c45780601f10612899576101008083540402835291602001916128c4565b820191906000526020600020905b8154815290600101906020018083116128a757829003601f168201915b505050505081565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d0190206128fa90611701614547565b6129355760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b60209390935560225550602155565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902060009061297590611701614547565b6129b05760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6129ba6013614c35565b60006129c66013614af7565b6000818152601d602052604090209091506129e29088886157d4565b506000818152601b60209081526040808320670de0b6b3a764000089029055601c8252808320879055601e82529182902085905581518381529182018790526060820186905260809082018181529082018890527ffed0f31785f93738e65b9d4e2da5f8f07faf314599d960928cf02d2fcadd36419183918a918a918a918a9160a08201868680828437600083820152604051601f909101601f19169092018290039850909650505050505050a15095945050505050565b6000806000806000806000806000806000808c9b50306001600160a01b031663b6d7f6108e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612af357600080fd5b505afa158015612b07573d6000803e3d6000fd5b505050506040513d6020811015612b1d57600080fd5b81019080805190602001909291905050509a50306001600160a01b03166323bee7688e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612b7457600080fd5b505afa158015612b88573d6000803e3d6000fd5b505050506040513d6020811015612b9e57600080fd5b81019080805190602001909291905050509950306001600160a01b03166305c58df28e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612bf557600080fd5b505afa158015612c09573d6000803e3d6000fd5b505050506040513d6020811015612c1f57600080fd5b81019080805190602001909291905050509850306001600160a01b031663c0d8012c8e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612c7657600080fd5b505afa158015612c8a573d6000803e3d6000fd5b505050506040513d6020811015612ca057600080fd5b81019080805190602001909291905050509750601860008e8152602001908152602001600020549650601760008e8152602001908152602001600020549550601a60008e8152602001908152602001600020549450306001600160a01b0316636352211e8e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612d3957600080fd5b505afa158015612d4d573d6000803e3d6000fd5b505050506040513d6020811015612d6357600080fd5b505160008e8152600e6020526040902080546001909101549195506001600160a01b031693509150612d948d613ab6565b905091939597999b5091939597999b565b6000818152601d6020526040812054600260001961010060018416150201909116041561146e5750600161146e565b604080516a5041555345525f524f4c4560a81b8152905190819003600b019020612e0090611701614547565b612e3b5760405162461bcd60e51b815260040180806020018281038252603e815260200180615a99603e913960400191505060405180910390fd5b611f67614c3e565b60186020526000908152604090205481565b612e5d614547565b600b5461010090046001600160a01b03908116911614612ec4576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b816001600160a01b031663a9059cbb612edb612f5b565b836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015612f2b57600080fd5b505af1158015612f3f573d6000803e3d6000fd5b505050506040513d6020811015612f5557600080fd5b50505050565b600b5461010090046001600160a01b031690565b6000828152602081905260408120611e20908363ffffffff6148c916565b6000828152602081905260408120611e20908363ffffffff614cbf16565b60165460ff1615612ff8576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604482015290519081900360640190fd5b6000613016606461191760145460155461439590919063ffffffff16565b9050600f54601054116131305760155461303a90611a08908363ffffffff61461316565b601055600d54601554604080516323b872dd60e01b81523360048201523060248201526044810192909252516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561309a57600080fd5b505af11580156130ae573d6000803e3d6000fd5b505050506040513d60208110156130c457600080fd5b5050600d5460408051630852cd8d60e31b81526004810184905290516001600160a01b03909216916342966c689160248082019260009290919082900301818387803b15801561311357600080fd5b505af1158015613127573d6000803e3d6000fd5b5050505061319f565b600d546015546040805163079cc67960e41b81523360048201526024810192909252516001600160a01b03909216916379cc67909160448082019260009290919082900301818387803b15801561318657600080fd5b505af115801561319a573d6000803e3d6000fd5b505050505b816102d1141561323357601184815481106131b657fe5b60009182526020822060029091020154604080516323b872dd60e01b81523360048201523060248201526044810187905290516001600160a01b03909216926323b872dd9260648084019382900301818387803b15801561321657600080fd5b505af115801561322a573d6000803e3d6000fd5b505050506132e4565b8161048314156132e4576011848154811061324a57fe5b6000918252602082206002909102015460408051637921219560e11b8152336004820152306024820152604481018790526001606482015260a06084820152600360a48201526203078360ec1b60c482015290516001600160a01b039092169263f242432a9260e48084019382900301818387803b1580156132cb57600080fd5b505af11580156132df573d6000803e3d6000fd5b505050505b6040518060600160405280601186815481106132fc57fe5b600091825260208083206002909202909101546001600160a01b0316835282018690526040909101849052600e906133346012614af7565b81526020808201929092526040908101600020835181546001600160a01b0319166001600160a01b039091161781559183015160018301559190910151600290910155613384426203f4806145b9565b601860006133926012614af7565b81526020019081526020016000208190555042601a60006133b36012614af7565b81526020810191909152604001600020556133d2336125af6012614af7565b6133dc6012614c35565b7fb18abd95d05557ba3258b31392639db82d1c625a94bb024fb47b1e6c629607ce6011858154811061340a57fe5b600091825260209182902060029091020154604080516001600160a01b03909216825291810186905281519081900390910190a150505050565b60088054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561158b5780601f106115605761010080835404028352916020019161158b565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d0190206134d390611701614547565b61350e5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6000868152601b60209081526040808320889055601c8252808320879055601d909152902061353e9084846157d4565b506000958652601e60205260409095209490945550505050565b6011818154811061356557fe5b6000918252602090912060029091020180546001909101546001600160a01b0382169250600160a01b90910460ff169083565b600081565b6135a5614547565b6001600160a01b0316826001600160a01b0316141561360b576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060066000613618614547565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561365c614547565b60408051841515815290516001600160a01b0392909216917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a35050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d0190206136d090611701614547565b61370b5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b612f5584848484614cd4565b601b6020526000908152604090205481565b60008181526018602052604081205480158015906137475750428110155b1561375657600191505061146e565b50919050565b61376d613767614547565b83614660565b6137a85760405162461bcd60e51b8152600401808060200182810382526031815260200180615d876031913960400191505060405180910390fd5b612f5584848484614de5565b63bc197c8160e01b95945050505050565b60165460ff1615613812576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604482015290519081900360640190fd5b61381b82613729565b156138575760405162461bcd60e51b815260040180806020018281038252602e815260200180615a45602e913960400191505060405180910390fd5b60008281526019602052604090205461389d906138829060649061191790603c63ffffffff61439516565b6000838152601960205260409020549063ffffffff6145b916565b6000828152601960205260409020556138b5826149e2565b6040805183815233602082015281517f2d92fc340d92bc22b931aab28fb327ffb7dac16746586a0a119ac3df2ab42323929181900390910190a15050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061392190611701614547565b8061393c57503361393182612438565b6001600160a01b0316145b6139775760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6000818152601f6020908152604080832033845282529182902080546001600160a01b0319169055815183815291517f0ebda4ac6bc00d7a6e330a2a0cbfd21956023ba3ce8b66a913b9110cb3e1322c9281900390910190a150565b600080306001600160a01b03166305c58df2846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613a1a57600080fd5b505afa158015613a2e573d6000803e3d6000fd5b505050506040513d6020811015613a4457600080fd5b505190506001811415613a62576753444835ec58000091505061146e565b613a95602354611917602254613a89670de0b6b3a76400008661439590919063ffffffff16565b9063ffffffff61439516565b9050613aaf81674563918244f4000063ffffffff6145b916565b9392505050565b6000613ac182613729565b15613ace5750600061146e565b600082815260196020526040902054613af59060649061191790603c63ffffffff61439516565b905061146e565b6060613b0782614534565b613b425760405162461bcd60e51b815260040180806020018281038252602f815260200180615cdc602f913960400191505060405180910390fd5b60008281526009602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015613bd75780601f10613bac57610100808354040283529160200191613bd7565b820191906000526020600020905b815481529060010190602001808311613bba57829003601f168201915b5050600a5493945050505060026000196101006001841615020190911604613c0057905061146e565b805115613cd157600a816040516020018083805460018160011615610100020316600290048015613c685780601f10613c46576101008083540402835291820191613c68565b820191906000526020600020905b815481529060010190602001808311613c54575b5050825160208401908083835b60208310613c945780518252601f199092019160209182019101613c75565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405291505061146e565b600a613cdc84614e37565b6040516020018083805460018160011615610100020316600290048015613d3a5780601f10613d18576101008083540402835291820191613d3a565b820191906000526020600020905b815481529060010190602001808311613d26575b5050825160208401908083835b60208310613d665780518252601f199092019160209182019101613d47565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b601f6020908152600092835260408084209091529082529020546001600160a01b031681565b6000818152602081905260408120611e2390614655565b60196020526000908152604090205481565b604080516a4d494e5445525f524f4c4560a81b8152905190819003600b01902081565b600082815260208190526040902060020154613e3390611701614547565b611eee5760405162461bcd60e51b8152600401808060200182810382526030815260200180615b276030913960400191505060405180910390fd5b600e602052600090815260409020805460018201546002909201546001600160a01b03909116919083565b613ea281613729565b613edd5760405162461bcd60e51b8152600401808060200182810382526026815260200180615d616026913960400191505060405180910390fd5b613ee8333083611bf0565b613ef0615852565b506000818152600e60209081526040808320815160608101835281546001600160a01b03168152600180830154828601526002909201548184015285855260188452828520919091556019835281842093909355805184815290517fbeaa92c6354c6dcf375d2c514352b2c11bc865784722e5dd9b267e606eb5fc5f929181900390910190a1611df481602001518260000151338460400151614cd4565b601a6020526000908152604090205481565b6000818152601d602090815260408083208054825160026001831615610100026000190190921691909104601f81018590048502820185019093528281526060949384938493918301828280156140385780601f1061400d57610100808354040283529160200191614038565b820191906000526020600020905b81548152906001019060200180831161401b57829003601f168201915b50505060009788525050601b6020908152604080882054601e835281892054601c90935297205491979195509350915050565b604080516a5041555345525f524f4c4560a81b8152905190819003600b01902081565b6040805180820190915260208082527f68747470733a2f2f67616c6c6572792e766572796e696674792e696f2f6170699082015290565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b60145481565b63f23a6e6160e01b95945050505050565b614112614547565b600b5461010090046001600160a01b03908116911614614179576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166141be5760405162461bcd60e51b8152600401808060200182810382526026815260200180615a736026913960400191505060405180910390fd5b600b546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061425390611701614547565b8061426e57503361426383612438565b6001600160a01b0316145b6142a95760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6000828152601f6020908152604080832033845282529182902080546001600160a01b0319166001600160a01b03851690811790915582518581529182015281517f29a3012b8ba1289e68a851774f16b926e26d39b1ed2575c729a008d0b1bba8d1929181900390910190a15050565b600f5481565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902081565b600d546001600160a01b031681565b6000611e2083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614f12565b6000826143a457506000611e23565b828202828482816143b157fe5b0414611e205760405162461bcd60e51b8152600401808060200182810382526021815260200180615c666021913960400191505060405180910390fd5b6000816143fd5750600061146e565b816001600160801b82106144165760809190911c9060401b5b6801000000000000000082106144315760409190911c9060201b5b600160201b82106144475760209190911c9060101b5b62010000821061445c5760109190911c9060081b5b61010082106144705760089190911c9060041b5b601082106144835760049190911c9060021b5b6008821061448f5760011b5b600181858161449a57fe5b048201901c905060018185816144ac57fe5b048201901c905060018185816144be57fe5b048201901c905060018185816144d057fe5b048201901c905060018185816144e257fe5b048201901c905060018185816144f457fe5b048201901c9050600181858161450657fe5b048201901c9050600081858161451857fe5b049050808210614528578061452a565b815b935050505061146e565b6000611e2360038363ffffffff614fb416565b3390565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061458082612438565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600082820183811015611e20576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611e2083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614fc0565b6000611e2382614af7565b600061466b82614534565b6146a65760405162461bcd60e51b815260040180806020018281038252602c815260200180615afb602c913960400191505060405180910390fd5b60006146b183612438565b9050806001600160a01b0316846001600160a01b031614806146ec5750836001600160a01b03166146e184611596565b6001600160a01b0316145b806114f757506114f781856140c5565b826001600160a01b031661470f82612438565b6001600160a01b0316146147545760405162461bcd60e51b8152600401808060200182810382526029815260200180615cb36029913960400191505060405180910390fd5b6001600160a01b0382166147995760405162461bcd60e51b8152600401808060200182810382526024815260200180615ad76024913960400191505060405180910390fd5b6147a483838361501a565b6147af60008261454b565b6001600160a01b03831660009081526002602052604090206147d7908263ffffffff61502516565b506001600160a01b0382166000908152600260205260409020614800908263ffffffff61503116565b506148136003828463ffffffff61503d16565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000828152602081905260409020614878908263ffffffff61505316565b15611df457614885614547565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611e208383615068565b60008281526020819052604090206148f3908263ffffffff6150cc16565b15611df457614900614547565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600b5460ff16614992576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b600b805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6149c5614547565b604080516001600160a01b039092168252519081900360200190a1565b60006149ed82612438565b90506149fb8160008461501a565b614a0660008361454b565b6000828152600960205260409020546002600019610100600184161502019091160415614a44576000828152600960205260408120614a449161587c565b6001600160a01b0381166000908152600260205260409020614a6c908363ffffffff61502516565b50614a7e60038363ffffffff6150e116565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000808080614aca86866150ed565b9097909650945050505050565b8051611df490600a9060208401906158c0565b60006114f7848484615168565b5490565b6001600160a01b038216614b56576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b614b5f81614534565b15614bb1576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b614bbd6000838361501a565b6001600160a01b0382166000908152600260205260409020614be5908263ffffffff61503116565b50614bf86003828463ffffffff61503d16565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b80546001019055565b600b5460ff1615614c89576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b600b805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586149c5614547565b6000611e20836001600160a01b0384166151f5565b806104831415614d655760408051637921219560e11b81523060048201526001600160a01b038481166024830152604482018790526001606483015260a06084830152600060a4830181905292519086169263f242432a9260e4808201939182900301818387803b158015614d4857600080fd5b505af1158015614d5c573d6000803e3d6000fd5b50505050612f55565b806102d11415612f5557604080516323b872dd60e01b81523060048201526001600160a01b038481166024830152604482018790529151918516916323b872dd9160648082019260009290919082900301818387803b158015614dc757600080fd5b505af1158015614ddb573d6000803e3d6000fd5b5050505050505050565b614df08484846146fc565b614dfc8484848461520d565b612f555760405162461bcd60e51b8152600401808060200182810382526032815260200180615a136032913960400191505060405180910390fd5b606081614e5c57506040805180820190915260018152600360fc1b602082015261146e565b8160005b8115614e7457600101600a82049150614e60565b60608167ffffffffffffffff81118015614e8d57600080fd5b506040519080825280601f01601f191660200182016040528015614eb8576020820181803683370190505b50859350905060001982015b8315614f0957600a840660300160f81b82828060019003935081518110614ee757fe5b60200101906001600160f81b031916908160001a905350600a84049350614ec4565b50949350505050565b60008183614f9e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614f63578181015183820152602001614f4b565b50505050905090810190601f168015614f905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581614faa57fe5b0495945050505050565b6000611e2083836151f5565b600081848411156150125760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614f63578181015183820152602001614f4b565b505050900390565b6116ce83838361538d565b6000611e2083836153dc565b6000611e2083836154a2565b60006114f784846001600160a01b0385166154ec565b6000611e20836001600160a01b0384166154a2565b815460009082106150aa5760405162461bcd60e51b81526004018080602001828103825260228152602001806159496022913960400191505060405180910390fd5b8260000182815481106150b957fe5b9060005260206000200154905092915050565b6000611e20836001600160a01b0384166153dc565b6000611e208383615583565b8154600090819083106151315760405162461bcd60e51b8152600401808060200182810382526022815260200180615c446022913960400191505060405180910390fd5b600084600001848154811061514257fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816151c65760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614f63578181015183820152602001614f4b565b508460000160018203815481106151d957fe5b9060005260206000209060020201600101549150509392505050565b60009081526001919091016020526040902054151590565b6000615221846001600160a01b0316615657565b61522d575060016114f7565b6060615353630a85bd0160e11b615242614547565b88878760405160240180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156152bb5781810151838201526020016152a3565b50505050905090810190601f1680156152e85780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001615a13603291396001600160a01b038816919063ffffffff61565d16565b9050600081806020019051602081101561536c57600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b6153988383836116ce565b6153a061242f565b156116ce5760405162461bcd60e51b815260040180806020018281038252602b815260200180615998602b913960400191505060405180910390fd5b60008181526001830160205260408120548015615498578354600019808301919081019060009087908390811061540f57fe5b906000526020600020015490508087600001848154811061542c57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061545c57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611e23565b6000915050611e23565b60006154ae83836151f5565b6154e457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611e23565b506000611e23565b600082815260018401602052604081205480615551575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055613aaf565b8285600001600183038154811061556457fe5b9060005260206000209060020201600101819055506000915050613aaf565b6000818152600183016020526040812054801561549857835460001980830191908101906000908790839081106155b657fe5b90600052602060002090600202019050808760000184815481106155d657fe5b60009182526020808320845460029093020191825560019384015491840191909155835482528983019052604090209084019055865487908061561557fe5b6000828152602080822060026000199094019384020182815560019081018390559290935588815289820190925260408220919091559450611e239350505050565b3b151590565b60606114f78484600085606061567285615657565b6156c3576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106157025780518252601f1990920191602091820191016156e3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615764576040519150601f19603f3d011682016040523d82523d6000602084013e615769565b606091505b5091509150811561577d5791506114f79050565b80511561578d5780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315614f63578181015183820152602001614f4b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106158155782800160ff19823516178555615842565b82800160010185558215615842579182015b82811115615842578235825591602001919060010190615827565b5061584e92915061592e565b5090565b604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b50805460018160011615610100020316600290046000825580601f106158a25750611fd3565b601f016020900490600052602060002090810190611fd3919061592e565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061590157805160ff1916838001178555615842565b82800160010185558215615842579182015b82811115615842578251825591602001919060010190615913565b61159391905b8082111561584e576000815560010161593456fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473526f6c65733a2063616c6c657220646f6573206e6f74206861766520746865204f50455241544f5220726f6c654552433732315061757361626c653a20746f6b656e207472616e73666572207768696c6520706175736564416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74596f757220764e465420697320646561642c20796f752063616e2774206d696e654552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e74657254686520764e46542068617320746f206265207374617276656420746f20636c61696d2068697320706f696e74734f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732315072657365744d696e7465725061757365724175746f49643a206d75737420686176652070617573657220726f6c6520746f2070617573654552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65526f6c65733a2063616c6c657220646f6573206e6f74206861766520746865204d494e54455220726f6c654552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e43757272656e742074696d657374616d70206973206f76657220746865206c696d697420746f20636c61696d2074686520746f6b656e73456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e6473536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e6572596f75206d757374206f776e2074686520764e4654206f72206265206120636172652074616b657220746f20627579206974656d73596f757220764e465420697320646561642c20796f752063616e277420756e777261702069744552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564596f75206d757374206f776e2074686520764e465420746f20636c61696d20726577617264734552433732314275726e61626c653a2063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665644552433732315072657365744d696e7465725061757365724175746f49643a206d75737420686176652070617573657220726f6c6520746f20756e7061757365416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212204bf51dfc6c39c3079df44d6a00a265f02376487b1e521ca6313503176f6488ea64736f6c63430006060033000000000000000000000000b6ca7399b4f9ca56fc27cbff44f4d2e4eef1fc81

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106104ac5760003560e01c8063843bd6411161026d578063c8098e1211610151578063de7fe3e7116100ce578063f23a6e6111610092578063f23a6e611461131d578063f2fde38b146113e6578063f362ce981461140c578063f41c075214611438578063f5b541a614611440578063f8e1f51e14611448576104ac565b8063de7fe3e71461122d578063e63ab1e9146112d7578063e8a3d485146112df578063e985e9c5146112e7578063f01f20df14611315576104ac565b8063d539139311610115578063d53913931461117a578063d547741f14611182578063dcb49299146111ae578063de0e9a3e146111f3578063de5f749314611210576104ac565b8063c8098e12146110da578063c87b56dd146110f7578063c88a7c2f14611114578063ca15c87314611140578063d4f291a31461115d576104ac565b8063a09091df116101ea578063b6d7f610116101ae578063b6d7f61014610dbe578063b88d4fde14610ddb578063bc197c8114610e9f578063bc721e061461107d578063c071e267146110a0578063c0d8012c146110bd576104ac565b8063a09091df14610cea578063a217fddf14610d2f578063a22cb46514610d37578063a318c1a414610d65578063adcb005c14610da1576104ac565b80639010d07c116102315780639010d07c14610be957806391d1485414610c0c578063921b9ea814610c3857806395d89b4114610c6157806399cc726d14610c69576104ac565b8063843bd64114610b735780638456cb5914610b905780638652e49c14610b985780638980f11f14610bb55780638da5cb5b14610be1576104ac565b806342842e0e116103945780636352211e11610311578063715018a6116102d5578063715018a614610a1557806371701a4414610a1d5780637310dc8a14610a2557806377fe73e314610a4257806379c5cb1c14610a715780637a99c2b114610aeb576104ac565b80636352211e146109875780636a627842146109a45780636c0360eb146109ca5780636d855065146109d257806370a08231146109ef576104ac565b806350f70af91161035857806350f70af91461088457806355f804b3146108a157806356031c7814610945578063574dd8b9146109625780635c975abb1461097f576104ac565b806342842e0e146107ed57806342966c68146108235780634c20179e146108405780634f53126a146108485780634f6ccce714610867576104ac565b80632030c4b01161042d57806328b0eb0f116103f157806328b0eb0f146107185780632f2ff15d146107445780632f745c591461077057806331a198e41461079c57806336568abe146107b95780633f4ba83a146107e5576104ac565b80632030c4b01461068357806323b872dd146106a057806323bee768146106d6578063243dd6c0146106f3578063248a9ca3146106fb576104ac565b8063095ea7b311610474578063095ea7b3146105d957806310b220381461060757806310cc610c1461063b57806318160ddd1461065e57806319660d2114610666576104ac565b806301ffc9a7146104b15780630430e405146104ec57806305c58df2146104f457806306fdde0314610523578063081812fc146105a0575b600080fd5b6104d8600480360360208110156104c757600080fd5b50356001600160e01b031916611450565b604080519115158252519081900360200190f35b6104d8611473565b6105116004803603602081101561050a57600080fd5b503561147c565b60408051918252519081900360200190f35b61052b6114ff565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561056557818101518382015260200161054d565b50505050905090810190601f1680156105925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105bd600480360360208110156105b657600080fd5b5035611596565b604080516001600160a01b039092168252519081900360200190f35b610605600480360360408110156105ef57600080fd5b506001600160a01b0381351690602001356115f8565b005b6106056004803603606081101561061d57600080fd5b508035906020810135151590604001356001600160a01b03166116d3565b6106056004803603604081101561065157600080fd5b50803590602001356117b8565b610511611bbb565b6105116004803603602081101561067c57600080fd5b5035611bcc565b6105116004803603602081101561069957600080fd5b5035611bde565b610605600480360360608110156106b657600080fd5b506001600160a01b03813581169160208101359091169060400135611bf0565b610511600480360360208110156106ec57600080fd5b5035611c47565b610511611c59565b6105116004803603602081101561071157600080fd5b5035611c5f565b6106056004803603604081101561072e57600080fd5b506001600160a01b038135169060200135611c74565b6106056004803603604081101561075a57600080fd5b50803590602001356001600160a01b0316611d91565b6105116004803603604081101561078657600080fd5b506001600160a01b038135169060200135611df8565b610605600480360360208110156107b257600080fd5b5035611e29565b610605600480360360408110156107cf57600080fd5b50803590602001356001600160a01b0316611e97565b610605611ef8565b6106056004803603606081101561080357600080fd5b506001600160a01b03813581169160208101359091169060400135611f69565b6106056004803603602081101561083957600080fd5b5035611f84565b610511611fd6565b6106056004803603602081101561085e57600080fd5b50351515611fdc565b6105116004803603602081101561087d57600080fd5b5035612058565b6106056004803603602081101561089a57600080fd5b5035612074565b610605600480360360208110156108b757600080fd5b810190602081018135600160201b8111156108d157600080fd5b8201836020820111156108e357600080fd5b803590602001918460018302840111600160201b8311171561090457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550612333945050505050565b6106056004803603602081101561095b57600080fd5b50356123a5565b6105116004803603602081101561097857600080fd5b503561241d565b6104d861242f565b6105bd6004803603602081101561099d57600080fd5b5035612438565b610605600480360360208110156109ba57600080fd5b50356001600160a01b0316612466565b61052b6125f4565b610605600480360360208110156109e857600080fd5b5035612655565b61051160048036036020811015610a0557600080fd5b50356001600160a01b0316612704565b61060561276c565b61051161282b565b61052b60048036036020811015610a3b57600080fd5b5035612831565b61060560048036036080811015610a5857600080fd5b50803590602081013590604081013590606001356128cc565b6104d860048036036080811015610a8757600080fd5b810190602081018135600160201b811115610aa157600080fd5b820183602082011115610ab357600080fd5b803590602001918460018302840111600160201b83111715610ad457600080fd5b919350915080359060208101359060400135612944565b610b0860048036036020811015610b0157600080fd5b5035612a9a565b604080519c8d529a151560208d01528b8b019990995260608b019790975260808a019590955260a089019390935260c088019190915260e08701526001600160a01b039081166101008701521661012085015261014084015261016083015251908190036101800190f35b6104d860048036036020811015610b8957600080fd5b5035612da5565b610605612dd4565b61051160048036036020811015610bae57600080fd5b5035612e43565b61060560048036036040811015610bcb57600080fd5b506001600160a01b038135169060200135612e55565b6105bd612f5b565b6105bd60048036036040811015610bff57600080fd5b5080359060200135612f6f565b6104d860048036036040811015610c2257600080fd5b50803590602001356001600160a01b0316612f8d565b61060560048036036060811015610c4e57600080fd5b5080359060208101359060400135612fab565b61052b613444565b610605600480360360a0811015610c7f57600080fd5b81359160208101359160408201359190810190608081016060820135600160201b811115610cac57600080fd5b820183602082011115610cbe57600080fd5b803590602001918460018302840111600160201b83111715610cdf57600080fd5b9193509150356134a5565b610d0760048036036020811015610d0057600080fd5b5035613558565b604080516001600160a01b039094168452911515602084015282820152519081900360600190f35b610511613598565b61060560048036036040811015610d4d57600080fd5b506001600160a01b038135169060200135151561359d565b61060560048036036080811015610d7b57600080fd5b508035906001600160a01b036020820135811691604081013590911690606001356136a2565b61051160048036036020811015610db757600080fd5b5035613717565b6104d860048036036020811015610dd457600080fd5b5035613729565b61060560048036036080811015610df157600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b811115610e2b57600080fd5b820183602082011115610e3d57600080fd5b803590602001918460018302840111600160201b83111715610e5e57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061375c945050505050565b611060600480360360a0811015610eb557600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b811115610ee857600080fd5b820183602082011115610efa57600080fd5b803590602001918460208302840111600160201b83111715610f1b57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610f6a57600080fd5b820183602082011115610f7c57600080fd5b803590602001918460208302840111600160201b83111715610f9d57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610fec57600080fd5b820183602082011115610ffe57600080fd5b803590602001918460018302840111600160201b8311171561101f57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506137b4945050505050565b604080516001600160e01b03199092168252519081900360200190f35b6106056004803603604081101561109357600080fd5b50803590602001356137c5565b610605600480360360208110156110b657600080fd5b50356138f3565b610511600480360360208110156110d357600080fd5b50356139d3565b610511600480360360208110156110f057600080fd5b5035613ab6565b61052b6004803603602081101561110d57600080fd5b5035613afc565b6105bd6004803603604081101561112a57600080fd5b50803590602001356001600160a01b0316613da3565b6105116004803603602081101561115657600080fd5b5035613dc9565b6105116004803603602081101561117357600080fd5b5035613de0565b610511613df2565b6106056004803603604081101561119857600080fd5b50803590602001356001600160a01b0316613e15565b6111cb600480360360208110156111c457600080fd5b5035613e6e565b604080516001600160a01b039094168452602084019290925282820152519081900360600190f35b6106056004803603602081101561120957600080fd5b5035613e99565b6105116004803603602081101561122657600080fd5b5035613f8e565b61124a6004803603602081101561124357600080fd5b5035613fa0565b6040518080602001858152602001848152602001838152602001828103825286818151815260200191508051906020019080838360005b83811015611299578181015183820152602001611281565b50505050905090810190601f1680156112c65780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b61051161406b565b61052b61408e565b6104d8600480360360408110156112fd57600080fd5b506001600160a01b03813581169160200135166140c5565b6105116140f3565b611060600480360360a081101561133357600080fd5b6001600160a01b03823581169260208101359091169160408201359160608101359181019060a081016080820135600160201b81111561137257600080fd5b82018360208201111561138457600080fd5b803590602001918460018302840111600160201b831117156113a557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506140f9945050505050565b610605600480360360208110156113fc57600080fd5b50356001600160a01b031661410a565b6106056004803603604081101561142257600080fd5b50803590602001356001600160a01b0316614225565b610511614319565b61051161431f565b6105bd614344565b6001600160e01b0319811660009081526001602052604090205460ff165b919050565b60165460ff1681565b600081815260196020526040812054819061149e90606463ffffffff61435316565b9050806114af57600191505061146e565b60006114ce6114c96020548461439590919063ffffffff16565b6143ee565b6fffffffffffffffffffffffffffffffff1690506114f76021548261439590919063ffffffff16565b949350505050565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561158b5780601f106115605761010080835404028352916020019161158b565b820191906000526020600020905b81548152906001019060200180831161156e57829003601f168201915b505050505090505b90565b60006115a182614534565b6115dc5760405162461bcd60e51b815260040180806020018281038252602c815260200180615c87602c913960400191505060405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600061160382612438565b9050806001600160a01b0316836001600160a01b031614156116565760405162461bcd60e51b8152600401808060200182810382526021815260200180615d0b6021913960400191505060405180910390fd5b806001600160a01b0316611668614547565b6001600160a01b03161480611689575061168981611684614547565b6140c5565b6116c45760405162461bcd60e51b8152600401808060200182810382526038815260200180615b826038913960400191505060405180910390fd5b6116ce838361454b565b505050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061170690611701614547565b612f8d565b6117415760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b816011848154811061174f57fe5b906000526020600020906002020160000160146101000a81548160ff021916908315150217905550806011848154811061178557fe5b6000918252602090912060029091020180546001600160a01b0319166001600160a01b0392909216919091179055505050565b60165460ff1615611805576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604482015290519081900360640190fd5b61180e81612da5565b61185f576040805162461bcd60e51b815260206004820152601760248201527f54686973206974656d20646f65736e2774206578697374000000000000000000604482015290519081900360640190fd5b6000818152601b60205260409020543361187884612438565b6001600160a01b031614806118c057506000838152601f6020526040812033916118a186612438565b6001600160a01b03908116825260208201929092526040016000205416145b6118fb5760405162461bcd60e51b8152600401808060200182810382526035815260200180615d2c6035913960400191505060405180910390fd5b600061192360646119176014548561439590919063ffffffff16565b9063ffffffff61435316565b905061192e84613729565b61197f576000838152601c60209081526040808320548784526019835281842055858352601e90915290205461196b90429063ffffffff6145b916565b6000858152601860205260409020556119ea565b6000838152601e602052604090205461199f90429063ffffffff6145b916565b600085815260186020908152604080832093909355858252601c8152828220548783526019909152919020546119da9163ffffffff6145b916565b6000858152601960205260409020555b600f5460105411611b0a57611a17611a08838363ffffffff61461316565b6010549063ffffffff6145b916565b601055600d54604080516323b872dd60e01b81523360048201523060248201526044810185905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015611a7457600080fd5b505af1158015611a88573d6000803e3d6000fd5b505050506040513d6020811015611a9e57600080fd5b5050600d5460408051630852cd8d60e31b81526004810184905290516001600160a01b03909216916342966c689160248082019260009290919082900301818387803b158015611aed57600080fd5b505af1158015611b01573d6000803e3d6000fd5b50505050611b76565b600d546040805163079cc67960e41b81523360048201526024810185905290516001600160a01b03909216916379cc67909160448082019260009290919082900301818387803b158015611b5d57600080fd5b505af1158015611b71573d6000803e3d6000fd5b505050505b6040805185815233602082015280820185905290517f439f4bb7e1078ad47b0525c8cc0b23ca53c71806a612c490a11dc1192f7cb6719181900360600190a150505050565b6000611bc76003614655565b905090565b601e6020526000908152604090205481565b601c6020526000908152604090205481565b611c01611bfb614547565b82614660565b611c3c5760405162461bcd60e51b8152600401808060200182810382526031815260200180615d876031913960400191505060405180910390fd5b6116ce8383836146fc565b60009081526019602052604090205490565b60115490565b60009081526020819052604090206002015490565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d019020611ca290611701614547565b611cdd5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b604080516060810182526001600160a01b039384168152600160208201818152928201938452601180549182018155600052905160029091027f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c688101805493511515600160a01b0260ff60a01b19939096166001600160a01b03199094169390931791909116939093179055517f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c6990910155565b600082815260208190526040902060020154611daf90611701614547565b611dea5760405162461bcd60e51b815260040180806020018281038252602f8152602001806159c3602f913960400191505060405180910390fd5b611df4828261485a565b5050565b6001600160a01b0382166000908152600260205260408120611e20908363ffffffff6148c916565b90505b92915050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d019020611e5790611701614547565b611e925760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b600f55565b611e9f614547565b6001600160a01b0316816001600160a01b031614611eee5760405162461bcd60e51b815260040180806020018281038252602f815260200180615e4e602f913960400191505060405180910390fd5b611df482826148d5565b604080516a5041555345525f524f4c4560a81b8152905190819003600b019020611f2490611701614547565b611f5f5760405162461bcd60e51b8152600401808060200182810382526040815260200180615e0e6040913960400191505060405180910390fd5b611f67614944565b565b6116ce8383836040518060200160405280600081525061375c565b611f8f611bfb614547565b611fca5760405162461bcd60e51b8152600401808060200182810382526030815260200180615dde6030913960400191505060405180910390fd5b611fd3816149e2565b50565b60105481565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061200a90611701614547565b6120455760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6016805460ff1916911515919091179055565b60008061206c60038463ffffffff614abb16565b509392505050565b60165460ff16156120c1576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604482015290519081900360640190fd5b6120ca81613729565b6121055760405162461bcd60e51b81526004018080602001828103825260218152602001806159f26021913960400191505060405180910390fd5b600081815260176020526040902054612127906201518063ffffffff6145b916565b421015806121415750600081815260176020526040902054155b61217c5760405162461bcd60e51b8152600401808060200182810382526037815260200180615c0d6037913960400191505060405180910390fd5b3361218682612438565b6001600160a01b031614806121ce57506000818152601f6020526040812033916121af84612438565b6001600160a01b03908116825260208201929092526040016000205416145b6122095760405162461bcd60e51b8152600401808060200182810382526026815260200180615db86026913960400191505060405180910390fd5b60008181526017602090815260408083204290558051633036004b60e21b8152600481018590529051309263c0d8012c9260248082019391829003018186803b15801561225557600080fd5b505afa158015612269573d6000803e3d6000fd5b505050506040513d602081101561227f57600080fd5b5051600d54604080516340c10f1960e01b81523360048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b1580156122d757600080fd5b505af11580156122eb573d6000803e3d6000fd5b50506040805185815233602082015280820185905290517f4c15960103575e0473c012f6f5aebaf77622874ce56298ba74b4019c0783e0879350908190036060019150a15050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061236190611701614547565b61239c5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b611fd381614ad7565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d0190206123d390611701614547565b61240e5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b670de0b6b3a764000002601555565b60176020526000908152604090205481565b600b5460ff1690565b6000611e2382604051806060016040528060298152602001615be4602991396003919063ffffffff614aea16565b604080516a4d494e5445525f524f4c4560a81b8152905190819003600b01902061249290611701614547565b6124cd5760405162461bcd60e51b815260040180806020018281038252602b815260200180615b57602b913960400191505060405180910390fd5b6124e0426203f48063ffffffff6145b916565b601860006124ee6012614af7565b81526020019081526020016000208190555042601a600061250f6012614af7565b8152602001908152602001600020819055506040518060600160405280306001600160a01b031681526020016125456012614af7565b81526020016102d1815250600e600061255e6012614af7565b81526020808201929092526040908101600020835181546001600160a01b0319166001600160a01b0390911617815591830151600183015591909101516002909101556125b4816125af6012614af7565b614afb565b6125be6012614c35565b6040805133815290517fdef35ba68b5333d80978286d243080e34d68d867d7c392df8856ecb9f20ca7719181900360200190a150565b600a8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561158b5780601f106115605761010080835404028352916020019161158b565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061268390611701614547565b6126be5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b60648111156126cc57600080fd5b60145460408051918252517f68f2e5b1fa981c819fba40e54107320778c80025b1390f427b61521f812c539e9181900360200190a150565b60006001600160a01b03821661274b5760405162461bcd60e51b815260040180806020018281038252602a815260200180615bba602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600260205260409020611e2390614655565b612774614547565b600b5461010090046001600160a01b039081169116146127db576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600b5460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600b8054610100600160a81b0319169055565b60155481565b601d6020908152600091825260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845290918301828280156128c45780601f10612899576101008083540402835291602001916128c4565b820191906000526020600020905b8154815290600101906020018083116128a757829003601f168201915b505050505081565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d0190206128fa90611701614547565b6129355760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b60209390935560225550602155565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902060009061297590611701614547565b6129b05760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6129ba6013614c35565b60006129c66013614af7565b6000818152601d602052604090209091506129e29088886157d4565b506000818152601b60209081526040808320670de0b6b3a764000089029055601c8252808320879055601e82529182902085905581518381529182018790526060820186905260809082018181529082018890527ffed0f31785f93738e65b9d4e2da5f8f07faf314599d960928cf02d2fcadd36419183918a918a918a918a9160a08201868680828437600083820152604051601f909101601f19169092018290039850909650505050505050a15095945050505050565b6000806000806000806000806000806000808c9b50306001600160a01b031663b6d7f6108e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612af357600080fd5b505afa158015612b07573d6000803e3d6000fd5b505050506040513d6020811015612b1d57600080fd5b81019080805190602001909291905050509a50306001600160a01b03166323bee7688e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612b7457600080fd5b505afa158015612b88573d6000803e3d6000fd5b505050506040513d6020811015612b9e57600080fd5b81019080805190602001909291905050509950306001600160a01b03166305c58df28e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612bf557600080fd5b505afa158015612c09573d6000803e3d6000fd5b505050506040513d6020811015612c1f57600080fd5b81019080805190602001909291905050509850306001600160a01b031663c0d8012c8e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612c7657600080fd5b505afa158015612c8a573d6000803e3d6000fd5b505050506040513d6020811015612ca057600080fd5b81019080805190602001909291905050509750601860008e8152602001908152602001600020549650601760008e8152602001908152602001600020549550601a60008e8152602001908152602001600020549450306001600160a01b0316636352211e8e6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015612d3957600080fd5b505afa158015612d4d573d6000803e3d6000fd5b505050506040513d6020811015612d6357600080fd5b505160008e8152600e6020526040902080546001909101549195506001600160a01b031693509150612d948d613ab6565b905091939597999b5091939597999b565b6000818152601d6020526040812054600260001961010060018416150201909116041561146e5750600161146e565b604080516a5041555345525f524f4c4560a81b8152905190819003600b019020612e0090611701614547565b612e3b5760405162461bcd60e51b815260040180806020018281038252603e815260200180615a99603e913960400191505060405180910390fd5b611f67614c3e565b60186020526000908152604090205481565b612e5d614547565b600b5461010090046001600160a01b03908116911614612ec4576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b816001600160a01b031663a9059cbb612edb612f5b565b836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015612f2b57600080fd5b505af1158015612f3f573d6000803e3d6000fd5b505050506040513d6020811015612f5557600080fd5b50505050565b600b5461010090046001600160a01b031690565b6000828152602081905260408120611e20908363ffffffff6148c916565b6000828152602081905260408120611e20908363ffffffff614cbf16565b60165460ff1615612ff8576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604482015290519081900360640190fd5b6000613016606461191760145460155461439590919063ffffffff16565b9050600f54601054116131305760155461303a90611a08908363ffffffff61461316565b601055600d54601554604080516323b872dd60e01b81523360048201523060248201526044810192909252516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561309a57600080fd5b505af11580156130ae573d6000803e3d6000fd5b505050506040513d60208110156130c457600080fd5b5050600d5460408051630852cd8d60e31b81526004810184905290516001600160a01b03909216916342966c689160248082019260009290919082900301818387803b15801561311357600080fd5b505af1158015613127573d6000803e3d6000fd5b5050505061319f565b600d546015546040805163079cc67960e41b81523360048201526024810192909252516001600160a01b03909216916379cc67909160448082019260009290919082900301818387803b15801561318657600080fd5b505af115801561319a573d6000803e3d6000fd5b505050505b816102d1141561323357601184815481106131b657fe5b60009182526020822060029091020154604080516323b872dd60e01b81523360048201523060248201526044810187905290516001600160a01b03909216926323b872dd9260648084019382900301818387803b15801561321657600080fd5b505af115801561322a573d6000803e3d6000fd5b505050506132e4565b8161048314156132e4576011848154811061324a57fe5b6000918252602082206002909102015460408051637921219560e11b8152336004820152306024820152604481018790526001606482015260a06084820152600360a48201526203078360ec1b60c482015290516001600160a01b039092169263f242432a9260e48084019382900301818387803b1580156132cb57600080fd5b505af11580156132df573d6000803e3d6000fd5b505050505b6040518060600160405280601186815481106132fc57fe5b600091825260208083206002909202909101546001600160a01b0316835282018690526040909101849052600e906133346012614af7565b81526020808201929092526040908101600020835181546001600160a01b0319166001600160a01b039091161781559183015160018301559190910151600290910155613384426203f4806145b9565b601860006133926012614af7565b81526020019081526020016000208190555042601a60006133b36012614af7565b81526020810191909152604001600020556133d2336125af6012614af7565b6133dc6012614c35565b7fb18abd95d05557ba3258b31392639db82d1c625a94bb024fb47b1e6c629607ce6011858154811061340a57fe5b600091825260209182902060029091020154604080516001600160a01b03909216825291810186905281519081900390910190a150505050565b60088054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561158b5780601f106115605761010080835404028352916020019161158b565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d0190206134d390611701614547565b61350e5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6000868152601b60209081526040808320889055601c8252808320879055601d909152902061353e9084846157d4565b506000958652601e60205260409095209490945550505050565b6011818154811061356557fe5b6000918252602090912060029091020180546001909101546001600160a01b0382169250600160a01b90910460ff169083565b600081565b6135a5614547565b6001600160a01b0316826001600160a01b0316141561360b576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060066000613618614547565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561365c614547565b60408051841515815290516001600160a01b0392909216917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a35050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d0190206136d090611701614547565b61370b5760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b612f5584848484614cd4565b601b6020526000908152604090205481565b60008181526018602052604081205480158015906137475750428110155b1561375657600191505061146e565b50919050565b61376d613767614547565b83614660565b6137a85760405162461bcd60e51b8152600401808060200182810382526031815260200180615d876031913960400191505060405180910390fd5b612f5584848484614de5565b63bc197c8160e01b95945050505050565b60165460ff1615613812576040805162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b604482015290519081900360640190fd5b61381b82613729565b156138575760405162461bcd60e51b815260040180806020018281038252602e815260200180615a45602e913960400191505060405180910390fd5b60008281526019602052604090205461389d906138829060649061191790603c63ffffffff61439516565b6000838152601960205260409020549063ffffffff6145b916565b6000828152601960205260409020556138b5826149e2565b6040805183815233602082015281517f2d92fc340d92bc22b931aab28fb327ffb7dac16746586a0a119ac3df2ab42323929181900390910190a15050565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061392190611701614547565b8061393c57503361393182612438565b6001600160a01b0316145b6139775760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6000818152601f6020908152604080832033845282529182902080546001600160a01b0319169055815183815291517f0ebda4ac6bc00d7a6e330a2a0cbfd21956023ba3ce8b66a913b9110cb3e1322c9281900390910190a150565b600080306001600160a01b03166305c58df2846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015613a1a57600080fd5b505afa158015613a2e573d6000803e3d6000fd5b505050506040513d6020811015613a4457600080fd5b505190506001811415613a62576753444835ec58000091505061146e565b613a95602354611917602254613a89670de0b6b3a76400008661439590919063ffffffff16565b9063ffffffff61439516565b9050613aaf81674563918244f4000063ffffffff6145b916565b9392505050565b6000613ac182613729565b15613ace5750600061146e565b600082815260196020526040902054613af59060649061191790603c63ffffffff61439516565b905061146e565b6060613b0782614534565b613b425760405162461bcd60e51b815260040180806020018281038252602f815260200180615cdc602f913960400191505060405180910390fd5b60008281526009602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015613bd75780601f10613bac57610100808354040283529160200191613bd7565b820191906000526020600020905b815481529060010190602001808311613bba57829003601f168201915b5050600a5493945050505060026000196101006001841615020190911604613c0057905061146e565b805115613cd157600a816040516020018083805460018160011615610100020316600290048015613c685780601f10613c46576101008083540402835291820191613c68565b820191906000526020600020905b815481529060010190602001808311613c54575b5050825160208401908083835b60208310613c945780518252601f199092019160209182019101613c75565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405291505061146e565b600a613cdc84614e37565b6040516020018083805460018160011615610100020316600290048015613d3a5780601f10613d18576101008083540402835291820191613d3a565b820191906000526020600020905b815481529060010190602001808311613d26575b5050825160208401908083835b60208310613d665780518252601f199092019160209182019101613d47565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b601f6020908152600092835260408084209091529082529020546001600160a01b031681565b6000818152602081905260408120611e2390614655565b60196020526000908152604090205481565b604080516a4d494e5445525f524f4c4560a81b8152905190819003600b01902081565b600082815260208190526040902060020154613e3390611701614547565b611eee5760405162461bcd60e51b8152600401808060200182810382526030815260200180615b276030913960400191505060405180910390fd5b600e602052600090815260409020805460018201546002909201546001600160a01b03909116919083565b613ea281613729565b613edd5760405162461bcd60e51b8152600401808060200182810382526026815260200180615d616026913960400191505060405180910390fd5b613ee8333083611bf0565b613ef0615852565b506000818152600e60209081526040808320815160608101835281546001600160a01b03168152600180830154828601526002909201548184015285855260188452828520919091556019835281842093909355805184815290517fbeaa92c6354c6dcf375d2c514352b2c11bc865784722e5dd9b267e606eb5fc5f929181900390910190a1611df481602001518260000151338460400151614cd4565b601a6020526000908152604090205481565b6000818152601d602090815260408083208054825160026001831615610100026000190190921691909104601f81018590048502820185019093528281526060949384938493918301828280156140385780601f1061400d57610100808354040283529160200191614038565b820191906000526020600020905b81548152906001019060200180831161401b57829003601f168201915b50505060009788525050601b6020908152604080882054601e835281892054601c90935297205491979195509350915050565b604080516a5041555345525f524f4c4560a81b8152905190819003600b01902081565b6040805180820190915260208082527f68747470733a2f2f67616c6c6572792e766572796e696674792e696f2f6170699082015290565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b60145481565b63f23a6e6160e01b95945050505050565b614112614547565b600b5461010090046001600160a01b03908116911614614179576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166141be5760405162461bcd60e51b8152600401808060200182810382526026815260200180615a736026913960400191505060405180910390fd5b600b546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600b80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902061425390611701614547565b8061426e57503361426383612438565b6001600160a01b0316145b6142a95760405162461bcd60e51b815260040180806020018281038252602d81526020018061596b602d913960400191505060405180910390fd5b6000828152601f6020908152604080832033845282529182902080546001600160a01b0319166001600160a01b03851690811790915582518581529182015281517f29a3012b8ba1289e68a851774f16b926e26d39b1ed2575c729a008d0b1bba8d1929181900390910190a15050565b600f5481565b604080516c4f50455241544f525f524f4c4560981b8152905190819003600d01902081565b600d546001600160a01b031681565b6000611e2083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614f12565b6000826143a457506000611e23565b828202828482816143b157fe5b0414611e205760405162461bcd60e51b8152600401808060200182810382526021815260200180615c666021913960400191505060405180910390fd5b6000816143fd5750600061146e565b816001600160801b82106144165760809190911c9060401b5b6801000000000000000082106144315760409190911c9060201b5b600160201b82106144475760209190911c9060101b5b62010000821061445c5760109190911c9060081b5b61010082106144705760089190911c9060041b5b601082106144835760049190911c9060021b5b6008821061448f5760011b5b600181858161449a57fe5b048201901c905060018185816144ac57fe5b048201901c905060018185816144be57fe5b048201901c905060018185816144d057fe5b048201901c905060018185816144e257fe5b048201901c905060018185816144f457fe5b048201901c9050600181858161450657fe5b048201901c9050600081858161451857fe5b049050808210614528578061452a565b815b935050505061146e565b6000611e2360038363ffffffff614fb416565b3390565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061458082612438565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600082820183811015611e20576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611e2083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250614fc0565b6000611e2382614af7565b600061466b82614534565b6146a65760405162461bcd60e51b815260040180806020018281038252602c815260200180615afb602c913960400191505060405180910390fd5b60006146b183612438565b9050806001600160a01b0316846001600160a01b031614806146ec5750836001600160a01b03166146e184611596565b6001600160a01b0316145b806114f757506114f781856140c5565b826001600160a01b031661470f82612438565b6001600160a01b0316146147545760405162461bcd60e51b8152600401808060200182810382526029815260200180615cb36029913960400191505060405180910390fd5b6001600160a01b0382166147995760405162461bcd60e51b8152600401808060200182810382526024815260200180615ad76024913960400191505060405180910390fd5b6147a483838361501a565b6147af60008261454b565b6001600160a01b03831660009081526002602052604090206147d7908263ffffffff61502516565b506001600160a01b0382166000908152600260205260409020614800908263ffffffff61503116565b506148136003828463ffffffff61503d16565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000828152602081905260409020614878908263ffffffff61505316565b15611df457614885614547565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611e208383615068565b60008281526020819052604090206148f3908263ffffffff6150cc16565b15611df457614900614547565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b600b5460ff16614992576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b600b805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6149c5614547565b604080516001600160a01b039092168252519081900360200190a1565b60006149ed82612438565b90506149fb8160008461501a565b614a0660008361454b565b6000828152600960205260409020546002600019610100600184161502019091160415614a44576000828152600960205260408120614a449161587c565b6001600160a01b0381166000908152600260205260409020614a6c908363ffffffff61502516565b50614a7e60038363ffffffff6150e116565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000808080614aca86866150ed565b9097909650945050505050565b8051611df490600a9060208401906158c0565b60006114f7848484615168565b5490565b6001600160a01b038216614b56576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b614b5f81614534565b15614bb1576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b614bbd6000838361501a565b6001600160a01b0382166000908152600260205260409020614be5908263ffffffff61503116565b50614bf86003828463ffffffff61503d16565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b80546001019055565b600b5460ff1615614c89576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b600b805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586149c5614547565b6000611e20836001600160a01b0384166151f5565b806104831415614d655760408051637921219560e11b81523060048201526001600160a01b038481166024830152604482018790526001606483015260a06084830152600060a4830181905292519086169263f242432a9260e4808201939182900301818387803b158015614d4857600080fd5b505af1158015614d5c573d6000803e3d6000fd5b50505050612f55565b806102d11415612f5557604080516323b872dd60e01b81523060048201526001600160a01b038481166024830152604482018790529151918516916323b872dd9160648082019260009290919082900301818387803b158015614dc757600080fd5b505af1158015614ddb573d6000803e3d6000fd5b5050505050505050565b614df08484846146fc565b614dfc8484848461520d565b612f555760405162461bcd60e51b8152600401808060200182810382526032815260200180615a136032913960400191505060405180910390fd5b606081614e5c57506040805180820190915260018152600360fc1b602082015261146e565b8160005b8115614e7457600101600a82049150614e60565b60608167ffffffffffffffff81118015614e8d57600080fd5b506040519080825280601f01601f191660200182016040528015614eb8576020820181803683370190505b50859350905060001982015b8315614f0957600a840660300160f81b82828060019003935081518110614ee757fe5b60200101906001600160f81b031916908160001a905350600a84049350614ec4565b50949350505050565b60008183614f9e5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614f63578181015183820152602001614f4b565b50505050905090810190601f168015614f905780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581614faa57fe5b0495945050505050565b6000611e2083836151f5565b600081848411156150125760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614f63578181015183820152602001614f4b565b505050900390565b6116ce83838361538d565b6000611e2083836153dc565b6000611e2083836154a2565b60006114f784846001600160a01b0385166154ec565b6000611e20836001600160a01b0384166154a2565b815460009082106150aa5760405162461bcd60e51b81526004018080602001828103825260228152602001806159496022913960400191505060405180910390fd5b8260000182815481106150b957fe5b9060005260206000200154905092915050565b6000611e20836001600160a01b0384166153dc565b6000611e208383615583565b8154600090819083106151315760405162461bcd60e51b8152600401808060200182810382526022815260200180615c446022913960400191505060405180910390fd5b600084600001848154811061514257fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816151c65760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614f63578181015183820152602001614f4b565b508460000160018203815481106151d957fe5b9060005260206000209060020201600101549150509392505050565b60009081526001919091016020526040902054151590565b6000615221846001600160a01b0316615657565b61522d575060016114f7565b6060615353630a85bd0160e11b615242614547565b88878760405160240180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156152bb5781810151838201526020016152a3565b50505050905090810190601f1680156152e85780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001615a13603291396001600160a01b038816919063ffffffff61565d16565b9050600081806020019051602081101561536c57600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b6153988383836116ce565b6153a061242f565b156116ce5760405162461bcd60e51b815260040180806020018281038252602b815260200180615998602b913960400191505060405180910390fd5b60008181526001830160205260408120548015615498578354600019808301919081019060009087908390811061540f57fe5b906000526020600020015490508087600001848154811061542c57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061545c57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611e23565b6000915050611e23565b60006154ae83836151f5565b6154e457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611e23565b506000611e23565b600082815260018401602052604081205480615551575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055613aaf565b8285600001600183038154811061556457fe5b9060005260206000209060020201600101819055506000915050613aaf565b6000818152600183016020526040812054801561549857835460001980830191908101906000908790839081106155b657fe5b90600052602060002090600202019050808760000184815481106155d657fe5b60009182526020808320845460029093020191825560019384015491840191909155835482528983019052604090209084019055865487908061561557fe5b6000828152602080822060026000199094019384020182815560019081018390559290935588815289820190925260408220919091559450611e239350505050565b3b151590565b60606114f78484600085606061567285615657565b6156c3576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106157025780518252601f1990920191602091820191016156e3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615764576040519150601f19603f3d011682016040523d82523d6000602084013e615769565b606091505b5091509150811561577d5791506114f79050565b80511561578d5780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315614f63578181015183820152602001614f4b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106158155782800160ff19823516178555615842565b82800160010185558215615842579182015b82811115615842578235825591602001919060010190615827565b5061584e92915061592e565b5090565b604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b50805460018160011615610100020316600290046000825580601f106158a25750611fd3565b601f016020900490600052602060002090810190611fd3919061592e565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061590157805160ff1916838001178555615842565b82800160010185558215615842579182015b82811115615842578251825591602001919060010190615913565b61159391905b8082111561584e576000815560010161593456fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473526f6c65733a2063616c6c657220646f6573206e6f74206861766520746865204f50455241544f5220726f6c654552433732315061757361626c653a20746f6b656e207472616e73666572207768696c6520706175736564416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74596f757220764e465420697320646561642c20796f752063616e2774206d696e654552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e74657254686520764e46542068617320746f206265207374617276656420746f20636c61696d2068697320706f696e74734f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732315072657365744d696e7465725061757365724175746f49643a206d75737420686176652070617573657220726f6c6520746f2070617573654552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65526f6c65733a2063616c6c657220646f6573206e6f74206861766520746865204d494e54455220726f6c654552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e43757272656e742074696d657374616d70206973206f76657220746865206c696d697420746f20636c61696d2074686520746f6b656e73456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e6473536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e6572596f75206d757374206f776e2074686520764e4654206f72206265206120636172652074616b657220746f20627579206974656d73596f757220764e465420697320646561642c20796f752063616e277420756e777261702069744552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564596f75206d757374206f776e2074686520764e465420746f20636c61696d20726577617264734552433732314275726e61626c653a2063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665644552433732315072657365744d696e7465725061757365724175746f49643a206d75737420686176652070617573657220726f6c6520746f20756e7061757365416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a26469706673582212204bf51dfc6c39c3079df44d6a00a265f02376487b1e521ca6313503176f6488ea64736f6c63430006060033

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

000000000000000000000000b6ca7399b4f9ca56fc27cbff44f4d2e4eef1fc81

-----Decoded View---------------
Arg [0] : _museToken (address): 0xB6Ca7399B4F9CA56FC27cBfF44F4d2e4Eef1fc81

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000b6ca7399b4f9ca56fc27cbff44f4d2e4eef1fc81


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

The VeryNifty gallery game allows anyone to level up their vNFTs and start mining MUSE.

Validator Index Block Amount
View All Withdrawals

Txn Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

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