Contract 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x2e0b3aca7775b5ec58e2a78c781057bfe0e4750871bb86147c3b8ba481fd5e330x6080604083398202022-03-22 22:33:18254 days 18 hrs ago0x0724668e123a4888dfa854ce452b40d28540001d IN  Create: PeekABooV20 ETH0.027405811769 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x4c7df7655825cdbddd9793e6b7cbb29a73f07265711f710063c1910d35357664123463832022-05-17 21:45:46198 days 18 hrs ago 0x6999af008fe1676f31091ab628933cbfca7bd6f8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x4c7df7655825cdbddd9793e6b7cbb29a73f07265711f710063c1910d35357664123463832022-05-17 21:45:46198 days 18 hrs ago 0x6999af008fe1676f31091ab628933cbfca7bd6f8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x4c7df7655825cdbddd9793e6b7cbb29a73f07265711f710063c1910d35357664123463832022-05-17 21:45:46198 days 18 hrs ago 0x6999af008fe1676f31091ab628933cbfca7bd6f8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xf92fd14250f5c2b128e5f462848dd10f8ec3e0e70029c190ecd2e1786c17b4ad123439912022-05-17 20:42:38198 days 19 hrs ago 0x09986b4e255b3c548041a30a2ee312fe176731c2 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xf92fd14250f5c2b128e5f462848dd10f8ec3e0e70029c190ecd2e1786c17b4ad123439912022-05-17 20:42:38198 days 19 hrs ago 0x09986b4e255b3c548041a30a2ee312fe176731c2 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xec10b3cad41fdc776b18921b09f396d191357392990ba1a59d9ac14a180bd26e123439392022-05-17 20:41:19198 days 19 hrs ago 0x551eda969be222a758a6afcf072a6a2a4fbe9efc 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x06f9f69d883c38ca783254248afe0d6e1c5f01877b8c8079e756a3b76583bec6123439362022-05-17 20:41:19198 days 19 hrs ago 0x83bb739b5da73545a59c941b2a5358b437540b00 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x06f9f69d883c38ca783254248afe0d6e1c5f01877b8c8079e756a3b76583bec6123439362022-05-17 20:41:19198 days 19 hrs ago 0x83bb739b5da73545a59c941b2a5358b437540b00 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x5f0f76afd8444b081413f7dca6c08b8b564eb58113ba62cfedda90fcd92e4edd123428922022-05-17 20:18:45198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x5f0f76afd8444b081413f7dca6c08b8b564eb58113ba62cfedda90fcd92e4edd123428922022-05-17 20:18:45198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x5f0f76afd8444b081413f7dca6c08b8b564eb58113ba62cfedda90fcd92e4edd123428922022-05-17 20:18:45198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x5f0f76afd8444b081413f7dca6c08b8b564eb58113ba62cfedda90fcd92e4edd123428922022-05-17 20:18:45198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x5f0f76afd8444b081413f7dca6c08b8b564eb58113ba62cfedda90fcd92e4edd123428922022-05-17 20:18:45198 days 20 hrs ago 0x83bb739b5da73545a59c941b2a5358b437540b00 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0x5f0f76afd8444b081413f7dca6c08b8b564eb58113ba62cfedda90fcd92e4edd123428922022-05-17 20:18:45198 days 20 hrs ago 0x83bb739b5da73545a59c941b2a5358b437540b00 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xba0e7463fbee98b31958ad34f90fac1f3b505842bd535096ce4f56a6dd7c4620123428812022-05-17 20:17:42198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xba0e7463fbee98b31958ad34f90fac1f3b505842bd535096ce4f56a6dd7c4620123428812022-05-17 20:17:42198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xba0e7463fbee98b31958ad34f90fac1f3b505842bd535096ce4f56a6dd7c4620123428812022-05-17 20:17:42198 days 20 hrs ago 0x6999af008fe1676f31091ab628933cbfca7bd6f8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xba0e7463fbee98b31958ad34f90fac1f3b505842bd535096ce4f56a6dd7c4620123428812022-05-17 20:17:42198 days 20 hrs ago 0x6999af008fe1676f31091ab628933cbfca7bd6f8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xd27245188e5c595c5972f56dbb6d2f236e341f0b2c9673cf870d02b30c5192c5123421852022-05-17 19:59:18198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xd27245188e5c595c5972f56dbb6d2f236e341f0b2c9673cf870d02b30c5192c5123421852022-05-17 19:59:18198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xd27245188e5c595c5972f56dbb6d2f236e341f0b2c9673cf870d02b30c5192c5123421852022-05-17 19:59:18198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xd27245188e5c595c5972f56dbb6d2f236e341f0b2c9673cf870d02b30c5192c5123421852022-05-17 19:59:18198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xd27245188e5c595c5972f56dbb6d2f236e341f0b2c9673cf870d02b30c5192c5123421852022-05-17 19:59:18198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xd27245188e5c595c5972f56dbb6d2f236e341f0b2c9673cf870d02b30c5192c5123421852022-05-17 19:59:18198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
0xd27245188e5c595c5972f56dbb6d2f236e341f0b2c9673cf870d02b30c5192c5123421852022-05-17 19:59:18198 days 20 hrs ago 0x9b2a68f2ee9d0ed0182649f4a2d5a474ef8c1ec8 0xacb6e71454e1e11872d9f4ea7ee8ec6f9141b9cc0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PeekABooV2

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 27 : PeekABooV2.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol";
import "./IPeekABoo.sol";
import "./PeekABooBase.sol";
import "./IBOO.sol";
import "./IStakeManager.sol";
import "./ITraits.sol";
import "./ILevel.sol";

