Token GemFi

 

Overview ERC-721

Total Supply:
0 GMF

Holders:
6 addresses

Transfers:
-

Loading
[ Download CSV Export  ] 
Loading
[ Download CSV Export  ] 
Loading

Click here to update the token ICO / general information
# Exchange Pair Price  24H Volume % Volume
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GemFi

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 13 : GemFi.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

/*
GemFi
*/

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Base64.sol";

interface IRandomNumberGenerator {
    function getRandomNumber() external view returns (uint256);
}

struct Epoch{
    uint128 randomness;
    uint64 revealBlock;
    bool commited;
    bool revealed;
}

struct gemProperty {
    uint256 level;
    uint256 balance;
}

contract GemFi is ERC721{
    using Strings for uint256;
    using Counters for Counters.Counter;
    Counters.Counter private supply;
    address public owner;
    address public RANDOM=0x54F3f10f95363c8CBa51c7f6f6b70FaFF9e79Eb4;

    uint256 public activeSupply;
    uint256 public highestGemLevel;
    uint256 public gemPot; 
    uint256 public collectedFee;
    uint256 public lastDraw=block.timestamp;
    uint256 public lastWinner;
    uint256 public winnerPickDuration=24;

    uint256[] public highestLevelGems;
    mapping(uint256 => uint256) private highestLevelGemsIndex; 
    mapping(uint256 => mapping(uint256 => bool)) private gemIsHighestLevel;

    uint256 private mintChance;
    mapping(uint256 => gemProperty) private gem;

    uint256 private epochIndex=1;
    mapping (uint256=> Epoch) private epochs;
    uint256 private randomIndexEpoch;

    event GemUpgraded(bool trueOrFalse, uint256 gemId);
    event WinnerPicked(uint256 gemId);
  
    constructor() ERC721("GemFi", "GMF") {
        owner=msg.sender;
        resolveEpochIfNeeded();
    }

    modifier onlyOwner() {
        require(msg.sender == owner, "Not a contract owner");
        _;
    }

    //** Read Functions **

    function tokenURI(uint256 _gemId) public view override returns (string memory)
    {
        require(_exists(_gemId),"ERC721Metadata: URI query for nonexistent token");
        string memory output;
        string[8] memory item;

        item[0] = '<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 300 400" width="300" height="400">';

        item[1] = '<defs><linearGradient id = "gradient" x1 = "0%" y1 = "0%" x2 = "100%" y2 = "80%" ><stop offset="0%" style="stop-color:rgb(0,38,249);stop-opacity:1" /><stop offset="100%" style="stop-color:rgb(10,36,114);stop-opacity:0.7" /></linearGradient ><linearGradient id="gradient1" x1="0%" y1="0%" x2="100%" y2="80%"><stop offset="0%" style="stop-color:rgb(143,217,248);stop-opacity:1" /><stop offset="100%" style="stop-color:rgb(10,36,114);stop-opacity:0.9" /></linearGradient><linearGradient id="gradient2" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:rgb(146, 165, 247);stop-opacity:1" /><stop offset="100%" style="stop-color:rgb(0,38,249);stop-opacity:0.5" /></linearGradient></defs >';

        item[2]='<ellipse cx="150" cy="200" rx="150" ry="200" style="fill:rgb(0, 5, 107);opacity:1" /> <ellipse cx="150" cy="200" rx="150" ry="200" style="fill:url(#gradient);opacity:0.5;stroke:white;stroke-width:2;stroke-opacity:1" />';

        item[3]='<polygon points="3,170 80,150 17,110 52,50 60,100 " style="fill:rgb(0,38,249);opacity:0.5" /><polygon points="52,350 80,300 7,250 60,200 3,170" style="fill:rgb(0,38,249);opacity:0.5" /><polygon points="297,170 220,150 283,110 248,50 240,100 " style="fill:rgb(0,38,249);opacity:0.5" /><polygon points="248,350 220,300 293,250 240,200 297,170" style="fill:rgb(0,38,249);opacity:0.5" /><polygon points="52,50 100,15 150,50 100,70" style="fill:rgb(0, 5, 107);opacity:1" /><polygon points="150,50 200,15 248,50 200,70" style="fill:rgb(0, 5, 107);opacity:1" /><polygon points="52,350 100,385 150,350 100,330" style="fill:rgb(0,28,85);opacity:1" /><polygon points="150,350 200,385 248,350 200,330" style="fill:rgb(0,28,85);opacity:1" /><polygon points="80,25 90,100 150,0 210,100 220,25" style="fill:rgb(0,38,249);opacity:0.7" /><polygon points="80,375 90,300 150,400 210,300 220,375" style="fill:rgb(0,38,249);opacity:0.5" /><polygon points="150,50 60,100 60,300 150,350 240,300 240,100" style="fill:rgb(0,38,249);opacity:1;stroke:white;stroke-width:2;stroke-opacity:0.5" />';

        item[4]='<polygon points="90,50 60,100 240,100 210,50 150,50" style="fill:url(#gradient1);opacity:0.9;stroke:white;stroke-width:2;stroke-opacity:0.3" /><polygon points="90,350 60,300 240,300 210,350 150,350" style="fill:url(#gradient1);opacity:0.8;stroke:white;stroke-width:2;stroke-opacity:0.3" /><polygon points="60,100 30,150 60,200 30,250 60,300" style="fill:rgb(143,217,248);opacity:0.7;stroke:white;stroke-width:2;stroke-opacity:0.5" /><polygon points="240,100 270,150 240,200 270,250 240,300" style="fill:rgb(143,217,248);opacity:0.5;stroke:white;stroke-width:2;stroke-opacity:0.5" /><polygon points="100,50 80,140 25,200 80,260 100,350 275,200" style="fill:rgb(10,36,114);opacity:0.5" /><polygon points="180,100 150,50 120,100 60,100 80,150 60,200 80,250 60,300 120,300 150,350 180,300 240,300 220,250 240,200 220,150 240,100" style="fill:url(#gradient1);opacity:0.6" /><polygon points="90,50 60,100 20,100 90,50 100,13 150,50" style="fill:rgb(143,217,248);opacity:0.7" /><polygon points="50,115 60,165 7,140 0,200" style="fill:rgb(179, 213, 255);opacity:0.5" /><polygon points="0,200 30,250 20,300" style="fill:rgb(179, 213, 255);opacity:0.5" /><polygon points="90,350 60,300 20,300 90,350 100,387 150,350" style="fill:url(#gradient2);opacity:0.8" /><polygon points="210,50 240,100 280,100 210,50 200,13 150,50" style="fill:url(#gradient1);opacity:0.7" /><polygon points="250,115 240,165 293,140 300,200" style="fill:rgb(179, 213, 255);opacity:0.5" /><polygon points="300,200 270,250 280,300" style="fill:rgb(179, 213, 255);opacity:0.5" /><polygon points="210,350 240,300 280,300 210,350 200,387 150,350" style="fill:url(#gradient1);opacity:0.7" /><polygon points="150,0 100,15 150,50" style="fill:rgb(143,217,248);opacity:0.7" /><polygon points="180,100 120,100 80,150 80,250 120,300 180,300 220,250 220,150" style="fill:url(#gradient);opacity:1" /><polygon points="150,50 60,100 60,300 150,350 240,300 240,100" style="fill:url(#gradient1);opacity:0" /><ellipse cx="150" cy="200" rx="150" ry="200" style="fill:rgb(0,38,249);opacity:0.2" /><polygon points="150,50 60,100 150,150 240,100" style="fill:rgb(143,217,248);opacity:0.5;stroke:white;stroke-width:2;stroke-opacity:0.5" /><polygon points="150,150 60,200 150,250" style="fill:rgb(143,217,248);opacity:0.5;stroke:white;stroke-width:2;stroke-opacity:0.5" /><polygon points="150,150 150,250 240,200" style="fill:rgb(143,217,248);opacity:0.5;stroke:white;stroke-width:2;stroke-opacity:0.5" /><polygon points="60,300 150,350 240,300 240,200 150,250 60,200" style="fill:rgb(143,217,248);opacity:0.5;stroke:white;stroke-width:2;stroke-opacity:0.5" /><polygon points="60,100 150,150 60,200" style="fill:rgb(143,217,248);opacity:0.5;stroke:white;stroke-width:2;stroke-opacity:0.5" /><polygon points="240,100 150,150 240,200" style="fill:rgb(143,217,248);opacity:0.5;stroke:white;stroke-width:2;stroke-opacity:0.5" />';

        item[5] = string(
                    abi.encodePacked(
                        '<text x="150" y="95" style="fill:black;opacity:0.8;font-size:25px;font-weight:bold" text-anchor="middle">GemFi<tspan x="150" y="270" text-anchor="middle">Level: </tspan><tspan text-anchor="middle">',
                        toString(gem[_gemId].level),
                        '</tspan>'
                    )
        );

        item[6] = string(
                    abi.encodePacked(
                        '<tspan x="150" y="295" text-anchor="middle">Balance: </tspan><tspan text-anchor="middle">',
                        toString(gem[_gemId].balance/1000000000000000000), 
                        '</tspan>'
                    )
        );

        item[7]='</text></svg>';

        output = string(abi.encodePacked(item[0],item[1],item[2],item[3],item[4],item[5],item[6],item[7]));

        string memory json = Base64.encode(
            bytes(
                string(
                    abi.encodePacked(
                        '{"name": "GemFi #',toString(_gemId),
                        '", "description": "GemFI is a cutting-edge SVG NFT-based, user-driven GameFi project with the unique thrill of potentially winning the big Gem Pot.", "image": "data:image/svg+xml;base64,',
                        Base64.encode(bytes(output)),
                        '"}'
                    )
                )
            )
        );
        output = string(abi.encodePacked("data:application/json;base64,", json));
        return output;
    }

    function getTotalHighLevelGems() public view returns (uint256 totalHighLevelGems)
    {
      return highestLevelGems.length;

    }
  
    function gemStatus(uint256 _gemId) public view returns (uint256 level, uint256 balance)
    {
        require(_exists(_gemId),"ERC721Metadata: URI query for nonexistent token");
        return (gem[_gemId].level, gem[_gemId].balance);
    }

    //** Write Functions **

    function mint(uint8 _mintAmount) public payable {
        require(_mintAmount > 0, "Need more than 0");
        require(msg.value >= 1 ether * _mintAmount, "Not enough FTM");
        for (uint256 i = 1; i <= _mintAmount; i++) {
            supply.increment();
            _safeMint(msg.sender, supply.current());
            gem[supply.current()].level=1;
            gem[supply.current()].balance=1 ether;
            activeSupply+=1;
        }   
    }

    function upgradeGems(uint256 _gemOne,uint256 _gemTwo, uint256 _gemThree) public{
        require(msg.sender == ownerOf(_gemOne) && msg.sender == ownerOf(_gemTwo) && msg.sender == ownerOf(_gemThree),"Not owner of Gems");
        require(gem[_gemOne].level==gem[_gemTwo].level, "Need same level gems");
        require(gem[_gemOne].level==gem[_gemThree].level, "Need same level gems");
        supply.increment();
        uint256 _newTokenId= supply.current();
        //Find mint chance based on the Gem level 
        if(gem[_gemOne].level<=10){
            mintChance=100-10*(gem[_gemOne].level-1);
        }else{
            mintChance=1;
        }
        resolveEpochIfNeeded();
        uint256 _randomNumber=getRandomNumber();
        _randomNumber=(_randomNumber & 0x64);
        if(_randomNumber<= mintChance){
            //if upgrade is successfull
            //Burn all three gems and mint a new Gem with +1 level and combined balance of three gems
            gem[_newTokenId].level=gem[_gemOne].level+1;
            gem[_newTokenId].balance=gem[_gemOne].balance *3;
            if(gem[_newTokenId].level>highestGemLevel) {
                highestGemLevel=gem[_newTokenId].level;
                //Start a new winner list
                delete highestLevelGems;
                highestLevelGems.push(_newTokenId);
                gemIsHighestLevel[highestGemLevel][_newTokenId]=true;
                highestLevelGemsIndex[_newTokenId]=0;
            }else if(gem[_newTokenId].level==highestGemLevel){
                highestLevelGems.push(_newTokenId);
                gemIsHighestLevel[highestGemLevel][_newTokenId]=true;
                highestLevelGemsIndex[_newTokenId]=highestLevelGems.length-1;
            }
          emit GemUpgraded(true, _newTokenId);
        }else{
            //If upgrade is unsuccessfull
            //Burn three gems, create a new Gem with same balance and level
            //Send back one Gem's balance to user, and one Gem's balance to GemPot (Winner takes all)
            gem[_newTokenId].level=gem[_gemOne].level;
            gem[_newTokenId].balance=gem[_gemOne].balance;
            if(gemIsHighestLevel[highestGemLevel][_gemOne]==true){
                highestLevelGems.push(_newTokenId);
                gemIsHighestLevel[highestGemLevel][_newTokenId]=true;
                highestLevelGemsIndex[_newTokenId]=highestLevelGems.length-1;
            }
            gemPot+=gem[_newTokenId].balance;
            require(payable(msg.sender).send(gem[_newTokenId].balance));
            emit GemUpgraded(false, _newTokenId);
        }
        _safeMint(msg.sender, _newTokenId);
        activeSupply+=1;
        burnGem(_gemOne);
        burnGem(_gemTwo);
        burnGem(_gemThree);
    }

    function withdrawBalance(uint256 _gemId) public {
        require(msg.sender == ownerOf(_gemId) ,"Not owner of Gem");
        require(gem[_gemId].balance>0, "No balance");
        require(payable(msg.sender).send(gem[_gemId].balance));
        burnGem(_gemId);
    }

    function pickWinner(uint256 _gemId) public{
        require(gemPot>0, "Game pot empty");
        require(block.timestamp>(lastDraw+(winnerPickDuration*3600)) && highestLevelGems.length>0,"Not ready yet");
        require (msg.sender == ownerOf(_gemId) && gemIsHighestLevel[highestGemLevel][_gemId]==true, "Not in highest gems list");
        resolveEpochIfNeeded();
        uint256 _randomNumber=getRandomNumber();
        lastDraw=block.timestamp;    
        uint256 winnerIndex=_randomNumber%highestLevelGems.length;
        lastWinner=highestLevelGems[winnerIndex];
        require(payable(ownerOf(lastWinner)).send((gemPot*90)/100));
        collectedFee+=(gemPot*10)/100;
        gemPot=0;
        emit WinnerPicked(lastWinner);
    }

    //** Only owner **

    function withdrawCollectedFee() public onlyOwner {          
        (bool success, ) = payable(msg.sender).call{
            value: collectedFee
        }("");
        require(success);
        collectedFee=0;
    }

    function changeWinnerPickDuration(uint256 _durationInHours) public onlyOwner {
        winnerPickDuration=_durationInHours;
    }

    //** Supporting fucntions *

    function burnGem(uint256 _gemId) private {
        gem[_gemId].level=0;
        gem[_gemId].balance=0 ether;
        safeTransferFrom(msg.sender, address(0x000000000000000000000000000000000000dEaD), _gemId);
        if(gemIsHighestLevel[highestGemLevel][_gemId]==true){
          uint256 indexRemovedGem=highestLevelGemsIndex[_gemId];
          uint256 lastIndex=highestLevelGems.length-1;
          highestLevelGems[indexRemovedGem]= highestLevelGems[lastIndex];
          highestLevelGemsIndex[highestLevelGems[lastIndex]]=indexRemovedGem;
          highestLevelGems.pop();
          delete highestLevelGemsIndex[_gemId];
        }
        activeSupply-=1;
    }

    function getRandomNumber() private view returns(uint256 _randomNumber){
        _randomNumber = uint256(
            keccak256(
                abi.encodePacked(
                    epochs[randomIndexEpoch].randomness,
                    IRandomNumberGenerator(RANDOM).getRandomNumber()
                )
            )
        );
    }

    //Thanks to @_MouseDev
    function resolveEpochIfNeeded() private{
        Epoch storage currentEpoch=epochs[epochIndex];
        if(
            //If epoch has been commited
            currentEpoch.commited==false || 
            //If epoch has not been revealed, but the block is too far away (256 blocks)
            (currentEpoch.revealed== false && currentEpoch.revealBlock<block.number -256)
        ){
            //This means the epoch has not been commited, OR the epoch has commited but has expired 
            //Set commited to true  and record the reveal block
            currentEpoch.revealBlock=uint64(block.number+5);
            currentEpoch.commited=true;
        }else if(block.number>currentEpoch.revealBlock){
            //Epoch has been commited and is within range to be revealed
            //Set its randomness to the target block 
            currentEpoch.randomness=uint128(uint256(blockhash(currentEpoch.revealBlock))%(2**128-1));
            currentEpoch.revealed=true;
            randomIndexEpoch=epochIndex;
            epochIndex++;
            return resolveEpochIfNeeded();
        }
    }

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

File 2 of 13 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. 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;`
 */
library Counters {
    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 {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 3 of 13 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

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

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

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

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or 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: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

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

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

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

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

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

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

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

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

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

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

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

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

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

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

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
     * that `ownerOf(tokenId)` is `a`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += amount;
    }
}

File 4 of 13 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

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

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

File 5 of 13 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * 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;

    /**
     * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

File 6 of 13 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 7 of 13 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 8 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 9 of 13 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 10 of 13 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 11 of 13 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 12 of 13 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 13 of 13 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"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":"bool","name":"trueOrFalse","type":"bool"},{"indexed":false,"internalType":"uint256","name":"gemId","type":"uint256"}],"name":"GemUpgraded","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":"uint256","name":"gemId","type":"uint256"}],"name":"WinnerPicked","type":"event"},{"inputs":[],"name":"RANDOM","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activeSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_durationInHours","type":"uint256"}],"name":"changeWinnerPickDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectedFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gemPot","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gemId","type":"uint256"}],"name":"gemStatus","outputs":[{"internalType":"uint256","name":"level","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalHighLevelGems","outputs":[{"internalType":"uint256","name":"totalHighLevelGems","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"highestGemLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"highestLevelGems","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"lastDraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastWinner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_mintAmount","type":"uint8"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gemId","type":"uint256"}],"name":"pickWinner","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":"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":"_gemId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"uint256","name":"_gemOne","type":"uint256"},{"internalType":"uint256","name":"_gemTwo","type":"uint256"},{"internalType":"uint256","name":"_gemThree","type":"uint256"}],"name":"upgradeGems","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"winnerPickDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gemId","type":"uint256"}],"name":"withdrawBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawCollectedFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052600880546001600160a01b0319167354f3f10f95363c8cba51c7f6f6b70faff9e79eb417905542600d556018600f5560016015553480156200004557600080fd5b506040518060400160405280600581526020016447656d466960d81b8152506040518060400160405280600381526020016223a6a360e91b8152508160009081620000919190620002a4565b506001620000a08282620002a4565b5050600780546001600160a01b0319163317905550620000bf620000c5565b620003f7565b60155460009081526016602052604090208054600160c01b900460ff1615806200012157508054600160c81b900460ff161580156200012157506200010d6101004362000386565b8154600160801b90046001600160401b0316105b156200016d5762000134436005620003a2565b815460ff60c01b196001600160401b0392909216600160801b0291909116600160801b600160c81b031990911617600160c01b17815550565b8054600160801b90046001600160401b0316431115620001fc578054620001ae906001600160801b0390600160801b90046001600160401b031640620003b8565b81546001600160801b0360ff60c81b0119166001600160801b039190911617600160c81b178155601580546017819055906000620001ec83620003db565b90915550620001fc9050620000c5565b50565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200022a57607f821691505b6020821081036200024b57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200029f57600081815260208120601f850160051c810160208610156200027a5750805b601f850160051c820191505b818110156200029b5782815560010162000286565b5050505b505050565b81516001600160401b03811115620002c057620002c0620001ff565b620002d881620002d1845462000215565b8462000251565b602080601f831160018114620003105760008415620002f75750858301515b600019600386901b1c1916600185901b1785556200029b565b600085815260208120601f198616915b82811015620003415788860151825594840194600190910190840162000320565b5085821015620003605787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b818103818111156200039c576200039c62000370565b92915050565b808201808211156200039c576200039c62000370565b600082620003d657634e487b7160e01b600052601260045260246000fd5b500690565b600060018201620003f057620003f062000370565b5060010190565b6144ea80620004076000396000f3fe6080604052600436106101d85760003560e01c806395d89b4111610102578063d4d68e1211610095578063eaaf8dda11610064578063eaaf8dda1461055b578063f737d21d14610570578063f964d10914610590578063fe188184146105b057600080fd5b8063d4d68e12146104c7578063da76d5cd146104dc578063e811f50a146104fc578063e985e9c51461051257600080fd5b8063b88d4fde116100d1578063b88d4fde1461045b578063babd70121461047b578063c87b56dd14610491578063ce32828a146104b157600080fd5b806395d89b41146103f05780639790e67b1461040557806397af3fd814610425578063a22cb4651461043b57600080fd5b806342842e0e1161017a5780636442390811610149578063644239081461037d5780636ecd23061461039d57806370a08231146103b05780638da5cb5b146103d057600080fd5b806342842e0e1461030357806354d0955b146103235780635dd577ec146103475780636352211e1461035d57600080fd5b8063095ea7b3116101b6578063095ea7b31461026c57806323b872dd1461028e5780632ff834b0146102ae5780633665d477146102e357600080fd5b806301ffc9a7146101dd57806306fdde0314610212578063081812fc14610234575b600080fd5b3480156101e957600080fd5b506101fd6101f8366004612846565b6105c6565b60405190151581526020015b60405180910390f35b34801561021e57600080fd5b50610227610663565b60405161020991906128ba565b34801561024057600080fd5b5061025461024f3660046128cd565b6106f5565b6040516001600160a01b039091168152602001610209565b34801561027857600080fd5b5061028c610287366004612902565b61071c565b005b34801561029a57600080fd5b5061028c6102a936600461292c565b610870565b3480156102ba57600080fd5b506102ce6102c93660046128cd565b6108e7565b60408051928352602083019190915201610209565b3480156102ef57600080fd5b5061028c6102fe366004612968565b61098f565b34801561030f57600080fd5b5061028c61031e36600461292c565b610ee4565b34801561032f57600080fd5b50610339600a5481565b604051908152602001610209565b34801561035357600080fd5b50610339600d5481565b34801561036957600080fd5b506102546103783660046128cd565b610eff565b34801561038957600080fd5b5061028c6103983660046128cd565b610f64565b61028c6103ab366004612994565b610fc3565b3480156103bc57600080fd5b506103396103cb3660046129b7565b61112f565b3480156103dc57600080fd5b50600754610254906001600160a01b031681565b3480156103fc57600080fd5b506102276111c9565b34801561041157600080fd5b506103396104203660046128cd565b6111d8565b34801561043157600080fd5b50610339600b5481565b34801561044757600080fd5b5061028c6104563660046129d2565b6111f9565b34801561046757600080fd5b5061028c610476366004612a24565b611204565b34801561048757600080fd5b5061033960095481565b34801561049d57600080fd5b506102276104ac3660046128cd565b611282565b3480156104bd57600080fd5b50610339600f5481565b3480156104d357600080fd5b5061028c611534565b3480156104e857600080fd5b5061028c6104f73660046128cd565b6115ec565b34801561050857600080fd5b50610339600c5481565b34801561051e57600080fd5b506101fd61052d366004612b00565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561056757600080fd5b50601054610339565b34801561057c57600080fd5b5061028c61058b3660046128cd565b6116f4565b34801561059c57600080fd5b50600854610254906001600160a01b031681565b3480156105bc57600080fd5b50610339600e5481565b60006001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000148061062957506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061065d57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b60606000805461067290612b33565b80601f016020809104026020016040519081016040528092919081815260200182805461069e90612b33565b80156106eb5780601f106106c0576101008083540402835291602001916106eb565b820191906000526020600020905b8154815290600101906020018083116106ce57829003601f168201915b5050505050905090565b600061070082611965565b506000908152600460205260409020546001600160a01b031690565b600061072782610eff565b9050806001600160a01b0316836001600160a01b0316036107b55760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b03821614806107ef57506001600160a01b038116600090815260056020908152604080832033845290915290205460ff165b6108615760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016107ac565b61086b83836119c9565b505050565b61087a3382611a44565b6108dc5760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b60648201526084016107ac565b61086b838383611ac3565b60008181526002602052604081205481906001600160a01b03166109735760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e000000000000000000000000000000000060648201526084016107ac565b5050600090815260146020526040902080546001909101549091565b61099883610eff565b6001600160a01b0316336001600160a01b03161480156109d157506109bc82610eff565b6001600160a01b0316336001600160a01b0316145b80156109f657506109e181610eff565b6001600160a01b0316336001600160a01b0316145b610a425760405162461bcd60e51b815260206004820152601160248201527f4e6f74206f776e6572206f662047656d7300000000000000000000000000000060448201526064016107ac565b6000828152601460205260408082205485835291205414610aa55760405162461bcd60e51b815260206004820152601460248201527f4e6565642073616d65206c6576656c2067656d7300000000000000000000000060448201526064016107ac565b6000818152601460205260408082205485835291205414610b085760405162461bcd60e51b815260206004820152601460248201527f4e6565642073616d65206c6576656c2067656d7300000000000000000000000060448201526064016107ac565b610b16600680546001019055565b6000610b2160065490565b600085815260146020526040902054909150600a10610b7357600084815260146020526040902054610b5590600190612b83565b610b6090600a612b96565b610b6b906064612b83565b601355610b79565b60016013555b610b81611cc9565b6000610b8b611e49565b601354606490911691508111610d4a57600085815260146020526040902054610bb5906001612bad565b600083815260146020526040808220929092558681522060010154610bdb906003612b96565b60008381526014602052604090206001810191909155600a5490541115610c8057600082815260146020526040812054600a55610c1a906010906127d1565b6010805460018181019092557f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae67201839055600a5460009081526012602090815260408083208684528252808320805460ff19169094179093556011905290812055610d0b565b600a5460008381526014602052604090205403610d0b5760108054600181810183557f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae672909101849055600a5460009081526012602090815260408083208784529091529020805460ff1916821790559054610cfb9190612b83565b6000838152601160205260409020555b6040805160018152602081018490527f2c519dfbe5e2b46e4030ddcdb72321eea52faa5eefeef1283c01e6329568144f910160405180910390a1610e9f565b6000858152601460209081526040808320805486855282852090815560019182015490820155600a548452601283528184208985529092529091205460ff1615159003610e055760108054600181810183557f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae672909101849055600a5460009081526012602090815260408083208784529091529020805460ff1916821790559054610df59190612b83565b6000838152601160205260409020555b600082815260146020526040812060010154600b805491929091610e2a908490612bad565b9091555050600082815260146020526040808220600101549051339282156108fc02929190818181858888f19350505050610e6457600080fd5b6040805160008152602081018490527f2c519dfbe5e2b46e4030ddcdb72321eea52faa5eefeef1283c01e6329568144f910160405180910390a15b610ea93383611f49565b600160096000828254610ebc9190612bad565b90915550610ecb905085611f63565b610ed484611f63565b610edd83611f63565b5050505050565b61086b83838360405180602001604052806000815250611204565b6000818152600260205260408120546001600160a01b03168061065d5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016107ac565b6007546001600160a01b03163314610fbe5760405162461bcd60e51b815260206004820152601460248201527f4e6f74206120636f6e7472616374206f776e657200000000000000000000000060448201526064016107ac565b600f55565b60008160ff16116110165760405162461bcd60e51b815260206004820152601060248201527f4e656564206d6f7265207468616e20300000000000000000000000000000000060448201526064016107ac565b61102b60ff8216670de0b6b3a7640000612bc0565b67ffffffffffffffff163410156110845760405162461bcd60e51b815260206004820152600e60248201527f4e6f7420656e6f7567682046544d00000000000000000000000000000000000060448201526064016107ac565b60015b8160ff16811161112b5761109f600680546001019055565b6110b1336110ac60065490565b611f49565b6001601460006110c060065490565b815260200190815260200160002060000181905550670de0b6b3a7640000601460006110eb60065490565b8152602001908152602001600020600101819055506001600960008282546111139190612bad565b9091555081905061112381612bec565b915050611087565b5050565b60006001600160a01b0382166111ad5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e6572000000000000000000000000000000000000000000000060648201526084016107ac565b506001600160a01b031660009081526003602052604090205490565b60606001805461067290612b33565b601081815481106111e857600080fd5b600091825260209091200154905081565b61112b33838361209b565b61120e3383611a44565b6112705760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b60648201526084016107ac565b61127c84848484612169565b50505050565b6000818152600260205260409020546060906001600160a01b031661130f5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e000000000000000000000000000000000060648201526084016107ac565b60606113196127ef565b6040518060a00160405280606c8152602001613d5c606c913981526040805161030081019091526102c18082526141f46020830139816001602002018190525060405180610100016040528060da815260200161311360da91396040808301919091528051610460810190915261042c808252613dc86020830139606082015260408051610b608101909152610b2f8082526131ed602083013960808201526000848152601460205260409020546113d0906121e7565b6040516020016113e09190612c1b565b60408051808303601f1901815291815260a08301919091526000858152601460205220600101546114239061141e90670de0b6b3a764000090612d6c565b6121e7565b6040516020016114339190612d80565b60408051601f1981840301815291815260c0830191825280518082018252600d81527f3c2f746578743e3c2f7376673e0000000000000000000000000000000000000060208083019190915260e08501829052845181860151868501516060880151608089015160a08a0151985197516114bb99959894979396929591949193919201612e23565b604051602081830303815290604052915060006115086114da866121e7565b6114e38561231c565b6040516020016114f4929190612ec8565b60405160208183030381529060405261231c565b90508060405160200161151b9190613031565b60408051601f1981840301815291905295945050505050565b6007546001600160a01b0316331461158e5760405162461bcd60e51b815260206004820152601460248201527f4e6f74206120636f6e7472616374206f776e657200000000000000000000000060448201526064016107ac565b600c5460405160009133918381818185875af1925050503d80600081146115d1576040519150601f19603f3d011682016040523d82523d6000602084013e6115d6565b606091505b50509050806115e457600080fd5b506000600c55565b6115f581610eff565b6001600160a01b0316336001600160a01b0316146116555760405162461bcd60e51b815260206004820152601060248201527f4e6f74206f776e6572206f662047656d0000000000000000000000000000000060448201526064016107ac565b6000818152601460205260409020600101546116b35760405162461bcd60e51b815260206004820152600a60248201527f4e6f2062616c616e63650000000000000000000000000000000000000000000060448201526064016107ac565b600081815260146020526040808220600101549051339282156108fc02929190818181858888f193505050506116e857600080fd5b6116f181611f63565b50565b6000600b54116117465760405162461bcd60e51b815260206004820152600e60248201527f47616d6520706f7420656d70747900000000000000000000000000000000000060448201526064016107ac565b600f5461175590610e10612b96565b600d546117629190612bad565b42118015611771575060105415155b6117bd5760405162461bcd60e51b815260206004820152600d60248201527f4e6f74207265616479207965740000000000000000000000000000000000000060448201526064016107ac565b6117c681610eff565b6001600160a01b0316336001600160a01b03161480156118075750600a54600090815260126020908152604080832084845290915290205460ff1615156001145b6118535760405162461bcd60e51b815260206004820152601860248201527f4e6f7420696e20686967686573742067656d73206c697374000000000000000060448201526064016107ac565b61185b611cc9565b6000611865611e49565b42600d5560105490915060009061187c9083613076565b90506010818154811061189157611891612c05565b9060005260206000200154600e819055506118ad600e54610eff565b6001600160a01b03166108fc6064600b54605a6118ca9190612b96565b6118d49190612d6c565b6040518115909202916000818181858888f193505050506118f457600080fd5b6064600b54600a6119059190612b96565b61190f9190612d6c565b600c60008282546119209190612bad565b90915550506000600b55600e546040519081527f4e7968c0c9cd985b9fb1f569d0b129152da0e0f48b042f15f81c48500c222bac9060200160405180910390a1505050565b6000818152600260205260409020546001600160a01b03166116f15760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016107ac565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190611a0b82610eff565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600080611a5083610eff565b9050806001600160a01b0316846001600160a01b03161480611a9757506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80611abb5750836001600160a01b0316611ab0846106f5565b6001600160a01b0316145b949350505050565b826001600160a01b0316611ad682610eff565b6001600160a01b031614611b3a5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016107ac565b6001600160a01b038216611bb55760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016107ac565b826001600160a01b0316611bc882610eff565b6001600160a01b031614611c2c5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016107ac565b6000818152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60155460009081526016602052604090208054600160c01b900460ff161580611d2257508054600160c81b900460ff16158015611d225750611d0d61010043612b83565b8154600160801b900467ffffffffffffffff16105b15611d9c57611d32436005612bad565b81547fffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffff67ffffffffffffffff92909216600160801b02919091167fffffffffffffff000000000000000000ffffffffffffffffffffffffffffffff90911617600160c01b17815550565b8054600160801b900467ffffffffffffffff164311156116f1578054611de5906fffffffffffffffffffffffffffffffff90600160801b900467ffffffffffffffff1640613076565b81547fffffffffffff00ffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff9190911617600160c81b178155601580546017819055906000611e3c83612bec565b91905055506116f1611cc9565b60175460009081526016602090815260408083205460085482517fdbdff2c100000000000000000000000000000000000000000000000000000000815292516fffffffffffffffffffffffffffffffff909216936001600160a01b039091169263dbdff2c192600480830193928290030181865afa158015611ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef3919061308a565b60405160809290921b7fffffffffffffffffffffffffffffffff0000000000000000000000000000000016602083015260308201526050016040516020818303038152906040528051906020012060001c905090565b61112b82826040518060200160405280600081525061246f565b600081815260146020526040812081815560010155611f853361dead83610ee4565b600a54600090815260126020908152604080832084845290915290205460ff16151560010361208057600081815260116020526040812054601054909190611fcf90600190612b83565b905060108181548110611fe457611fe4612c05565b90600052602060002001546010838154811061200257612002612c05565b906000526020600020018190555081601160006010848154811061202857612028612c05565b90600052602060002001548152602001908152602001600020819055506010805480612056576120566130a3565b60008281526020808220830160001990810183905590920190925584825260119052604081205550505b6001600960008282546120939190612b83565b909155505050565b816001600160a01b0316836001600160a01b0316036120fc5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107ac565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612174848484611ac3565b612180848484846124ed565b61127c5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60648201526084016107ac565b60608160000361222a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612254578061223e81612bec565b915061224d9050600a83612d6c565b915061222e565b60008167ffffffffffffffff81111561226f5761226f612a0e565b6040519080825280601f01601f191660200182016040528015612299576020820181803683370190505b5090505b8415611abb576122ae600183612b83565b91506122bb600a86613076565b6122c6906030612bad565b60f81b8183815181106122db576122db612c05565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612315600a86612d6c565b945061229d565b6060815160000361233b57505060408051602081019091526000815290565b6000604051806060016040528060408152602001613d1c604091399050600060038451600261236a9190612bad565b6123749190612d6c565b61237f906004612b96565b67ffffffffffffffff81111561239757612397612a0e565b6040519080825280601f01601f1916602001820160405280156123c1576020820181803683370190505b509050600182016020820185865187015b8082101561242d576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f81168501518453506001830192506123d2565b5050600386510660018114612449576002811461245c57612464565b603d6001830353603d6002830353612464565b603d60018303535b509195945050505050565b6124798383612639565b61248660008484846124ed565b61086b5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60648201526084016107ac565b60006001600160a01b0384163b1561262e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906125319033908990889088906004016130b9565b6020604051808303816000875af192505050801561256c575060408051601f3d908101601f19168201909252612569918101906130f5565b60015b612614573d80801561259a576040519150601f19603f3d011682016040523d82523d6000602084013e61259f565b606091505b50805160000361260c5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60648201526084016107ac565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611abb565b506001949350505050565b6001600160a01b03821661268f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107ac565b6000818152600260205260409020546001600160a01b0316156126f45760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107ac565b6000818152600260205260409020546001600160a01b0316156127595760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107ac565b6001600160a01b0382166000818152600360209081526040808320805460010190558483526002909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b50805460008255906000526020600020908101906116f19190612817565b6040518061010001604052806008905b60608152602001906001900390816127ff5790505090565b5b8082111561282c5760008155600101612818565b5090565b6001600160e01b0319811681146116f157600080fd5b60006020828403121561285857600080fd5b813561286381612830565b9392505050565b60005b8381101561288557818101518382015260200161286d565b50506000910152565b600081518084526128a681602086016020860161286a565b601f01601f19169290920160200192915050565b602081526000612863602083018461288e565b6000602082840312156128df57600080fd5b5035919050565b80356001600160a01b03811681146128fd57600080fd5b919050565b6000806040838503121561291557600080fd5b61291e836128e6565b946020939093013593505050565b60008060006060848603121561294157600080fd5b61294a846128e6565b9250612958602085016128e6565b9150604084013590509250925092565b60008060006060848603121561297d57600080fd5b505081359360208301359350604090920135919050565b6000602082840312156129a657600080fd5b813560ff8116811461286357600080fd5b6000602082840312156129c957600080fd5b612863826128e6565b600080604083850312156129e557600080fd5b6129ee836128e6565b915060208301358015158114612a0357600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215612a3a57600080fd5b612a43856128e6565b9350612a51602086016128e6565b925060408501359150606085013567ffffffffffffffff80821115612a7557600080fd5b818701915087601f830112612a8957600080fd5b813581811115612a9b57612a9b612a0e565b604051601f8201601f19908116603f01168101908382118183101715612ac357612ac3612a0e565b816040528281528a6020848701011115612adc57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215612b1357600080fd5b612b1c836128e6565b9150612b2a602084016128e6565b90509250929050565b600181811c90821680612b4757607f821691505b602082108103612b6757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561065d5761065d612b6d565b808202811582820484141761065d5761065d612b6d565b8082018082111561065d5761065d612b6d565b67ffffffffffffffff818116838216028082169190828114612be457612be4612b6d565b505092915050565b600060018201612bfe57612bfe612b6d565b5060010190565b634e487b7160e01b600052603260045260246000fd5b7f3c7465787420783d223135302220793d22393522207374796c653d2266696c6c81527f3a626c61636b3b6f7061636974793a302e383b666f6e742d73697a653a32357060208201527f783b666f6e742d7765696768743a626f6c642220746578742d616e63686f723d60408201527f226d6964646c65223e47656d46693c747370616e20783d223135302220793d2260608201527f3237302220746578742d616e63686f723d226d6964646c65223e4c6576656c3a60808201527f203c2f747370616e3e3c747370616e20746578742d616e63686f723d226d696460a08201527f646c65223e00000000000000000000000000000000000000000000000000000060c082015260008251612d378160c585016020870161286a565b671e17ba39b830b71f60c11b60c593909101928301525060cd01919050565b634e487b7160e01b600052601260045260246000fd5b600082612d7b57612d7b612d56565b500490565b7f3c747370616e20783d223135302220793d223239352220746578742d616e636881527f6f723d226d6964646c65223e42616c616e63653a203c2f747370616e3e3c747360208201527f70616e20746578742d616e63686f723d226d6964646c65223e00000000000000604082015260008251612e0481605985016020870161286a565b671e17ba39b830b71f60c11b6059939091019283015250606101919050565b600089516020612e368285838f0161286a565b8a5191840191612e498184848f0161286a565b8a51920191612e5b8184848e0161286a565b8951920191612e6d8184848d0161286a565b8851920191612e7f8184848c0161286a565b8751920191612e918184848b0161286a565b8651920191612ea38184848a0161286a565b8551920191612eb5818484890161286a565b919091019b9a5050505050505050505050565b7f7b226e616d65223a202247656d46692023000000000000000000000000000000815260008351612f0081601185016020880161286a565b7f222c20226465736372697074696f6e223a202247656d464920697320612063756011918401918201527f7474696e672d6564676520535647204e46542d62617365642c20757365722d6460318201527f726976656e2047616d6546692070726f6a65637420776974682074686520756e60518201527f6971756520746872696c6c206f6620706f74656e7469616c6c792077696e6e6960718201527f6e6720746865206269672047656d20506f742e222c2022696d616765223a202260918201527f646174613a696d6167652f7376672b786d6c3b6261736536342c00000000000060b18201528351612ffb8160cb84016020880161286a565b7f227d00000000000000000000000000000000000000000000000000000000000060cb929091019182015260cd01949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161306981601d85016020870161286a565b91909101601d0192915050565b60008261308557613085612d56565b500690565b60006020828403121561309c57600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b60006001600160a01b038087168352808616602084015250836040830152608060608301526130eb608083018461288e565b9695505050505050565b60006020828403121561310757600080fd5b81516128638161283056fe3c656c6c697073652063783d22313530222063793d22323030222072783d22313530222072793d2232303022207374796c653d2266696c6c3a72676228302c20352c20313037293b6f7061636974793a3122202f3e203c656c6c697073652063783d22313530222063793d22323030222072783d22313530222072793d2232303022207374796c653d2266696c6c3a75726c28236772616469656e74293b6f7061636974793a302e353b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a3122202f3e3c706f6c79676f6e20706f696e74733d2239302c35302036302c313030203234302c313030203231302c3530203135302c353022207374796c653d2266696c6c3a75726c28236772616469656e7431293b6f7061636974793a302e393b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3322202f3e3c706f6c79676f6e20706f696e74733d2239302c3335302036302c333030203234302c333030203231302c333530203135302c33353022207374796c653d2266696c6c3a75726c28236772616469656e7431293b6f7061636974793a302e383b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3322202f3e3c706f6c79676f6e20706f696e74733d2236302c3130302033302c3135302036302c3230302033302c3235302036302c33303022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e373b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223234302c313030203237302c313530203234302c323030203237302c323530203234302c33303022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e353b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223130302c35302038302c3134302032352c3230302038302c323630203130302c333530203237352c32303022207374796c653d2266696c6c3a7267622831302c33362c313134293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223138302c313030203135302c3530203132302c3130302036302c3130302038302c3135302036302c3230302038302c3235302036302c333030203132302c333030203135302c333530203138302c333030203234302c333030203232302c323530203234302c323030203232302c313530203234302c31303022207374796c653d2266696c6c3a75726c28236772616469656e7431293b6f7061636974793a302e3622202f3e3c706f6c79676f6e20706f696e74733d2239302c35302036302c3130302032302c3130302039302c3530203130302c3133203135302c353022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e3722202f3e3c706f6c79676f6e20706f696e74733d2235302c3131352036302c31363520372c31343020302c32303022207374796c653d2266696c6c3a726762283137392c203231332c20323535293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d22302c3230302033302c3235302032302c33303022207374796c653d2266696c6c3a726762283137392c203231332c20323535293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d2239302c3335302036302c3330302032302c3330302039302c333530203130302c333837203135302c33353022207374796c653d2266696c6c3a75726c28236772616469656e7432293b6f7061636974793a302e3822202f3e3c706f6c79676f6e20706f696e74733d223231302c3530203234302c313030203238302c313030203231302c3530203230302c3133203135302c353022207374796c653d2266696c6c3a75726c28236772616469656e7431293b6f7061636974793a302e3722202f3e3c706f6c79676f6e20706f696e74733d223235302c313135203234302c313635203239332c313430203330302c32303022207374796c653d2266696c6c3a726762283137392c203231332c20323535293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223330302c323030203237302c323530203238302c33303022207374796c653d2266696c6c3a726762283137392c203231332c20323535293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223231302c333530203234302c333030203238302c333030203231302c333530203230302c333837203135302c33353022207374796c653d2266696c6c3a75726c28236772616469656e7431293b6f7061636974793a302e3722202f3e3c706f6c79676f6e20706f696e74733d223135302c30203130302c3135203135302c353022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e3722202f3e3c706f6c79676f6e20706f696e74733d223138302c313030203132302c3130302038302c3135302038302c323530203132302c333030203138302c333030203232302c323530203232302c31353022207374796c653d2266696c6c3a75726c28236772616469656e74293b6f7061636974793a3122202f3e3c706f6c79676f6e20706f696e74733d223135302c35302036302c3130302036302c333030203135302c333530203234302c333030203234302c31303022207374796c653d2266696c6c3a75726c28236772616469656e7431293b6f7061636974793a3022202f3e3c656c6c697073652063783d22313530222063793d22323030222072783d22313530222072793d2232303022207374796c653d2266696c6c3a72676228302c33382c323439293b6f7061636974793a302e3222202f3e3c706f6c79676f6e20706f696e74733d223135302c35302036302c313030203135302c313530203234302c31303022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e353b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223135302c3135302036302c323030203135302c32353022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e353b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223135302c313530203135302c323530203234302c32303022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e353b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d2236302c333030203135302c333530203234302c333030203234302c323030203135302c3235302036302c32303022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e353b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d2236302c313030203135302c3135302036302c32303022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e353b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223234302c313030203135302c313530203234302c32303022207374796c653d2266696c6c3a726762283134332c3231372c323438293b6f7061636974793a302e353b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3522202f3e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f7376672220786d6c3a73706163653d227072657365727665222076696577426f783d223020302033303020343030222077696474683d2233303022206865696768743d22343030223e3c706f6c79676f6e20706f696e74733d22332c3137302038302c3135302031372c3131302035322c35302036302c3130302022207374796c653d2266696c6c3a72676228302c33382c323439293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d2235322c3335302038302c33303020372c3235302036302c32303020332c31373022207374796c653d2266696c6c3a72676228302c33382c323439293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223239372c313730203232302c313530203238332c313130203234382c3530203234302c3130302022207374796c653d2266696c6c3a72676228302c33382c323439293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223234382c333530203232302c333030203239332c323530203234302c323030203239372c31373022207374796c653d2266696c6c3a72676228302c33382c323439293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d2235322c3530203130302c3135203135302c3530203130302c373022207374796c653d2266696c6c3a72676228302c20352c20313037293b6f7061636974793a3122202f3e3c706f6c79676f6e20706f696e74733d223135302c3530203230302c3135203234382c3530203230302c373022207374796c653d2266696c6c3a72676228302c20352c20313037293b6f7061636974793a3122202f3e3c706f6c79676f6e20706f696e74733d2235322c333530203130302c333835203135302c333530203130302c33333022207374796c653d2266696c6c3a72676228302c32382c3835293b6f7061636974793a3122202f3e3c706f6c79676f6e20706f696e74733d223135302c333530203230302c333835203234382c333530203230302c33333022207374796c653d2266696c6c3a72676228302c32382c3835293b6f7061636974793a3122202f3e3c706f6c79676f6e20706f696e74733d2238302c32352039302c313030203135302c30203231302c313030203232302c323522207374796c653d2266696c6c3a72676228302c33382c323439293b6f7061636974793a302e3722202f3e3c706f6c79676f6e20706f696e74733d2238302c3337352039302c333030203135302c343030203231302c333030203232302c33373522207374796c653d2266696c6c3a72676228302c33382c323439293b6f7061636974793a302e3522202f3e3c706f6c79676f6e20706f696e74733d223135302c35302036302c3130302036302c333030203135302c333530203234302c333030203234302c31303022207374796c653d2266696c6c3a72676228302c33382c323439293b6f7061636974793a313b7374726f6b653a77686974653b7374726f6b652d77696474683a323b7374726f6b652d6f7061636974793a302e3522202f3e3c646566733e3c6c696e6561724772616469656e74206964203d20226772616469656e7422207831203d2022302522207931203d2022302522207832203d20223130302522207932203d202238302522203e3c73746f70206f66667365743d22302522207374796c653d2273746f702d636f6c6f723a72676228302c33382c323439293b73746f702d6f7061636974793a3122202f3e3c73746f70206f66667365743d223130302522207374796c653d2273746f702d636f6c6f723a7267622831302c33362c313134293b73746f702d6f7061636974793a302e3722202f3e3c2f6c696e6561724772616469656e74203e3c6c696e6561724772616469656e742069643d226772616469656e7431222078313d223025222079313d223025222078323d2231303025222079323d22383025223e3c73746f70206f66667365743d22302522207374796c653d2273746f702d636f6c6f723a726762283134332c3231372c323438293b73746f702d6f7061636974793a3122202f3e3c73746f70206f66667365743d223130302522207374796c653d2273746f702d636f6c6f723a7267622831302c33362c313134293b73746f702d6f7061636974793a302e3922202f3e3c2f6c696e6561724772616469656e743e3c6c696e6561724772616469656e742069643d226772616469656e7432222078313d223025222079313d223025222078323d2231303025222079323d2231303025223e3c73746f70206f66667365743d22302522207374796c653d2273746f702d636f6c6f723a726762283134362c203136352c20323437293b73746f702d6f7061636974793a3122202f3e3c73746f70206f66667365743d223130302522207374796c653d2273746f702d636f6c6f723a72676228302c33382c323439293b73746f702d6f7061636974793a302e3522202f3e3c2f6c696e6561724772616469656e743e3c2f64656673203ea2646970667358221220018cb723da35d2449315d7550b81db7f6ab982d58b58bcac8172410863bdf8ed64736f6c63430008130033

Loading