contract PeekABooV2 is
    IPeekABoo,
    ERC721EnumerableUpgradeable,
    OwnableUpgradeable,
    PausableUpgradeable,
    PeekABooBase
{
    using MerkleProofUpgradeable for bytes32[];

    bytes32 root;
    mapping(address => bool) claimedPhase1Mint;

    modifier onlyLevel() {
        require(_msgSender() == address(level));
        _;
    }

    modifier onlyInGame() {
        require(_msgSender() == address(ingame));
        _;
    }

    modifier onlyTokenOwner(uint256 tokenId) {
        require(
            _msgSender() == ownerOf(tokenId) ||
                _msgSender() == stakeManager.ownerOf(tokenId),
            "Not owner"
        );
        _;
    }

    event PABMinted(
        bytes32 indexed requestId,
        uint256 amount,
        uint256 indexed result
    );

    function initialize(IBOO _boo) public initializer {
        __ERC721_init("PeekABoo", "PAB");
        __Ownable_init();
        __Pausable_init();

        boo = _boo;
        MAX_PHASE1_TOKENS = 10000;
        MAX_PHASE2_TOKENS = 10000;
        MAX_NUM_PHASE1_GHOSTS = 2500;
        DEV_AND_COMM_PHASE1_GHOSTS = 525;
        PHASE1_ENDED = false;
        MAX_NUM_PHASE1_BUSTERS = 7500;
        MAX_NUM_PHASE2_GHOSTS = 2500;
        MAX_NUM_PHASE2_BUSTERS = 7500;
        root = 0xdb75746519e2448a1597dc7a4a6ce0586a3a5f171378abdc3367f4a28b8a06f8;
    }

    function pseudoRandomizeCommonTraits(uint256 tokenId, uint256 tokenType)
        internal
    {
        uint256 randomizedCommon = uint256(
            keccak256(
                abi.encodePacked(
                    _msgSender(),
                    tokenId,
                    block.timestamp,
                    tokenType * 666,
                    block.difficulty
                )
            )
        );

        if (tokenType == 0) {
            tokenTraits[tokenId].isGhost = true;
            setTokenTraits(tokenId, 0, randomizedCommon % 7);
            setTokenTraits(tokenId, 1, randomizedCommon % 9);
            setTokenTraits(tokenId, 2, randomizedCommon % 8);
            setTokenTraits(tokenId, 3, randomizedCommon % 14);
            setTokenTraits(tokenId, 4, randomizedCommon % 13);
            setTokenTraits(tokenId, 5, randomizedCommon % 7);
            setTokenTraits(tokenId, 6, randomizedCommon % 7);
        } else {
            tokenTraits[tokenId].isGhost = false;
            setTokenTraits(tokenId, 0, randomizedCommon % 7);
            setTokenTraits(tokenId, 1, randomizedCommon % 5);
            setTokenTraits(tokenId, 2, randomizedCommon % 12);
            setTokenTraits(tokenId, 3, randomizedCommon % 10);
            setTokenTraits(tokenId, 4, randomizedCommon % 4);
            setTokenTraits(tokenId, 5, randomizedCommon % 2);
            tokenTraits[tokenId].revealShape = uint64(randomizedCommon) % 3;
        }

        tokenTraits[tokenId].level = 1;
        tokenTraits[tokenId].tier = 0;
    }

    function devMint(address _to, uint256[] memory types) external onlyOwner {
        require(
            phase1Minted + types.length <= MAX_PHASE1_TOKENS,
            "All Phase 1 tokens minted"
        );

        for (uint256 i = 0; i < types.length; i++) {
            _safeMint(_to, phase1Minted);
            stakeManager.initializeEnergy(phase1Minted);
            pseudoRandomizeCommonTraits(phase1Minted, types[i]);
            phase1Minted++;
        }
    }

    function mint(uint256[] calldata types, bytes32[] memory proof) external {
        require(tx.origin == _msgSender(), "Only EOA");
        require(!PHASE1_ENDED, "Phase1 whitelist mint is over");
        require(!paused(), "Paused");
        require(!claimedPhase1Mint[_msgSender()], "Already claimed");
        require(
            proof.verify(root, keccak256(abi.encodePacked(_msgSender()))),
            "Caller is not a claimer"
        );

        uint256 amount = 1;
        claimedPhase1Mint[_msgSender()] = true;
        require(
            phase1Minted + amount <= MAX_PHASE1_TOKENS,
            "All Phase 1 tokens minted"
        );
        require(
            amount == types.length,
            "length of types does not match amount"
        );

        _phase1Mint(_msgSender(), amount, types);
    }

    function publicMint(uint256[] calldata types) external payable {
        require(tx.origin == _msgSender(), "Only EOA");
        require(PHASE1_ENDED, "whitelist mint still going");
        require(!paused(), "Paused");
        require(types.length > 0, "Invalid length");
        require(
            msg.value >= PUBLIC_PRICE * types.length,
            "whitelist mint still going"
        );
        funds += msg.value;
        uint256 minted = publicMinted[_msgSender()];
        require(
            phase1Minted + minted <= MAX_PHASE1_TOKENS - 2500,
            "All Phase 1 tokens minted"
        );
        require(minted + types.length < 3, "exceeds max per address");

        publicMinted[_msgSender()] = publicMinted[_msgSender()] + types.length;
        _phase1Mint(_msgSender(), types.length, types);
    }

    function _phase1Mint(
        address _to,
        uint256 amount,
        uint256[] calldata types
    ) internal {
        for (uint256 i = 0; i < amount; i++) {
            _safeMint(_to, phase1Minted);
            stakeManager.initializeEnergy(phase1Minted);
            if (types[i] == 0) {
                require(
                    MINT_PHASE1_GHOSTS + DEV_AND_COMM_PHASE1_GHOSTS + 1 <
                        MAX_NUM_PHASE1_GHOSTS,
                    "All ghosts in phase1 already minted."
                );
                MINT_PHASE1_GHOSTS++;
            }
            pseudoRandomizeCommonTraits(phase1Minted, types[i]);
            phase1Minted++;
        }
    }

    function mintPhase2(
        uint256 tokenId,
        uint256[] memory types,
        uint256 amount,
        uint256 booAmount
    ) external onlyTokenOwner(tokenId) {
        uint256 owed = 0;
        require(phase1Minted == 10000, "phase1 not over");
        require(
            phase2Minted + amount <= MAX_PHASE2_TOKENS,
            "All Phase 2 tokens minted"
        );
        require(
            amount == types.length,
            "length of types does not match amount"
        );
        require(
            tokenTraits[tokenId].level % 10 == 0,
            "Phase 2 cannot be minted yet by this token"
        );
        require(
            amount <= tokenTraits[tokenId].level / 10,
            "Cannot mint this many at this level"
        );
        require(
            booAmount >= phase2Price * amount,
            "Not enough $IBOO to mint this many tokens"
        );
        require(
            tokenTraits[tokenId].level / 10 > tokenTraits[tokenId].tier,
            "Cannot mint after tier up"
        );

        tokenTraits[tokenId].level = tokenTraits[tokenId].level - 5;
        uint256 phase2Id;
        for (uint256 i = 0; i < amount; i++) {
            owed += (phase2Price + (phase2PriceRate * (phase2Minted / 1000)));
            phase2Id = 10000 + phase2Minted;
            _safeMint(_msgSender(), phase2Id);
            stakeManager.initializeEnergy(phase2Id);
            pseudoRandomizeCommonTraits(phase2Id, types[i]);
            phase2Minted++;
        }
        require(booAmount >= owed, "Not enough $IBOO to mint this many tokens");
        uint256 allowance = boo.allowance(msg.sender, address(this));
        require(allowance >= booAmount, "Check the token allowance");
        boo.transferFrom(msg.sender, address(this), booAmount);
    }

    function incrementTier(uint256 tokenId) external onlyInGame {
        tokenTraits[tokenId].tier++;
        if (tokenTraits[tokenId].isGhost && tokenTraits[tokenId].tier == 1) {
            ghostMaps[tokenId].difficulty = 1;
            ghostMaps[tokenId].gridSize = 9;
        } else if (
            tokenTraits[tokenId].isGhost && tokenTraits[tokenId].tier == 3
        ) {
            ghostMaps[tokenId].difficulty = 2;
            ghostMaps[tokenId].gridSize = 10;
        }
    }

    function incrementLevel(uint256 tokenId) external onlyLevel {
        tokenTraits[tokenId].level++;
    }

    function setTokenTraits(
        uint256 tokenId,
        uint256 traitType,
        uint256 traitId
    ) public {
        require(
            _msgSender() == ownerOf(tokenId) ||
                _msgSender() == stakeManager.ownerOf(tokenId) ||
                _msgSender() == owner(),
            "Not owner"
        );
        require(
            level.isUnlocked(tokenId, traitType, traitId),
            "This trait is not unlocked."
        );

        if (tokenTraits[tokenId].isGhost) {
            // Check if trait is common or is bought
            require(
                (traitId <= traits.getRarityIndex(0, traitType, 0)) ||
                    (ingame.isBoughtTrait(tokenId, traitType, traitId) == true),
                "cannot equip this trait"
            );
            if (traitType == 0) tokenTraits[tokenId].background = traitId;
            else if (traitType == 1) tokenTraits[tokenId].back = traitId;
            else if (traitType == 2) tokenTraits[tokenId].bodyColor = traitId;
            else if (traitType == 3)
                tokenTraits[tokenId].clothesOrHelmet = traitId;
            else if (traitType == 4) tokenTraits[tokenId].hat = traitId;
            else if (traitType == 5) tokenTraits[tokenId].face = traitId;
            else if (traitType == 6) tokenTraits[tokenId].hands = traitId;
        } else {
            // Check if trait is common or is bought
            require(
                (traitId <= traits.getRarityIndex(1, traitType, 0)) ||
                    (ingame.isBoughtTrait(tokenId, traitType, traitId) == true),
                "cannot equip this trait"
            );
            if (traitType == 0) tokenTraits[tokenId].background = traitId;
            else if (traitType == 1) tokenTraits[tokenId].back = traitId;
            else if (traitType == 2) tokenTraits[tokenId].bodyColor = traitId;
            else if (traitType == 3) tokenTraits[tokenId].hat = traitId;
            else if (traitType == 4) tokenTraits[tokenId].face = traitId;
            else if (traitType == 5)
                tokenTraits[tokenId].clothesOrHelmet = traitId;
        }
    }

    function setMultipleTokenTraits(
        uint256 tokenId,
        uint256[] calldata traitTypes,
        uint256[] calldata traitIds
    ) external onlyTokenOwner(tokenId) {
        require(traitTypes.length == traitIds.length, "Incorrect lengths");
        for (uint256 i = 0; i < traitTypes.length; i++) {
            setTokenTraits(tokenId, traitTypes[i], traitIds[i]);
        }
    }

    function setAbility(uint256 tokenId, uint64 ability)
        external
        onlyTokenOwner(tokenId)
    {
        require(
            ingame.isBoughtAbility(tokenId, ability),
            "You do have not unlocked this ability"
        );
        tokenTraits[tokenId].ability = ability;
    }

    function setRevealShape(uint256 tokenId, uint64 revealShape)
        external
        onlyTokenOwner(tokenId)
    {
        require(revealShape < 3, "reveal shape does not exist");
        tokenTraits[tokenId].revealShape = revealShape;
    }

    function initializeGhostMap(uint256 tokenId, uint256 nonce)
        external
        onlyTokenOwner(tokenId)
    {
        communityNonce += nonce;
        uint256 _cn = communityNonce;
        require(
            !ghostMaps[tokenId].initialized,
            "already initialized the map."
        );
        for (uint256 j = 0; j < 10; j++) {
            for (uint256 k = 0; k < 10; k++) {
                if (
                    uint256(keccak256(abi.encodePacked(tokenId, _cn, j, k))) %
                        10 ==
                    1
                ) {
                    ghostMaps[tokenId].grid[j][k] = 1;
                }
            }
        }
        ghostMaps[tokenId].gridSize = 8;
        ghostMaps[tokenId].difficulty = 0;
        ghostMaps[tokenId].initialized = true;
    }

    /** ADMIN */

    function getPhase1Minted() external view returns (uint256 result) {
        result = phase1Minted;
    }

    function getPhase2Minted() external view returns (uint256 result) {
        result = phase2Minted;
    }

    function setBOO(address _boo) external onlyOwner {
        boo = IBOO(_boo);
    }

    function setStakeManager(address _stakeManager) external onlyOwner {
        stakeManager = IStakeManager(_stakeManager);
    }

    function setTraits(address _traits) external onlyOwner {
        traits = ITraits(_traits);
    }

    function setLevel(address _level) external onlyOwner {
        level = ILevel(_level);
    }

    function setInGame(address _ingame) external onlyOwner {
        ingame = InGame(_ingame);
    }

    function setPhase2Price(uint256 _price) external onlyOwner {
        phase2Price = _price;
    }

    function setPhase2Rate(uint256 _rate) external onlyOwner {
        phase2PriceRate = _rate;
    }

    function setMagic(address _magic) external onlyOwner {
        magic = IERC20Upgradeable(_magic);
    }

    function endPhase1() external onlyOwner {
        PHASE1_ENDED = !PHASE1_ENDED;
    }

    function setPublicPrice(uint256 _PUBLIC_PRICE) external onlyOwner {
        PUBLIC_PRICE = _PUBLIC_PRICE;
    }

    function setPause() external onlyOwner {
        if (paused()) {
            _unpause();
        } else {
            _pause();
        }
    }

    function setRoot(bytes32 newRoot) external onlyOwner {
        root = newRoot;
    }

    /** PUBLIC */

    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );
        return traits.tokenURI(tokenId);
    }

    function getTokenTraits(uint256 tokenId)
        public
        view
        returns (PeekABooTraits memory)
    {
        return tokenTraits[tokenId];
    }

    function getGhostMapGridFromTokenId(uint256 tokenId)
        external
        view
        returns (GhostMap memory)
    {
        return ghostMaps[tokenId];
    }

    function withdraw() external onlyOwner {
        payable(owner()).transfer(funds);
        funds = 0;
    }
}

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

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./IPeekABoo.sol";
import "./ITraits.sol";
import "./ILevel.sol";
import "./IBOO.sol";
import "./IStakeManager.sol";
import "./InGame.sol";

contract PeekABooBase {
    uint256 public MAX_PHASE1_TOKENS;
    uint256 public MAX_PHASE2_TOKENS;
    uint256 public MAX_NUM_PHASE1_GHOSTS;
    uint256 public MAX_NUM_PHASE1_BUSTERS;
    uint256 public MAX_NUM_PHASE2_GHOSTS;
    uint256 public MAX_NUM_PHASE2_BUSTERS;
    uint256 public phase2Price;
    uint256 public phase2PriceRate;
    // number of tokens have been minted so far
    uint256 public phase1Minted;
    uint256 public phase2Minted;
    uint256 public communityNonce;
    uint256 public traitPriceRate;
    uint256 public abilityPriceRate;

    // mapping from tokenId to a struct containing the token's traits
    mapping(uint256 => IPeekABoo.PeekABooTraits) public tokenTraits;
    mapping(uint256 => bool[6]) public boughtAbilities;
    // tokenId => boughtTraitCountByRarity [common,uncommon,...]
    mapping(uint256 => uint256[4]) public boughtTraitCount;
    mapping(uint256 => IPeekABoo.GhostMap) public ghostMaps;
    mapping(address => uint256) public whitelist;

    // reference to $IBOO for burning on mint
    IBOO public boo;
    IERC20Upgradeable public magic;
    ITraits public traits;
    ILevel public level;
    InGame public ingame;
    IStakeManager public stakeManager;

    uint256 MINT_PHASE1_GHOSTS;
    uint256 MINT_PHASE2_GHOSTS;
    uint256 DEV_AND_COMM_PHASE1_GHOSTS;
    bool PHASE1_ENDED;
    uint256 PUBLIC_PRICE;
    uint256 funds;
    mapping(address => uint256) publicMinted;
}

File 3 of 27 : InGameBase.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;

import "./IPeekABoo.sol";
import "./ITraits.sol";
import "./ILevel.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

contract InGameBase {
    // tokenId => traitType => traitId => bool
    mapping(uint256 => mapping(uint256 => mapping(uint256 => bool)))
        public boughtTraits;
    mapping(uint256 => bool[6]) public boughtAbilities;
    // tokenId => boughtTraitCountByRarity [common,uncommon,...]
    mapping(uint256 => uint256[4]) public boughtTraitCount;

    IPeekABoo public peekaboo;
    ITraits public traits;
    ILevel public level;
    IERC20Upgradeable public boo;
    IERC20Upgradeable public magic;
    uint256 public traitPriceRate;
    uint256 public abilityPriceRate;
}

File 4 of 27 : InGame.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./IPeekABoo.sol";
import "./ITraits.sol";
import "./ILevel.sol";
import "./IInGame.sol";
import "./InGameBase.sol";

contract InGame is
    Initializable,
    IInGame,
    OwnableUpgradeable,
    PausableUpgradeable,
    InGameBase
{
    function initialize(
        IPeekABoo _peekaboo,
        ITraits _traits,
        ILevel _level,
        address _boo,
        address _magic
    ) public initializer {
        __Ownable_init();
        __Pausable_init();
        peekaboo = _peekaboo;
        traits = _traits;
        level = _level;
        boo = IERC20Upgradeable(_boo);
        magic = IERC20Upgradeable(_magic);
        traitPriceRate = 15 ether;
        abilityPriceRate = 30 ether;
    }

    modifier onlyPeekABoo() {
        require(
            _msgSender() == address(peekaboo),
            "Must be IPeekABoo.sol, don't cheat"
        );
        _;
    }

    function buyTraits(
        uint256 tokenId,
        uint256[] calldata traitTypes,
        uint256[] calldata traitIds,
        uint256 amount
    ) external {
        require(
            _msgSender() == peekaboo.ownerOf(tokenId),
            "ITraits can only be purchased by owner"
        );
        require(
            traitTypes.length == traitIds.length,
            "traitTypes and traitIds lengths are different"
        );
        uint256 totalBOO = 0;
        bool _isGhost = peekaboo.getTokenTraits(tokenId).isGhost;
        if (_isGhost == true) {
            for (uint256 i = 0; i < traitIds.length; i++) {
                require(
                    traitIds[i] <=
                        level.getUnlockedTraits(tokenId, traitTypes[i]),
                    "Trait not unlocked yet"
                );
                if (traitIds[i] <= traits.getRarityIndex(0, traitTypes[i], 1)) {
                    totalBOO += traitPriceRate;
                    boughtTraitCount[tokenId][1] =
                        boughtTraitCount[tokenId][1] +
                        1;
                } else if (
                    traitIds[i] <= traits.getRarityIndex(0, traitTypes[i], 2)
                ) {
                    totalBOO += (traitPriceRate * 2);
                    boughtTraitCount[tokenId][2] =
                        boughtTraitCount[tokenId][2] +
                        1;
                } else if (
                    traitIds[i] <= traits.getRarityIndex(0, traitTypes[i], 3)
                ) {
                    totalBOO += (traitPriceRate * 3);
                    boughtTraitCount[tokenId][3] =
                        boughtTraitCount[tokenId][3] +
                        1;
                }
                boughtTraits[tokenId][traitTypes[i]][traitIds[i]] = true;
            }
        } else {
            for (uint256 i = 0; i < traitIds.length; i++) {
                require(
                    traitIds[i] <=
                        level.getUnlockedTraits(tokenId, traitTypes[i]),
                    "Trait not unlocked yet"
                );
                if (traitIds[i] <= traits.getRarityIndex(1, traitTypes[i], 1)) {
                    totalBOO += traitPriceRate;
                    boughtTraitCount[tokenId][1] =
                        boughtTraitCount[tokenId][1] +
                        1;
                } else if (
                    traitIds[i] <= traits.getRarityIndex(1, traitTypes[i], 2)
                ) {
                    totalBOO += (traitPriceRate * 2);
                    boughtTraitCount[tokenId][2] =
                        boughtTraitCount[tokenId][2] +
                        1;
                } else if (
                    traitIds[i] <= traits.getRarityIndex(1, traitTypes[i], 3)
                ) {
                    totalBOO += (traitPriceRate * 3);
                    boughtTraitCount[tokenId][3] =
                        boughtTraitCount[tokenId][3] +
                        1;
                }
                boughtTraits[tokenId][traitTypes[i]][traitIds[i]] = true;
            }
        }
        require(amount >= totalBOO, "Not enough $BOO");
        _approveFor(msg.sender, boo, amount);
        boo.transferFrom(msg.sender, address(this), amount);
    }

    function buyAbilities(
        uint256 tokenId,
        uint256[] calldata abilities,
        uint256 amount
    ) external {
        require(
            _msgSender() == peekaboo.ownerOf(tokenId),
            "Only owner can buy abilities"
        );
        uint256 totalMAGIC = 0;
        uint256 _tier = peekaboo.getTokenTraits(tokenId).tier;
        require(
            peekaboo.getTokenTraits(tokenId).isGhost == false,
            "Only busters can buy abilities"
        );
        for (uint256 i = 0; i < abilities.length; i++) {
            if (abilities[i] == 0) {
                require(
                    _tier >= 1,
                    "This ability cannot be bought yet at this tier"
                );
                if (_tier < 2)
                    require(
                        boughtAbilities[tokenId][1] == false,
                        "This ability cannot be bought yet at this tier"
                    );
                totalMAGIC += abilityPriceRate;
                boughtAbilities[tokenId][0] = true;
            } else if (abilities[i] == 1) {
                require(
                    _tier >= 1,
                    "This ability cannot be bought yet at this tier"
                );
                if (_tier < 2)
                    require(
                        boughtAbilities[tokenId][0] == false,
                        "This ability cannot be bought yet at this level"
                    );
                totalMAGIC += abilityPriceRate;
                boughtAbilities[tokenId][1] = true;
            } else if (abilities[i] == 2) {
                require(
                    _tier >= 3,
                    "This ability cannot be bought yet at this tier"
                );
                if (_tier == 3)
                    require(
                        boughtAbilities[tokenId][3] == false &&
                            boughtAbilities[tokenId][4] == false,
                        "This ability cannot be bought yet at this level"
                    );
                if (_tier == 4)
                    require(
                        boughtAbilities[tokenId][3] == false ||
                            boughtAbilities[tokenId][4] == false,
                        "This ability cannot be bought yet at this level"
                    );
                totalMAGIC += abilityPriceRate * 2;
                boughtAbilities[tokenId][2] = true;
            } else if (abilities[i] == 3) {
                require(
                    _tier >= 3,
                    "This ability cannot be bought yet at this tier"
                );
                if (_tier == 3)
                    require(
                        boughtAbilities[tokenId][2] == false &&
                            boughtAbilities[tokenId][4] == false,
                        "This ability cannot be bought yet at this level"
                    );
                if (_tier == 4)
                    require(
                        boughtAbilities[tokenId][2] == false ||
                            boughtAbilities[tokenId][4] == false,
                        "This ability cannot be bought yet at this level"
                    );
                totalMAGIC += abilityPriceRate * 2;
                boughtAbilities[tokenId][3] = true;
            } else if (abilities[i] == 4) {
                require(
                    _tier >= 3,
                    "This ability cannot be bought yet at this tier"
                );
                if (_tier == 3)
                    require(
                        boughtAbilities[tokenId][2] == false &&
                            boughtAbilities[tokenId][4] == false,
                        "This ability cannot be bought yet at this level"
                    );
                if (_tier == 4)
                    require(
                        boughtAbilities[tokenId][2] == false ||
                            boughtAbilities[tokenId][4] == false,
                        "This ability cannot be bought yet at this level"
                    );
                totalMAGIC += abilityPriceRate * 2;
                boughtAbilities[tokenId][4] = true;
            } else if (abilities[i] == 5) {
                require(
                    _tier >= 5,
                    "This ability cannot be bought yet at this tier"
                );
                totalMAGIC += abilityPriceRate * 3;
                boughtAbilities[tokenId][5] = true;
            }
        }
        require(amount >= totalMAGIC, "Not enough $MAGIC");
        _approveFor(msg.sender, magic, amount);
        magic.transferFrom(msg.sender, address(this), amount);
    }

    function tierUp(uint256 tokenId, uint64 toTier) external {
        require(
            _msgSender() == peekaboo.ownerOf(tokenId),
            "Only owner can tier up the token"
        );
        if (peekaboo.getTokenTraits(tokenId).tier == 0) {
            require(
                peekaboo.getTokenTraits(tokenId).level / 10 >= 1,
                "You cannot reach this tier yet"
            );
            if (peekaboo.getTokenTraits(tokenId).isGhost == true) {
                require(
                    boughtTraitCount[tokenId][1] >= 7,
                    "Not enough uncommon traits bought"
                );
            } else
                require(
                    boughtTraitCount[tokenId][1] >= 6,
                    "Not enough uncommon traits bought"
                );
        } else if (peekaboo.getTokenTraits(tokenId).tier == 1) {
            require(
                peekaboo.getTokenTraits(tokenId).level / 10 >= 2,
                "You cannot reach this tier yet"
            );
            if (peekaboo.getTokenTraits(tokenId).isGhost == true) {
                require(
                    boughtTraitCount[tokenId][1] >= 14,
                    "Not enough uncommon traits bought"
                );
            } else
                require(
                    boughtTraitCount[tokenId][1] >= 12,
                    "Not enough uncommon traits bought"
                );
        } else if (peekaboo.getTokenTraits(tokenId).tier == 2) {
            require(
                peekaboo.getTokenTraits(tokenId).level / 10 >= 3,
                "You cannot reach this tier yet"
            );
            if (peekaboo.getTokenTraits(tokenId).isGhost == true) {
                require(
                    boughtTraitCount[tokenId][2] >= 7,
                    "Not enough rare traits bought"
                );
            } else
                require(
                    boughtTraitCount[tokenId][2] >= 6,
                    "Not enough rare traits bought"
                );
        } else if (peekaboo.getTokenTraits(tokenId).tier == 3) {
            require(
                peekaboo.getTokenTraits(tokenId).level / 10 >= 4,
                "You cannot reach this tier yet"
            );
            if (peekaboo.getTokenTraits(tokenId).isGhost == true) {
                require(
                    boughtTraitCount[tokenId][2] >= 7,
                    "Not enough legendary traits bought"
                );
            } else
                require(
                    boughtTraitCount[tokenId][2] >= 6,
                    "Not enough legendary traits bought"
                );
        } else if (peekaboo.getTokenTraits(tokenId).tier == 4) {
            require(
                peekaboo.getTokenTraits(tokenId).level / 10 >= 5,
                "You cannot reach this tier yet"
            );
            uint256 _boughtTraits = boughtTraitCount[tokenId][1] +
                boughtTraitCount[tokenId][2] +
                boughtTraitCount[tokenId][2];
            if (peekaboo.getTokenTraits(tokenId).isGhost == true) {
                require(_boughtTraits >= 127, "Not enough traits bought");
            } else require(_boughtTraits >= 76, "Not enough traits bought");
        } else {
            return;
        }
        peekaboo.incrementTier(tokenId);
    }

    function getBoughtTraitCount(uint256 tokenId, uint256 rarity)
        external
        returns (uint256)
    {
        return boughtTraitCount[tokenId][rarity];
    }

    function isBoughtTrait(
        uint256 tokenId,
        uint256 traitType,
        uint256 traitId
    ) external returns (bool) {
        uint256 ghostOrBuster = (peekaboo.getTokenTraits(tokenId).isGhost ==
            true)
            ? 0
            : 1;
        uint256 commonIndex = traits.getRarityIndex(
            ghostOrBuster,
            traitType,
            0
        );
        if (traitId <= commonIndex) return true;
        return boughtTraits[tokenId][traitType][traitId];
    }

    function isBoughtAbility(uint256 tokenId, uint256 ability)
        external
        returns (bool)
    {
        return boughtAbilities[tokenId][ability];
    }

    function _approveFor(
        address owner,
        IERC20Upgradeable token,
        uint256 amount
    ) internal {
        token.approve(address(this), amount);
    }

    function setBOO(address _boo) external onlyOwner {
        boo = IERC20Upgradeable(_boo);
    }

    function setMagic(address _magic) external onlyOwner {
        magic = IERC20Upgradeable(_magic);
    }

    function setPeekABoo(address _pab) external onlyOwner {
        peekaboo = IPeekABoo(_pab);
    }

    function setTraits(address _traits) external onlyOwner {
        traits = ITraits(_traits);
    }

    function setLevel(address _level) external onlyOwner {
        level = ILevel(_level);
    }

    function setTraitPriceRate(uint256 rate) external onlyOwner {
        traitPriceRate = rate;
    }

    function setAbilityPriceRate(uint256 rate) external onlyOwner {
        abilityPriceRate = rate;
    }
}

File 5 of 27 : ITraits.sol
// SPDX-License-Identifier: MIT LICENSE
import "@openzeppelin/contracts/utils/Strings.sol";

pragma solidity ^0.8.0;

interface ITraits {
    struct Trait {
        string name;
        string svg;
    }

    /** ADMIN */
    function uploadTraits(
        uint256 ghostOrBuster,
        uint256 traitType,
        uint256[] calldata traitIds,
        Trait[] calldata traits
    ) external;

    function setPeekABoo(address _peekaboo) external;

    /** RENDER */
    function tryOutTraits(
        uint256 tokenId,
        uint256[2][] memory traitsToTry,
        uint256 width,
        uint256 height
    ) external view returns (string memory);

    function compileAttributesAsIDs(uint256 tokenId)
        external
        view
        returns (string memory);

    function setRarityIndex(
        uint256 ghostOrBuster,
        uint256 traitType,
        uint256[4] calldata traitIndices
    ) external;

    function getRarityIndex(
        uint256 ghostOrBuster,
        uint256 traitType,
        uint256 rarity
    ) external returns (uint256);

    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 6 of 27 : IStakeManager.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity >0.8.0;

interface IStakeManager {
    function stakePABOnService(
        uint256 tokenId,
        address service,
        address owner
    ) external;

    function isStaked(uint256 tokenId, address service)
        external
        view
        returns (bool);

    function unstakePeekABoo(uint256 tokenId) external;

    function getServices() external view returns (address[] memory);

    function isService(address service) external view returns (bool);

    function initializeEnergy(uint256 tokenId) external;

    function claimEnergy(uint256 tokenId) external;

    function useEnergy(uint256 tokenId, uint256 amount) external;

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

    function tokensOf(address owner) external returns (uint256[] memory);
}

File 7 of 27 : IPeekABoo.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity >0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";

interface IPeekABoo is IERC721Upgradeable {
    struct PeekABooTraits {
        bool isGhost;
        uint256 background;
        uint256 back;
        uint256 bodyColor;
        uint256 hat;
        uint256 face;
        uint256 clothesOrHelmet;
        uint256 hands;
        uint64 ability;
        uint64 revealShape;
        uint64 tier;
        uint64 level;
    }

    struct GhostMap {
        uint256[10][10] grid;
        int256 gridSize;
        uint256 difficulty;
        bool initialized;
    }

    function devMint(address to, uint256[] memory types) external;

    function mint(uint256[] calldata types, bytes32[] memory proof) external;

    function publicMint(uint256[] calldata types) external payable;

    function getTokenTraits(uint256 tokenId)
        external
        view
        returns (PeekABooTraits memory);

    function setTokenTraits(
        uint256 tokenId,
        uint256 traitType,
        uint256 traitId
    ) external;

    function setMultipleTokenTraits(
        uint256 tokenId,
        uint256[] calldata traitTypes,
        uint256[] calldata traitIds
    ) external;

    function getGhostMapGridFromTokenId(uint256 tokenId)
        external
        view
        returns (GhostMap memory);

    function mintPhase2(
        uint256 tokenId,
        uint256[] memory types,
        uint256 amount,
        uint256 booAmount
    ) external;

    function incrementLevel(uint256 tokenId) external;

    function incrementTier(uint256 tokenId) external;

    function getPhase1Minted() external view returns (uint256 result);

    function getPhase2Minted() external view returns (uint256 result);

    function withdraw() external;
}

File 8 of 27 : ILevel.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;

import "./IPeekABoo.sol";
import "./IStakeManager.sol";

interface ILevel {
    function updateExp(
        uint256 tokenId,
        bool won,
        uint256 difficulty
    ) external;

    function expAmount(uint256 tokenId) external view returns (uint256);

    function isUnlocked(
        uint256 tokenId,
        uint256 traitType,
        uint256 traitId
    ) external returns (bool);

    function getUnlockedTraits(uint256 tokenId, uint256 traitType)
        external
        returns (uint256);
}

File 9 of 27 : IInGame.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity ^0.8.0;

import '@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol';
import "./IPeekABoo.sol";
import "./ITraits.sol";
import "./ILevel.sol";

interface IInGame {
    function buyTraits(
        uint256 tokenId,
        uint256[] calldata traitTypes,
        uint256[] calldata traitIds,
        uint256 amount
    ) external;

    function buyAbilities(
        uint256 tokenId,
        uint256[] calldata abilities,
        uint256 amount
    ) external;

    function tierUp(uint256 tokenId, uint64 toTier) external;

    function getBoughtTraitCount(uint256 tokenId, uint256 rarity)
        external
        returns (uint256);

    function isBoughtTrait(
        uint256 tokenId,
        uint256 traitType,
        uint256 traitId
    ) external returns (bool);

    function isBoughtAbility(uint256 tokenId, uint256 ability) external returns (bool);

    function setBOO(address _boo) external;

    function setMagic(address _magic) external;

    function setPeekABoo(address _pab) external;

    function setTraits(address _traits) external;

    function setLevel(address _level) external;

    function setTraitPriceRate(uint256 rate) external;

    function setAbilityPriceRate(uint256 rate) external;
}

File 10 of 27 : IBOO.sol
// SPDX-License-Identifier: MIT LICENSE
pragma solidity >0.8.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

interface IBOO is IERC20Upgradeable {
    function mint(address to, uint256 amount) external;

    function burn(address from, uint256 amount) external;

    function cap() external view returns (uint256);

    function setAllocationAddress(address fundingAddress, uint256 allocation) external;

    function removeAllocationAddress(address fundingAddress) external;
}

File 11 of 27 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

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

File 12 of 27 : IERC165Upgradeable.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 IERC165Upgradeable {
    /**
     * @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 27 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 14 of 27 : MerkleProofUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
library MerkleProofUpgradeable {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = _efficientHash(computedHash, proofElement);
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = _efficientHash(proofElement, computedHash);
            }
        }
        return computedHash;
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 15 of 27 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

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

File 16 of 27 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 17 of 27 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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 functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @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 19 of 27 : IERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

File 20 of 27 : ERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../ERC721Upgradeable.sol";
import "./IERC721EnumerableUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {
    function __ERC721Enumerable_init() internal onlyInitializing {
    }

    function __ERC721Enumerable_init_unchained() internal onlyInitializing {
    }
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[46] private __gap;
}

File 21 of 27 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 22 of 27 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 IERC721ReceiverUpgradeable {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 23 of 27 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable 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.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _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: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {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 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[44] private __gap;
}

File 24 of 27 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 25 of 27 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

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

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 26 of 27 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

File 27 of 27 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

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

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"result","type":"uint256"}],"name":"PABMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_NUM_PHASE1_BUSTERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_NUM_PHASE1_GHOSTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_NUM_PHASE2_BUSTERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_NUM_PHASE2_GHOSTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PHASE1_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PHASE2_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"abilityPriceRate","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":[],"name":"boo","outputs":[{"internalType":"contract IBOO","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"boughtAbilities","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"boughtTraitCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"communityNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256[]","name":"types","type":"uint256[]"}],"name":"devMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endPhase1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getGhostMapGridFromTokenId","outputs":[{"components":[{"internalType":"uint256[10][10]","name":"grid","type":"uint256[10][10]"},{"internalType":"int256","name":"gridSize","type":"int256"},{"internalType":"uint256","name":"difficulty","type":"uint256"},{"internalType":"bool","name":"initialized","type":"bool"}],"internalType":"struct IPeekABoo.GhostMap","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPhase1Minted","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPhase2Minted","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenTraits","outputs":[{"components":[{"internalType":"bool","name":"isGhost","type":"bool"},{"internalType":"uint256","name":"background","type":"uint256"},{"internalType":"uint256","name":"back","type":"uint256"},{"internalType":"uint256","name":"bodyColor","type":"uint256"},{"internalType":"uint256","name":"hat","type":"uint256"},{"internalType":"uint256","name":"face","type":"uint256"},{"internalType":"uint256","name":"clothesOrHelmet","type":"uint256"},{"internalType":"uint256","name":"hands","type":"uint256"},{"internalType":"uint64","name":"ability","type":"uint64"},{"internalType":"uint64","name":"revealShape","type":"uint64"},{"internalType":"uint64","name":"tier","type":"uint64"},{"internalType":"uint64","name":"level","type":"uint64"}],"internalType":"struct IPeekABoo.PeekABooTraits","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ghostMaps","outputs":[{"internalType":"int256","name":"gridSize","type":"int256"},{"internalType":"uint256","name":"difficulty","type":"uint256"},{"internalType":"bool","name":"initialized","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"incrementLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"incrementTier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ingame","outputs":[{"internalType":"contract InGame","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBOO","name":"_boo","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"initializeGhostMap","outputs":[],"stateMutability":"nonpayable","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":"level","outputs":[{"internalType":"contract ILevel","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"magic","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"types","type":"uint256[]"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256[]","name":"types","type":"uint256[]"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"booAmount","type":"uint256"}],"name":"mintPhase2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phase1Minted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phase2Minted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phase2Price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phase2PriceRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"types","type":"uint256[]"}],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint64","name":"ability","type":"uint64"}],"name":"setAbility","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":"address","name":"_boo","type":"address"}],"name":"setBOO","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ingame","type":"address"}],"name":"setInGame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_level","type":"address"}],"name":"setLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_magic","type":"address"}],"name":"setMagic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256[]","name":"traitTypes","type":"uint256[]"},{"internalType":"uint256[]","name":"traitIds","type":"uint256[]"}],"name":"setMultipleTokenTraits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setPause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPhase2Price","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"setPhase2Rate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_PUBLIC_PRICE","type":"uint256"}],"name":"setPublicPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint64","name":"revealShape","type":"uint64"}],"name":"setRevealShape","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"setRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stakeManager","type":"address"}],"name":"setStakeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"traitType","type":"uint256"},{"internalType":"uint256","name":"traitId","type":"uint256"}],"name":"setTokenTraits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_traits","type":"address"}],"name":"setTraits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeManager","outputs":[{"internalType":"contract IStakeManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenTraits","outputs":[{"internalType":"bool","name":"isGhost","type":"bool"},{"internalType":"uint256","name":"background","type":"uint256"},{"internalType":"uint256","name":"back","type":"uint256"},{"internalType":"uint256","name":"bodyColor","type":"uint256"},{"internalType":"uint256","name":"hat","type":"uint256"},{"internalType":"uint256","name":"face","type":"uint256"},{"internalType":"uint256","name":"clothesOrHelmet","type":"uint256"},{"internalType":"uint256","name":"hands","type":"uint256"},{"internalType":"uint64","name":"ability","type":"uint64"},{"internalType":"uint64","name":"revealShape","type":"uint64"},{"internalType":"uint64","name":"tier","type":"uint64"},{"internalType":"uint64","name":"level","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"traitPriceRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"traits","outputs":[{"internalType":"contract ITraits","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506154da806100206000396000f3fe6080604052600436106104265760003560e01c806375a2eaf211610229578063b8f7d8ba1161012e578063d8d492ba116100b6578063e1fc334f1161007a578063e1fc334f14610d15578063e3c971e114610d36578063e985e9c514610d96578063ea1e97ff14610ddf578063f2fde38b14610dff57600080fd5b8063d8d492ba14610b9e578063dab5f34014610bb5578063dc7346d914610bd5578063e05c57bf14610bf5578063e1c4529814610cf557600080fd5b8063c6275255116100fd578063c627525514610b09578063c6450a3b14610b29578063c87b56dd14610b49578063cbc1b7df14610b69578063d431b1ac14610b8957600080fd5b8063b8f7d8ba14610aa6578063ba46e3b714610abd578063bbe7efa314610ad4578063c4d66de814610ae957600080fd5b806395d89b41116101b15780639b89c09d116101805780639b89c09d14610a185780639ec1436b14610a38578063a22cb46514610a4f578063a26f880a14610a6f578063b88d4fde14610a8657600080fd5b806395d89b411461099e5780639615d6a3146109b35780639ad7073e146109d35780639b19251a146109ea57600080fd5b806383d12812116101f857806383d12812146108f35780638b6423ce146109135780638da5cb5b1461093357806392cb91011461095157806394e568471461097157600080fd5b806375a2eaf21461087c57806375a3d557146108935780637a51c003146108b3578063829d7332146108d357600080fd5b8063389c88a11161032f5780636352211e116102b75780636f4f7366116102865780636f4f7366146107e55780636fd5ae151461080557806370a0823114610826578063715018a6146108465780637542ff951461085b57600080fd5b80636352211e1461076e578063664904691461078e5780636915cc27146107af5780636bba90b3146107cf57600080fd5b806342842e0e116102fe57806342842e0e146106d55780634b3df200146106f55780634f6ccce7146107165780635c975abb14610736578063608cf6051461074e57600080fd5b8063389c88a11461066a5780633ccfd60b1461067d5780633f86554614610692578063415dff12146106a857600080fd5b806318160ddd116103b25780631f320c88116103815780631f320c88146105e557806323b872dd146105fc5780632f745c591461061c57806331f3101c1461063c578063329eac151461065357600080fd5b806318160ddd146105795780631905f5721461058e5780631ac9c67e146105ae5780631bfa959b146105c557600080fd5b8063081812fc116103f9578063081812fc146104be578063095ea7b3146104f65780630d854646146105185780630e7c67fc1461053957806313b9093f1461055957600080fd5b806301ffc9a71461042b578063030a44d31461046057806303cbbb831461048557806306fdde031461049c575b600080fd5b34801561043757600080fd5b5061044b610446366004614842565b610e1f565b60405190151581526020015b60405180910390f35b34801561046c57600080fd5b506104776101325481565b604051908152602001610457565b34801561049157600080fd5b506104776101355481565b3480156104a857600080fd5b506104b1610e4a565b60405161045791906148be565b3480156104ca57600080fd5b506104de6104d93660046148d1565b610edc565b6040516001600160a01b039091168152602001610457565b34801561050257600080fd5b506105166105113660046148ff565b610f76565b005b34801561052457600080fd5b50610140546104de906001600160a01b031681565b34801561054557600080fd5b5061051661055436600461492b565b61108c565b34801561056557600080fd5b506105166105743660046148d1565b6110d9565b34801561058557600080fd5b50609954610477565b34801561059a57600080fd5b506105166105a936600461492b565b61121b565b3480156105ba57600080fd5b506104776101365481565b3480156105d157600080fd5b506105166105e03660046148d1565b611268565b3480156105f157600080fd5b5061047761012f5481565b34801561060857600080fd5b50610516610617366004614948565b611298565b34801561062857600080fd5b506104776106373660046148ff565b6112c9565b34801561064857600080fd5b506104776101375481565b34801561065f57600080fd5b506104776101335481565b6105166106783660046149d4565b61135f565b34801561068957600080fd5b506105166115c0565b34801561069e57600080fd5b5061013554610477565b3480156106b457600080fd5b506106c86106c33660046148d1565b611630565b6040516104579190614a15565b3480156106e157600080fd5b506105166106f0366004614948565b6116dc565b34801561070157600080fd5b5061013f546104de906001600160a01b031681565b34801561072257600080fd5b506104776107313660046148d1565b6116f7565b34801561074257600080fd5b5060fb5460ff1661044b565b34801561075a57600080fd5b50610516610769366004614b6f565b61178a565b34801561077a57600080fd5b506104de6107893660046148d1565b611de0565b34801561079a57600080fd5b50610143546104de906001600160a01b031681565b3480156107bb57600080fd5b506105166107ca366004614bc5565b611e57565b3480156107db57600080fd5b5061013654610477565b3480156107f157600080fd5b5061051661080036600461492b565b612473565b34801561081157600080fd5b50610142546104de906001600160a01b031681565b34801561083257600080fd5b5061047761084136600461492b565b6124c0565b34801561085257600080fd5b50610516612547565b34801561086757600080fd5b50610144546104de906001600160a01b031681565b34801561088857600080fd5b506104776101345481565b34801561089f57600080fd5b506105166108ae366004614bf1565b61257d565b3480156108bf57600080fd5b506105166108ce366004614bf1565b6126da565b3480156108df57600080fd5b5061044b6108ee366004614c2d565b6128ac565b3480156108ff57600080fd5b5061051661090e366004614c4f565b6128e6565b34801561091f57600080fd5b5061051661092e366004614cc8565b612a4f565b34801561093f57600080fd5b5060c9546001600160a01b03166104de565b34801561095d57600080fd5b5061051661096c36600461492b565b612c94565b34801561097d57600080fd5b5061099161098c3660046148d1565b612ce1565b6040516104579190614d87565b3480156109aa57600080fd5b506104b1612e22565b3480156109bf57600080fd5b506104776109ce366004614c2d565b612e31565b3480156109df57600080fd5b506104776101385481565b3480156109f657600080fd5b50610477610a0536600461492b565b61013e6020526000908152604090205481565b348015610a2457600080fd5b50610516610a33366004614c2d565b612e57565b348015610a4457600080fd5b506104776101305481565b348015610a5b57600080fd5b50610516610a6a366004614e3c565b613095565b348015610a7b57600080fd5b5061047761012e5481565b348015610a9257600080fd5b50610516610aa1366004614e91565b6130a4565b348015610ab257600080fd5b5061047761012d5481565b348015610ac957600080fd5b506104776101395481565b348015610ae057600080fd5b506105166130d6565b348015610af557600080fd5b50610516610b0436600461492b565b613115565b348015610b1557600080fd5b50610516610b243660046148d1565b6132a0565b348015610b3557600080fd5b50610516610b443660046148d1565b6132d0565b348015610b5557600080fd5b506104b1610b643660046148d1565b613349565b348015610b7557600080fd5b50610516610b8436600461492b565b61343a565b348015610b9557600080fd5b50610516613487565b348015610baa57600080fd5b506104776101315481565b348015610bc157600080fd5b50610516610bd03660046148d1565b6134cc565b348015610be157600080fd5b50610516610bf0366004614f3a565b6134fc565b348015610c0157600080fd5b50610c88610c103660046148d1565b61013a6020526000908152604090208054600182015460028301546003840154600485015460058601546006870154600788015460089098015460ff90971697959694959394929391929091906001600160401b0380821691600160401b8104821691600160801b8204811691600160c01b9004168c565b604080519c15158d5260208d019b909b52998b019890985260608a0196909652608089019490945260a088019290925260c087015260e08601526001600160401b039081166101008601529081166101208501529081166101408401521661016082015261018001610457565b348015610d0157600080fd5b50610516610d103660046148d1565b61361c565b348015610d2157600080fd5b50610141546104de906001600160a01b031681565b348015610d4257600080fd5b50610d79610d513660046148d1565b61013d6020526000908152604090206064810154606582015460669092015490919060ff1683565b604080519384526020840192909252151590820152606001610457565b348015610da257600080fd5b5061044b610db1366004614f89565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b348015610deb57600080fd5b50610516610dfa36600461492b565b61364c565b348015610e0b57600080fd5b50610516610e1a36600461492b565b613699565b60006001600160e01b0319821663780e9d6360e01b1480610e445750610e4482613731565b92915050565b606060658054610e5990614fb7565b80601f0160208091040260200160405190810160405280929190818152602001828054610e8590614fb7565b8015610ed25780601f10610ea757610100808354040283529160200191610ed2565b820191906000526020600020905b815481529060010190602001808311610eb557829003601f168201915b5050505050905090565b6000818152606760205260408120546001600160a01b0316610f5a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152606960205260409020546001600160a01b031690565b6000610f8182611de0565b9050806001600160a01b0316836001600160a01b03161415610fef5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610f51565b336001600160a01b038216148061100b575061100b8133610db1565b61107d5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610f51565b6110878383613781565b505050565b60c9546001600160a01b031633146110b65760405162461bcd60e51b8152600401610f5190614ff2565b61014480546001600160a01b0319166001600160a01b0392909216919091179055565b610143546001600160a01b0316336001600160a01b0316146110fa57600080fd5b600081815261013a602052604090206008018054600160801b90046001600160401b031690601061112a8361503d565b82546001600160401b039182166101009390930a928302919092021990911617905550600081815261013a602052604090205460ff16801561118e5750600081815261013a6020526040902060080154600160801b90046001600160401b03166001145b156111b357600090815261013d60205260409020600160658201556009606490910155565b600081815261013a602052604090205460ff1680156111f45750600081815261013a6020526040902060080154600160801b90046001600160401b03166003145b1561121857600081815261013d6020526040902060026065820155600a6064909101555b50565b60c9546001600160a01b031633146112455760405162461bcd60e51b8152600401610f5190614ff2565b61014380546001600160a01b0319166001600160a01b0392909216919091179055565b60c9546001600160a01b031633146112925760405162461bcd60e51b8152600401610f5190614ff2565b61013355565b6112a233826137ef565b6112be5760405162461bcd60e51b8152600401610f5190615064565b6110878383836138e6565b60006112d4836124c0565b82106113365760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610f51565b506001600160a01b03919091166000908152609760209081526040808320938352929052205490565b3233146113995760405162461bcd60e51b81526020600482015260086024820152674f6e6c7920454f4160c01b6044820152606401610f51565b6101485460ff166113ec5760405162461bcd60e51b815260206004820152601a60248201527f77686974656c697374206d696e74207374696c6c20676f696e670000000000006044820152606401610f51565b60fb5460ff16156114285760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610f51565b806114665760405162461bcd60e51b815260206004820152600e60248201526d092dcecc2d8d2c840d8cadccee8d60931b6044820152606401610f51565b610149546114759082906150b5565b3410156114c45760405162461bcd60e51b815260206004820152601a60248201527f77686974656c697374206d696e74207374696c6c20676f696e670000000000006044820152606401610f51565b3461014a60008282546114d791906150d4565b909155505033600090815261014b602052604090205461012d546114fe906109c4906150ec565b816101355461150d91906150d4565b111561152b5760405162461bcd60e51b8152600401610f5190615103565b600361153783836150d4565b106115845760405162461bcd60e51b815260206004820152601760248201527f65786365656473206d61782070657220616464726573730000000000000000006044820152606401610f51565b33600090815261014b60205260409020546115a09083906150d4565b33600081815261014b602052604090209190915561108790838581613a8d565b60c9546001600160a01b031633146115ea5760405162461bcd60e51b8152600401610f5190614ff2565b60c95461014a546040516001600160a01b039092169181156108fc0291906000818181858888f19350505050158015611627573d6000803e3d6000fd5b50600061014a55565b611638614716565b600082815261013d602052604080822081516101c081019092529091829060808201908390600a90835b828210156116aa576040805161014081019182905290600a84810287019182845b81548152602001906001019080831161168357505050505081526020019060010190611662565b50505090825250606482015460208201526065820154604082015260669091015460ff16151560609091015292915050565b611087838383604051806020016040528060008152506130a4565b600061170260995490565b82106117655760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610f51565b609982815481106117785761177861513a565b90600052602060002001549050919050565b8361179481611de0565b6001600160a01b0316336001600160a01b031614806118335750610144546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e906024016020604051808303816000875af11580156117fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181e9190615150565b6001600160a01b0316336001600160a01b0316145b61184f5760405162461bcd60e51b8152600401610f519061516d565b600061013554612710146118975760405162461bcd60e51b815260206004820152600f60248201526e383430b9b298903737ba1037bb32b960891b6044820152606401610f51565b61012e5484610136546118aa91906150d4565b11156118f85760405162461bcd60e51b815260206004820152601960248201527f416c6c205068617365203220746f6b656e73206d696e746564000000000000006044820152606401610f51565b845184146119185760405162461bcd60e51b8152600401610f5190615190565b600086815261013a602052604090206008015461194790600a90600160c01b90046001600160401b03166151eb565b6001600160401b0316156119b05760405162461bcd60e51b815260206004820152602a60248201527f506861736520322063616e6e6f74206265206d696e74656420796574206279206044820152693a3434b9903a37b5b2b760b11b6064820152608401610f51565b600086815261013a60205260409020600801546119df90600a90600160c01b90046001600160401b0316615211565b6001600160401b0316841115611a435760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f74206d696e742074686973206d616e792061742074686973206c656044820152621d995b60ea1b6064820152608401610f51565b8361013354611a5291906150b5565b831015611a715760405162461bcd60e51b8152600401610f5190615237565b600086815261013a60205260409020600801546001600160401b03600160801b8204811691611aaa91600a91600160c01b900416615211565b6001600160401b031611611b005760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f74206d696e742061667465722074696572207570000000000000006044820152606401610f51565b600086815261013a6020526040902060080154611b2f90600590600160c01b90046001600160401b0316615280565b600087815261013a6020526040812060080180546001600160401b0393909316600160c01b026001600160c01b0390931692909217909155805b85811015611c72576103e861013654611b8291906152a8565b61013454611b9091906150b5565b61013354611b9e91906150d4565b611ba890846150d4565b925061013654612710611bbb91906150d4565b9150611bc73383613c15565b61014454604051630f0df35360e01b8152600481018490526001600160a01b0390911690630f0df35390602401600060405180830381600087803b158015611c0e57600080fd5b505af1158015611c22573d6000803e3d6000fd5b50505050611c4982888381518110611c3c57611c3c61513a565b6020026020010151613c2f565b6101368054906000611c5a836152bc565b91905055508080611c6a906152bc565b915050611b69565b5081841015611c935760405162461bcd60e51b8152600401610f5190615237565b61013f54604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015611ce3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0791906152d7565b905084811015611d595760405162461bcd60e51b815260206004820152601960248201527f436865636b2074686520746f6b656e20616c6c6f77616e6365000000000000006044820152606401610f51565b61013f546040516323b872dd60e01b8152336004820152306024820152604481018790526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015611db1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd591906152f0565b505050505050505050565b6000818152606760205260408120546001600160a01b031680610e445760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610f51565b611e6083611de0565b6001600160a01b0316336001600160a01b03161480611eff5750610144546040516331a9108f60e11b8152600481018590526001600160a01b0390911690636352211e906024016020604051808303816000875af1158015611ec6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eea9190615150565b6001600160a01b0316336001600160a01b0316145b80611f14575060c9546001600160a01b031633145b611f305760405162461bcd60e51b8152600401610f519061516d565b61014254604051638803bb4360e01b81526004810185905260248101849052604481018390526001600160a01b0390911690638803bb43906064016020604051808303816000875af1158015611f8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fae91906152f0565b611ffa5760405162461bcd60e51b815260206004820152601b60248201527f54686973207472616974206973206e6f7420756e6c6f636b65642e00000000006044820152606401610f51565b600083815261013a602052604090205460ff1615612254576101415460405163491146f560e11b81526000600482018190526024820185905260448201526001600160a01b03909116906392228dea906064016020604051808303816000875af115801561206c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209091906152d7565b8111158061211d5750610143546040516302f0ee5360e41b81526004810185905260248101849052604481018390526001600160a01b0390911690632f0ee530906064016020604051808303816000875af11580156120f3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211791906152f0565b15156001145b6121635760405162461bcd60e51b815260206004820152601760248201527618d85b9b9bdd08195c5d5a5c081d1a1a5cc81d1c985a5d604a1b6044820152606401610f51565b8161218257600083815261013a60205260409020600101819055505050565b81600114156121a557600083815261013a60205260409020600201819055505050565b81600214156121c857600083815261013a60205260409020600301819055505050565b81600314156121eb57600083815261013a60205260409020600601819055505050565b816004141561220e57600083815261013a60205260409020600401819055505050565b816005141561223157600083815261013a60205260409020600501819055505050565b816006141561108757600083815261013a60205260409020600701819055505050565b6101415460405163491146f560e11b81526001600482015260248101849052600060448201526001600160a01b03909116906392228dea906064016020604051808303816000875af11580156122ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d291906152d7565b8111158061235f5750610143546040516302f0ee5360e41b81526004810185905260248101849052604481018390526001600160a01b0390911690632f0ee530906064016020604051808303816000875af1158015612335573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061235991906152f0565b15156001145b6123a55760405162461bcd60e51b815260206004820152601760248201527618d85b9b9bdd08195c5d5a5c081d1a1a5cc81d1c985a5d604a1b6044820152606401610f51565b816123c457600083815261013a60205260409020600101819055505050565b81600114156123e757600083815261013a60205260409020600201819055505050565b816002141561240a57600083815261013a60205260409020600301819055505050565b816003141561242d57600083815261013a60205260409020600401819055505050565b816004141561245057600083815261013a60205260409020600501819055505050565b816005141561108757600083815261013a60205260409020600601819055505050565b60c9546001600160a01b0316331461249d5760405162461bcd60e51b8152600401610f5190614ff2565b61014180546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b03821661252b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610f51565b506001600160a01b031660009081526068602052604090205490565b60c9546001600160a01b031633146125715760405162461bcd60e51b8152600401610f5190614ff2565b61257b6000613e23565b565b8161258781611de0565b6001600160a01b0316336001600160a01b031614806126265750610144546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e906024016020604051808303816000875af11580156125ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126119190615150565b6001600160a01b0316336001600160a01b0316145b6126425760405162461bcd60e51b8152600401610f519061516d565b6003826001600160401b03161061269b5760405162461bcd60e51b815260206004820152601b60248201527f72657665616c20736861706520646f6573206e6f7420657869737400000000006044820152606401610f51565b50600091825261013a602052604090912060080180546001600160401b03909216600160401b0267ffffffffffffffff60401b19909216919091179055565b816126e481611de0565b6001600160a01b0316336001600160a01b031614806127835750610144546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e906024016020604051808303816000875af115801561274a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061276e9190615150565b6001600160a01b0316336001600160a01b0316145b61279f5760405162461bcd60e51b8152600401610f519061516d565b61014354604051631fb0c20160e01b8152600481018590526001600160401b03841660248201526001600160a01b0390911690631fb0c201906044016020604051808303816000875af11580156127fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061281e91906152f0565b6128785760405162461bcd60e51b815260206004820152602560248201527f596f7520646f2068617665206e6f7420756e6c6f636b65642074686973206162604482015264696c69747960d81b6064820152608401610f51565b50600091825261013a6020526040909120600801805467ffffffffffffffff19166001600160401b03909216919091179055565b61013b60205281600052604060002081600681106128c957600080fd5b602081049091015460ff601f9092166101000a9004169150829050565b846128f081611de0565b6001600160a01b0316336001600160a01b0316148061298f5750610144546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e906024016020604051808303816000875af1158015612956573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061297a9190615150565b6001600160a01b0316336001600160a01b0316145b6129ab5760405162461bcd60e51b8152600401610f519061516d565b8382146129ee5760405162461bcd60e51b8152602060048201526011602482015270496e636f7272656374206c656e6774687360781b6044820152606401610f51565b60005b84811015612a4657612a3487878784818110612a0f57612a0f61513a565b90506020020135868685818110612a2857612a2861513a565b90506020020135611e57565b80612a3e816152bc565b9150506129f1565b50505050505050565b323314612a895760405162461bcd60e51b81526020600482015260086024820152674f6e6c7920454f4160c01b6044820152606401610f51565b6101485460ff1615612add5760405162461bcd60e51b815260206004820152601d60248201527f5068617365312077686974656c697374206d696e74206973206f7665720000006044820152606401610f51565b60fb5460ff1615612b195760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610f51565b33600090815261014d602052604090205460ff1615612b6c5760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b6044820152606401610f51565b612bc861014c54612b7a3390565b604051602001612ba2919060609190911b6bffffffffffffffffffffffff1916815260140190565b6040516020818303038152906040528051906020012083613e759092919063ffffffff16565b612c145760405162461bcd60e51b815260206004820152601760248201527f43616c6c6572206973206e6f74206120636c61696d65720000000000000000006044820152606401610f51565b33600090815261014d60205260409020805460ff1916600190811790915561012d5461013554612c459083906150d4565b1115612c635760405162461bcd60e51b8152600401610f5190615103565b808314612c825760405162461bcd60e51b8152600401610f5190615190565b612c8e33828686613a8d565b50505050565b60c9546001600160a01b03163314612cbe5760405162461bcd60e51b8152600401610f5190614ff2565b61013f80546001600160a01b0319166001600160a01b0392909216919091179055565b612d6b6040518061018001604052806000151581526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160006001600160401b0316815260200160006001600160401b0316815260200160006001600160401b0316815260200160006001600160401b031681525090565b50600090815261013a6020908152604091829020825161018081018452815460ff16151581526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c0820152600782015460e08201526008909101546001600160401b03808216610100840152600160401b82048116610120840152600160801b82048116610140840152600160c01b9091041661016082015290565b606060668054610e5990614fb7565b61013c6020528160005260406000208160048110612e4e57600080fd5b01549150829050565b81612e6181611de0565b6001600160a01b0316336001600160a01b03161480612f005750610144546040516331a9108f60e11b8152600481018390526001600160a01b0390911690636352211e906024016020604051808303816000875af1158015612ec7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eeb9190615150565b6001600160a01b0316336001600160a01b0316145b612f1c5760405162461bcd60e51b8152600401610f519061516d565b816101376000828254612f2f91906150d4565b909155505061013754600084815261013d602052604090206066015460ff1615612f9b5760405162461bcd60e51b815260206004820152601c60248201527f616c726561647920696e697469616c697a656420746865206d61702e000000006044820152606401610f51565b60005b600a8110156130635760005b600a8110156130505760408051602081018890529081018490526060810183905260808101829052600a9060a0016040516020818303038152906040528051906020012060001c612ffb919061530d565b6001141561303e57600086815261013d6020526040902060019083600a81106130265761302661513a565b600a020182600a811061303b5761303b61513a565b01555b80613048816152bc565b915050612faa565b508061305b816152bc565b915050612f9e565b50505060009182525061013d60205260408120600860648201556065810191909155606601805460ff19166001179055565b6130a0338383613e8b565b5050565b6130ae33836137ef565b6130ca5760405162461bcd60e51b8152600401610f5190615064565b612c8e84848484613f5a565b60c9546001600160a01b031633146131005760405162461bcd60e51b8152600401610f5190614ff2565b610148805460ff19811660ff90911615179055565b600054610100900460ff166131305760005460ff1615613134565b303b155b6131975760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610f51565b600054610100900460ff161580156131b9576000805461ffff19166101011790555b6131fe604051806040016040528060088152602001675065656b41426f6f60c01b815250604051806040016040528060038152602001622820a160e91b815250613f8d565b613206613fbe565b61320e613fed565b61013f80546001600160a01b0319166001600160a01b03841617905561271061012d81905561012e556109c461012f81905561020d61014755610148805460ff19169055611d4c61013081905561013191909155610132557fdb75746519e2448a1597dc7a4a6ce0586a3a5f171378abdc3367f4a28b8a06f861014c5580156130a0576000805461ff00191690555050565b60c9546001600160a01b031633146132ca5760405162461bcd60e51b8152600401610f5190614ff2565b61014955565b610142546001600160a01b0316336001600160a01b0316146132f157600080fd5b600081815261013a602052604090206008018054600160c01b90046001600160401b03169060186133218361503d565b91906101000a8154816001600160401b0302191690836001600160401b031602179055505050565b6000818152606760205260409020546060906001600160a01b03166133c85760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610f51565b6101415460405163c87b56dd60e01b8152600481018490526001600160a01b039091169063c87b56dd90602401600060405180830381865afa158015613412573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e449190810190615321565b60c9546001600160a01b031633146134645760405162461bcd60e51b8152600401610f5190614ff2565b61014080546001600160a01b0319166001600160a01b0392909216919091179055565b60c9546001600160a01b031633146134b15760405162461bcd60e51b8152600401610f5190614ff2565b60fb5460ff16156134c45761257b61401c565b61257b6140af565b60c9546001600160a01b031633146134f65760405162461bcd60e51b8152600401610f5190614ff2565b61014c55565b60c9546001600160a01b031633146135265760405162461bcd60e51b8152600401610f5190614ff2565b61012d5481516101355461353a91906150d4565b11156135585760405162461bcd60e51b8152600401610f5190615103565b60005b8151811015611087576135718361013554613c15565b6101445461013554604051630f0df35360e01b81526001600160a01b0390921691630f0df353916135a89160040190815260200190565b600060405180830381600087803b1580156135c257600080fd5b505af11580156135d6573d6000803e3d6000fd5b505050506135f361013554838381518110611c3c57611c3c61513a565b6101358054906000613604836152bc565b91905055508080613614906152bc565b91505061355b565b60c9546001600160a01b031633146136465760405162461bcd60e51b8152600401610f5190614ff2565b61013455565b60c9546001600160a01b031633146136765760405162461bcd60e51b8152600401610f5190614ff2565b61014280546001600160a01b0319166001600160a01b0392909216919091179055565b60c9546001600160a01b031633146136c35760405162461bcd60e51b8152600401610f5190614ff2565b6001600160a01b0381166137285760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610f51565b61121881613e23565b60006001600160e01b031982166380ac58cd60e01b148061376257506001600160e01b03198216635b5e139f60e01b145b80610e4457506301ffc9a760e01b6001600160e01b0319831614610e44565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906137b682611de0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152606760205260408120546001600160a01b03166138685760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610f51565b600061387383611de0565b9050806001600160a01b0316846001600160a01b031614806138ae5750836001600160a01b03166138a384610edc565b6001600160a01b0316145b806138de57506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166138f982611de0565b6001600160a01b03161461395d5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610f51565b6001600160a01b0382166139bf5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610f51565b6139ca83838361412a565b6139d5600082613781565b6001600160a01b03831660009081526068602052604081208054600192906139fe9084906150ec565b90915550506001600160a01b0382166000908152606860205260408120805460019290613a2c9084906150d4565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60005b83811015613c0e57613aa58561013554613c15565b6101445461013554604051630f0df35360e01b81526001600160a01b0390921691630f0df35391613adc9160040190815260200190565b600060405180830381600087803b158015613af657600080fd5b505af1158015613b0a573d6000803e3d6000fd5b50505050828282818110613b2057613b2061513a565b9050602002013560001415613bc05761012f546101475461014554613b4591906150d4565b613b509060016150d4565b10613ba95760405162461bcd60e51b8152602060048201526024808201527f416c6c2067686f73747320696e2070686173653120616c7265616479206d696e6044820152633a32b21760e11b6064820152608401610f51565b6101458054906000613bba836152bc565b91905055505b613be561013554848484818110613bd957613bd961513a565b90506020020135613c2f565b6101358054906000613bf6836152bc565b91905055508080613c06906152bc565b915050613a90565b5050505050565b6130a08282604051806020016040528060008152506141e2565b6000338342613c408561029a6150b5565b60405160609490941b6bffffffffffffffffffffffff1916602085015260348401929092526054830152607482015244609482015260b40160408051601f198184030181529190528051602090910120905081613d2d57600083815261013a60205260408120805460ff19166001179055613cc29084906107ca60078561530d565b613cd38360016107ca60098561530d565b613ce48360026107ca60088561530d565b613cf58360036107ca600e8561530d565b613d068360046107ca600d8561530d565b613d178360056107ca60078561530d565b613d288360066107ca60078561530d565b613df1565b600083815261013a60205260408120805460ff19169055613d559084906107ca60078561530d565b613d668360016107ca60058561530d565b613d778360026107ca600c8561530d565b613d888360036107ca600a8561530d565b613d988360046107ca818561530d565b613da98360056107ca60028561530d565b613db46003826151eb565b600084815261013a6020526040902060080180546001600160401b0392909216600160401b0267ffffffffffffffff60401b199092169190911790555b5050600090815261013a6020526040902060080180546fffffffffffffffffffffffffffffffff16600160c01b179055565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600082613e828584614215565b14949350505050565b816001600160a01b0316836001600160a01b03161415613eed5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610f51565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613f658484846138e6565b613f7184848484614289565b612c8e5760405162461bcd60e51b8152600401610f5190615397565b600054610100900460ff16613fb45760405162461bcd60e51b8152600401610f51906153e9565b6130a08282614387565b600054610100900460ff16613fe55760405162461bcd60e51b8152600401610f51906153e9565b61257b6143d5565b600054610100900460ff166140145760405162461bcd60e51b8152600401610f51906153e9565b61257b614405565b60fb5460ff166140655760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610f51565b60fb805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60fb5460ff16156140f55760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610f51565b60fb805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586140923390565b6001600160a01b0383166141855761418081609980546000838152609a60205260408120829055600182018355919091527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000155565b6141a8565b816001600160a01b0316836001600160a01b0316146141a8576141a88382614438565b6001600160a01b0382166141bf57611087816144d5565b826001600160a01b0316826001600160a01b031614611087576110878282614584565b6141ec83836145c8565b6141f96000848484614289565b6110875760405162461bcd60e51b8152600401610f5190615397565b600081815b84518110156142815760008582815181106142375761423761513a565b6020026020010151905080831161425d576000838152602082905260409020925061426e565b600081815260208490526040902092505b5080614279816152bc565b91505061421a565b509392505050565b60006001600160a01b0384163b1561437c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906142cd903390899088908890600401615434565b6020604051808303816000875af1925050508015614308575060408051601f3d908101601f1916820190925261430591810190615471565b60015b614362573d808015614336576040519150601f19603f3d011682016040523d82523d6000602084013e61433b565b606091505b50805161435a5760405162461bcd60e51b8152600401610f5190615397565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506138de565b506001949350505050565b600054610100900460ff166143ae5760405162461bcd60e51b8152600401610f51906153e9565b81516143c1906065906020850190614746565b508051611087906066906020840190614746565b600054610100900460ff166143fc5760405162461bcd60e51b8152600401610f51906153e9565b61257b33613e23565b600054610100900460ff1661442c5760405162461bcd60e51b8152600401610f51906153e9565b60fb805460ff19169055565b60006001614445846124c0565b61444f91906150ec565b6000838152609860205260409020549091508082146144a2576001600160a01b03841660009081526097602090815260408083208584528252808320548484528184208190558352609890915290208190555b5060009182526098602090815260408084208490556001600160a01b039094168352609781528383209183525290812055565b6099546000906144e7906001906150ec565b6000838152609a60205260408120546099805493945090928490811061450f5761450f61513a565b9060005260206000200154905080609983815481106145305761453061513a565b6000918252602080832090910192909255828152609a909152604080822084905585825281205560998054806145685761456861548e565b6001900381819060005260206000200160009055905550505050565b600061458f836124c0565b6001600160a01b039093166000908152609760209081526040808320868452825280832085905593825260989052919091209190915550565b6001600160a01b03821661461e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610f51565b6000818152606760205260409020546001600160a01b0316156146835760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610f51565b61468f6000838361412a565b6001600160a01b03821660009081526068602052604081208054600192906146b89084906150d4565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60405180608001604052806147296147ca565b815260200160008152602001600081526020016000151581525090565b82805461475290614fb7565b90600052602060002090601f01602090048101928261477457600085556147ba565b82601f1061478d57805160ff19168380011785556147ba565b828001600101855582156147ba579182015b828111156147ba57825182559160200191906001019061479f565b506147c69291506147f8565b5090565b604051806101400160405280600a905b6147e261480d565b8152602001906001900390816147da5790505090565b5b808211156147c657600081556001016147f9565b604051806101400160405280600a906020820280368337509192915050565b6001600160e01b03198116811461121857600080fd5b60006020828403121561485457600080fd5b813561485f8161482c565b9392505050565b60005b83811015614881578181015183820152602001614869565b83811115612c8e5750506000910152565b600081518084526148aa816020860160208601614866565b601f01601f19169290920160200192915050565b60208152600061485f6020830184614892565b6000602082840312156148e357600080fd5b5035919050565b6001600160a01b038116811461121857600080fd5b6000806040838503121561491257600080fd5b823561491d816148ea565b946020939093013593505050565b60006020828403121561493d57600080fd5b813561485f816148ea565b60008060006060848603121561495d57600080fd5b8335614968816148ea565b92506020840135614978816148ea565b929592945050506040919091013590565b60008083601f84011261499b57600080fd5b5081356001600160401b038111156149b257600080fd5b6020830191508360208260051b85010111156149cd57600080fd5b9250929050565b600080602083850312156149e757600080fd5b82356001600160401b038111156149fd57600080fd5b614a0985828601614989565b90969095509350505050565b8151610ce0820190826000805b600a808210614a315750614a6f565b845184845b83811015614a54578251825260209283019290910190600101614a36565b50505060209490940193506101409290920191600101614a22565b505050506020830151610c808301526040830151610ca08301526060909201511515610cc09091015290565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614ad957614ad9614a9b565b604052919050565b60006001600160401b03821115614afa57614afa614a9b565b5060051b60200190565b600082601f830112614b1557600080fd5b81356020614b2a614b2583614ae1565b614ab1565b82815260059290921b84018101918181019086841115614b4957600080fd5b8286015b84811015614b645780358352918301918301614b4d565b509695505050505050565b60008060008060808587031215614b8557600080fd5b8435935060208501356001600160401b03811115614ba257600080fd5b614bae87828801614b04565b949794965050505060408301359260600135919050565b600080600060608486031215614bda57600080fd5b505081359360208301359350604090920135919050565b60008060408385031215614c0457600080fd5b8235915060208301356001600160401b0381168114614c2257600080fd5b809150509250929050565b60008060408385031215614c4057600080fd5b50508035926020909101359150565b600080600080600060608688031215614c6757600080fd5b8535945060208601356001600160401b0380821115614c8557600080fd5b614c9189838a01614989565b90965094506040880135915080821115614caa57600080fd5b50614cb788828901614989565b969995985093965092949392505050565b600080600060408486031215614cdd57600080fd5b83356001600160401b0380821115614cf457600080fd5b614d0087838801614989565b9095509350602091508582013581811115614d1a57600080fd5b86019050601f81018713614d2d57600080fd5b8035614d3b614b2582614ae1565b81815260059190911b82018301908381019089831115614d5a57600080fd5b928401925b82841015614d7857833582529284019290840190614d5f565b80955050505050509250925092565b81511515815261018081016020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e083015261010080840151614df3828501826001600160401b03169052565b5050610120838101516001600160401b0390811691840191909152610140808501518216908401526101609384015116929091019190915290565b801515811461121857600080fd5b60008060408385031215614e4f57600080fd5b8235614e5a816148ea565b91506020830135614c2281614e2e565b60006001600160401b03821115614e8357614e83614a9b565b50601f01601f191660200190565b60008060008060808587031215614ea757600080fd5b8435614eb2816148ea565b93506020850135614ec2816148ea565b92506040850135915060608501356001600160401b03811115614ee457600080fd5b8501601f81018713614ef557600080fd5b8035614f03614b2582614e6a565b818152886020838501011115614f1857600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60008060408385031215614f4d57600080fd5b8235614f58816148ea565b915060208301356001600160401b03811115614f7357600080fd5b614f7f85828601614b04565b9150509250929050565b60008060408385031215614f9c57600080fd5b8235614fa7816148ea565b91506020830135614c22816148ea565b600181811c90821680614fcb57607f821691505b60208210811415614fec57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60006001600160401b038083168181141561505a5761505a615027565b6001019392505050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60008160001904831182151516156150cf576150cf615027565b500290565b600082198211156150e7576150e7615027565b500190565b6000828210156150fe576150fe615027565b500390565b60208082526019908201527f416c6c205068617365203120746f6b656e73206d696e74656400000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561516257600080fd5b815161485f816148ea565b6020808252600990820152682737ba1037bbb732b960b91b604082015260600190565b60208082526025908201527f6c656e677468206f6620747970657320646f6573206e6f74206d6174636820616040820152641b5bdd5b9d60da1b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b60006001600160401b0380841680615205576152056151d5565b92169190910692915050565b60006001600160401b038084168061522b5761522b6151d5565b92169190910492915050565b60208082526029908201527f4e6f7420656e6f756768202449424f4f20746f206d696e742074686973206d616040820152686e7920746f6b656e7360b81b606082015260800190565b60006001600160401b03838116908316818110156152a0576152a0615027565b039392505050565b6000826152b7576152b76151d5565b500490565b60006000198214156152d0576152d0615027565b5060010190565b6000602082840312156152e957600080fd5b5051919050565b60006020828403121561530257600080fd5b815161485f81614e2e565b60008261531c5761531c6151d5565b500690565b60006020828403121561533357600080fd5b81516001600160401b0381111561534957600080fd5b8201601f8101841361535a57600080fd5b8051615368614b2582614e6a565b81815285602083850101111561537d57600080fd5b61538e826020830160208601614866565b95945050505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061546790830184614892565b9695505050505050565b60006020828403121561548357600080fd5b815161485f8161482c565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220862c4f456d997eed612ebc7562765181b235757867fdb20a1646b7120b20e11964736f6c634300080a0033

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