Contract 0xed150fd37edc030492dc7efdb8eb626e2bc8497a

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x5da114919f3e9420085cbee67b076e5456b80db6e5a13fca7615eebb9f123efd0x60806040173757442022-07-10 14:36:21201 days 1 min ago0xa515f06827844e15a3cfeb399a8096f01df7f349 IN  Create: BobotGenesisV20 ETH0.011188093866 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x22723d601863e80132ab0bb005beb01aa310162a10915bab3527e751c6882138558348952023-01-27 10:32:264 hrs 5 mins ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x22723d601863e80132ab0bb005beb01aa310162a10915bab3527e751c6882138558348952023-01-27 10:32:264 hrs 5 mins ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x10090e60eeb3e5f35ae1cd1aa5348de2b08415c1490af217cf5d2a26254c2a96558345872023-01-27 10:30:494 hrs 7 mins ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x56534de9d8390b9b0d2f95debdf12a331ed8f95549441819bf6d652b1552a521554966222023-01-26 1:45:571 day 12 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0xe9fd56d811b7af2d8325e049db253095daed2d64c73d983d5972ea066f48eee4552473162023-01-24 23:50:022 days 14 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0xfb13a6a83483370a8acdd6cf2ce7f0986b6a0165f49143dd0831005762cc7c96548662342023-01-23 7:32:194 days 7 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x98f7a2cc0c8a97fd0b260484677cc058b87428908176668d96bd80d9b6162980547732692023-01-22 18:52:464 days 19 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0xe3a089a5d8254e2927c4edc3a232179d514d00da92143d29b001b2b6c6d55d46547497952023-01-22 16:26:104 days 22 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0xe3a089a5d8254e2927c4edc3a232179d514d00da92143d29b001b2b6c6d55d46547497952023-01-22 16:26:104 days 22 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x40376a6fc0623087360bac587cf951cca0527533eda4ce45f535aa96e4c629da546881212023-01-22 10:19:315 days 4 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x6a110286d4de63397c6300575eb254b24005a192a60f77284e6098b07eeda90e546711482023-01-22 8:24:495 days 6 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x6a110286d4de63397c6300575eb254b24005a192a60f77284e6098b07eeda90e546711482023-01-22 8:24:495 days 6 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x87eec885cf808353d630020cba75a3cf224fc63e699cc599d749634f71e4755c546711302023-01-22 8:24:395 days 6 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x2af219f61931fbbc7fa9e0b426cafdb99eec5a280fbc4a2ff8c4d564c7a8e038545954912023-01-21 22:45:375 days 15 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x26d709c622d6c26fc92c7ab22973bf030542bc63d3704edf4363beae75f266a5544516152023-01-21 7:13:306 days 7 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0xf00beaac328cb07b9ba0ab5dafe6eab02b9f06160ce8584c9b27e56510f49bda544515472023-01-21 7:13:076 days 7 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0xf00beaac328cb07b9ba0ab5dafe6eab02b9f06160ce8584c9b27e56510f49bda544515472023-01-21 7:13:076 days 7 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0xf573c3f8ee7c873e34700e297be800994008721ace97d68cd2a72a48fd1ff712544344292023-01-21 4:55:366 days 9 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0xfa700f172475ce88eb9feaceeda0ff759161ca358484e2a702601d6183387f51544343962023-01-21 4:55:206 days 9 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x3a36111749da81bf6255ab57f234e83431d2792683ede4f87048281a0a5d57e5542715622023-01-20 11:23:167 days 3 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x4241a55726c16706cc0d52cf453d596603c170a037f7e6d6f7ce70822f9b2d73542712142023-01-20 11:20:377 days 3 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x78b340ff15f916f0746e4a335b8173622c493dd6d6996de7ecd56769e1f996d0542552372023-01-20 9:24:327 days 5 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0xdf9b6213b069d786607c45fd041c086d0bd75695e413ebd9b5c9807828e79a6b542357752023-01-20 6:57:477 days 7 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x6479e5ea507c4bcf0e0731080e507c42b3b396abcff82ccbb0dd34e3071f7e01540637682023-01-19 9:26:048 days 5 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
0x6479e5ea507c4bcf0e0731080e507c42b3b396abcff82ccbb0dd34e3071f7e01540637682023-01-19 9:26:048 days 5 hrs ago 0x5656360984f487aabbe5f6153e15c9f9768d09d9 0xed150fd37edc030492dc7efdb8eb626e2bc8497a0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BobotGenesisV2

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 29 : BobotGenesisV2.sol
// SPDX-License-Identifier: MIT

//,,,,,,,,,,,,,,,,,,,***************************************,*,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,**,,,,***********************,*,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,****,,,*,,,**,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,((*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*%%#(*/&%( #( %#.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*###(*....         #(,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,(###(,,...          .,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.,(#%%(*,,,...         ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/#%%%#**,,,,,... ,,   ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/###((/**,,,,*,,,,,*.  ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(##((#%%%%%##//##((/( ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*((/*........      .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(%&&&&&&&&&&&&&%%%%%%%%%#/,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,********,,,....                ,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,#(/,,,,,,*@%(#%%%%%&&&&&&&&%%%%%%%(((//,..  /,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,##(/,,&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%/*,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,##,.,*/((##(((//****,,,....                  .,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,((* .(####(***,,,,,#%%%%%%%%%%%%%#####%%%%%%((/,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,*&(%%#%%%%###(((((//#%%%######%%%%%%%###########, ,,,,,,,,,,,,,,
//*,,,,,,,,,,,,,,,,((%%%%%%%%###((((//#%%#(    .(##%########(/   (. ,,,,,,,,,,,,,,
//*,*,,,,,,,,,,,,,,/#%%%%%%%####((((//#%%#(    ,(#####   .(#(/   (. ,,,,,,,,,,,,,,
//*******,,,,,*/ .,(&(#%%%%%%###((((//#%%%%#####%%%%%%%%%%%#######, ,,,,,,,,,,,,,,
//********,*,///  ,/##&####(///*****(##%%%%%%%%%%%%%%%%%%%%%%##### ,,,,,,,,,,,,,,,
//********,*/(//  ,,##/.,,,,,,,,,,,,,,,,,*((*,,,,,,,,,,,,(     .*.,,,,,,,,,,,,,,,,
//**********(((*   *,,,..*(/,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,#(#(/,   ,,,,,,,,,,,,,,,
//*********&&&%*,  ,**((((#(//,/(%&&&%/*,   .%%%%%   ,*,#%## ((,,  (#/,,,,,,,,,,,,
//*********&&&&(##((,.,%%%%(*. ,#%##&&&&((    #%%%%.   ##%/.#/,   *,.. .,,,,,,,,,,
//*********@@@&#%(/*,..%@&%#/, .%%###((*, (&& . .**/(&&     /#(.  (*,. .,,,,,,,*,,
//********(@@@&#%(/*,..***/%%#* .%%%###((////*  %#((((///* .*%#/  #/*,..*,,,,*****
//********(&&@&#%(/*,.*******#.((%%%%%##////((((%#(/**//((((*,%%%#%(*,.***********
//*********#####%(/*,,*******#*(%%%%%%%########***%%%%%%%#/****%%#%%/,,,**********
//                      ____   ____  ____   ____ _______ _____                  //
//                     |  _ \ / __ \|  _ \ / __ \__   __/ ____|                 //
//                     | |_) | |  | | |_) | |  | | | | | (___                   //
//                     |  _ <| |  | |  _ <| |  | | | |  \___ \                  //
//                     | |_) | |__| | |_) | |__| | | |  ____)                   //
//                     |____/ \____/|____/ \____/  |_| |_____/                  //
//////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.13;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";

//other staking contracts
import "./interfaces/IBobot.sol";
import "./InstallationCoreChamber.sol";


contract BobotGenesisV2 is IBobot, ERC721EnumerableUpgradeable, OwnableUpgradeable 
{
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using AddressUpgradeable for address;
    using CountersUpgradeable for CountersUpgradeable.Counter;
    using StringsUpgradeable for uint256;

    //revealed and unrevealed uri
    string public baseRevealedURI;
    string public baseHiddenURI;

    string public baseExtention;
    uint256 constant maxSupply = 4040;
    uint256 public maxLevelAmount;

    //reveal whitelist variables
    bool public revealed;

    //root hash for merkle proof
    bytes32 public rootGuardiansHash_1;
    bytes32 public rootGuardiansHash_2;
    bytes32 public rootLunarsHash;

    //core chamber level update cost
    uint256 public coreChamberLevelCost;

    //token id counter
    CountersUpgradeable.Counter private _tokenIdCounter;

    //level cost
    uint256 levelCost;

    //amount mintable per whitelist
    mapping(address => bool) public whitelistedAddressesClaimed;

    //core chamber
    CoreChamber public coreChamber;

    //is the contract mint running
    bool public paused;

    //core points on a per bobot basis
    //one bobot -> core point
    mapping(uint256 => uint256) public bobotCorePoints;


    function initialize() external initializer 
    {
        __ERC721Enumerable_init();
        __Ownable_init();

        baseExtention = ""; 
        maxLevelAmount = 10; 
        revealed = false; 
        paused = false;
    }
    
    //modifiers
    /**************************************************************************/
    /*!
       \brief only core chamber can access this function
    */
    /**************************************************************************/
    modifier onlyCoreChamber() {
        require(msg.sender == address(coreChamber), "Bobots: !CoreChamber");
        _;
    }

    /**************************************************************************/
    /*!
       \brief view URI reveal / hidden
    */
    /**************************************************************************/
    function _baseURI() internal view virtual override returns (string memory) {
        return revealed ? baseRevealedURI : baseHiddenURI; // return own base URI
    }

    // public
    /**************************************************************************/
    /*!
       \brief mint a bobot - multiple things to check 
       does user have $MAGIC in their wallet?
    */
    /**************************************************************************/
    function mintBobot(
        bytes32[] calldata _merkleProof
    ) public payable {
        //is contract running?
        require(!paused);
       
        uint256 mintCount = 0;
        
        //minter must be whitelisted

        // check if user already white listed either as a guardian or lunar
        require(
             whitelistedAddressesClaimed[msg.sender] == false,
            "user already whitelisted"
        );

        bytes32 leaf = keccak256(abi.encodePacked(msg.sender));

        bool isGuardiansGroup_1 = MerkleProof.verify( _merkleProof, rootGuardiansHash_1, leaf );
        bool isGuardiansGroup_2 = MerkleProof.verify( _merkleProof, rootGuardiansHash_2, leaf );
        bool isLunars = MerkleProof.verify(_merkleProof, rootLunarsHash, leaf);

        //check if leaf is valid
        require(
            isGuardiansGroup_1 || isGuardiansGroup_2 || isLunars,
            "Invalid proof - not whitelisted"
        );

        //guardians will have 1 mint
        //lunars will have 2 mint

        if (isGuardiansGroup_1 || isGuardiansGroup_2 ) {
            require(_getNextTokenId() <= maxSupply);
            mintCount = 1;
        }

        if (isLunars) {
            require(_getNextTokenId() + 1 <= maxSupply);
            mintCount = 2;
        }

        //user claimed WL
        whitelistedAddressesClaimed[msg.sender] = true;

        for (uint256 i = 1; i <= mintCount; ++i) {
            uint256 nextTokenId = _getNextTokenId();
            _safeMint(msg.sender, nextTokenId);
        }
    }
    /**************************************************************************/
    /*!
       \brief get bobots type
    */
    /**************************************************************************/

    function getBobotType()
        external
        view
        override
        returns (BobotType)
    {
        return BobotType.BOBOT_GEN;
    }

    /**************************************************************************/
    /*!
       \brief return all token ids a holder owns
    */
    /**************************************************************************/
    function getTokenIds(address _owner)
        public
        view
        returns (uint256[] memory)
    {
        uint256 t = ERC721Upgradeable.balanceOf(_owner);
        uint256[] memory _tokensOfOwner = new uint256[](t);

        for (uint256 i = 0; i < ERC721Upgradeable.balanceOf(_owner); i++) {
            _tokensOfOwner[i] = ERC721EnumerableUpgradeable.tokenOfOwnerByIndex(
                _owner,
                i
            );
        }
        return (_tokensOfOwner);
    }

    /**************************************************************************/
    /*!
       \brief return URI of a token - could be revealed or hidden
    */
    /**************************************************************************/
    function getTokenURI(uint256 tokenID)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(
            _exists(tokenID),
            "ERC721Metadata: URI query for nonexistent token"
        );

        string memory currentBaseURI = _baseURI();

        string memory revealedURI = string(
            abi.encodePacked(
                baseRevealedURI,
                tokenID.toString(),
                "/",
                getCurrentBobotLevel(tokenID).toString(),
                baseExtention
            )
        );

        return 
            bytes(currentBaseURI).length > 0
                ? (revealed ? revealedURI : baseHiddenURI)
                : "";
    }
    /**************************************************************************/
    /*!
       \brief return URI of a token - could be revealed or hidden
    */
    /**************************************************************************/
    function tokenURI(uint256 tokenID)
        public
        view
        virtual
        override
        returns (string memory)
    {
        return getTokenURI(tokenID);
    }
    /**************************************************************************/
    /*!
       \brief get next token id
    */
    /**************************************************************************/
    function _getNextTokenId() private view returns (uint256) {
        return (_tokenIdCounter.current() + 1);
    }
    /**************************************************************************/
    /*!
       \brief safe mint
    */
    /**************************************************************************/
    function _safeMint(address to, uint256 tokenId)
        internal
        override(ERC721Upgradeable)
    {
        super._safeMint(to, tokenId);
        _tokenIdCounter.increment();
    }

    /**************************************************************************/
    /*!
       \brief returns the bobots current level
    */
    /**************************************************************************/
    function getCurrentBobotLevel(uint256 _tokenID) 
        public 
        view 
        returns (uint256)
    {
        return  Math.min(
         coreChamber.corePointsEarnedGenesis(_tokenID) / coreChamberLevelCost,
            maxLevelAmount
        );
    }
    /**************************************************************************/
    /*!
       \brief check if WL is claimed
    */
    /**************************************************************************/
    function checkClaimed(address _claimed) external view  returns (bool) {
       return whitelistedAddressesClaimed[_claimed];
    }
    /**************************************************************************/
    /*!
       \brief earning core points logic
    */
    /**************************************************************************/
    function coreChamberCorePointUpdate(uint256 _tokenId, uint256 _coreEarned)
        external
        onlyCoreChamber
    {
        bobotCorePoints[_tokenId] += _coreEarned;
    }

    //------------------------- ADMIN FUNCTIONS -----------------------------------


    /**************************************************************************/
    /*!
       \brief airdrop
    */
    /**************************************************************************/

    function airdrop(address _to, uint256 _amount) public onlyOwner
    {
        require(_getNextTokenId() + _amount < maxSupply);
        for (uint256 i = 1; i <= _amount; ++i) 
        {
            uint256 nextTokenId = _getNextTokenId();
            _safeMint(_to, nextTokenId);
        }
    }

    /**************************************************************************/
    /*!
       \brief set merkleproof hash
    */
    /**************************************************************************/
    function setRootGuardiansHash_1(bytes32 _rootHash) external onlyOwner {
        rootGuardiansHash_1 = _rootHash;
    }
    /**************************************************************************/
    /*!
       \brief set merkleproof hash
    */
    /**************************************************************************/
    function setRootGuardiansHash_2(bytes32 _rootHash) external onlyOwner {
        rootGuardiansHash_2 = _rootHash;
    }
    /**************************************************************************/
    /*!
       \brief set merkleproof hash
    */
    /**************************************************************************/
    function setRootLunarsHash(bytes32 _rootHash) external onlyOwner {
        rootLunarsHash = _rootHash;
    }

    /**************************************************************************/
    /*!
       \brief enable reveal phase
    */
    /**************************************************************************/
    function reveal(bool _revealed) external onlyOwner {
        revealed = _revealed;
    }
    /**************************************************************************/
    /*!
       \brief set core chamber level up cost
    */
    /**************************************************************************/
    function setCoreChamberLevelCost(uint256 _cost) external onlyOwner {
        coreChamberLevelCost = _cost;
    }
    /**************************************************************************/
    /*!
       \brief set Core Chamber Contract
    */
    /**************************************************************************/
    function setCoreChamber(address _coreChamber) external onlyOwner {
        coreChamber = CoreChamber(_coreChamber);
    }

    /**************************************************************************/
    /*!
       \brief set base URI
    */
    /**************************************************************************/
    function setBaseRevealedURI(string memory _newBaseURI) public onlyOwner {
        baseRevealedURI = _newBaseURI;
    }

    /**************************************************************************/
    /*!
       \brief set base URI
    */
    /**************************************************************************/
    function setBaseHiddenURI(string memory _newBaseURI) public onlyOwner {
        baseHiddenURI = _newBaseURI;
    }
    /**************************************************************************/
    /*!
       \brief set Base Extensions
    */
    /**************************************************************************/
    function setBaseExtentions(string memory _newBaseExtentions)
        public
        onlyOwner
    {
        baseExtention = _newBaseExtentions;
    }
    /**************************************************************************/
    /*!
       \brief before token transfer
    */
    /**************************************************************************/
    function _beforeTokenTransfer(
        address _from,
        address _to,
        uint256 _tokenId
    ) internal override {

        super._beforeTokenTransfer(_from, _to, _tokenId);

        if (address(coreChamber) != address(0))
            require(!coreChamber.isAtCoreChamberGenesis(_tokenId), "Genesis: at core chamber. Unstake to transfer.");
    }

    /**************************************************************************/
    /*!
       \brief set Max Level
    */
    /**************************************************************************/
    function setMaxLevel(uint256 _newLevelAmount)
        public
        onlyOwner
    {
        maxLevelAmount = _newLevelAmount;
    }

    /**************************************************************************/
    /*!
       \brief pause smart contract (for safety purposes)
    */
    /**************************************************************************/
    function pause(bool _state) public onlyOwner {
        paused = _state;
    }
}

File 2 of 29 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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);

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

File 3 of 29 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 4 of 29 : 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 5 of 29 : 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;
}

File 6 of 29 : CountersUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library CountersUpgradeable {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

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

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

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

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

File 7 of 29 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle 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 8 of 29 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

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

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

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

File 9 of 29 : 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 10 of 29 : IBobot.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.13;

interface IBobot 
{
    enum BobotType
    {
        BOBOT_GEN,
        BOBOT_NANO,
        BOBOT_MEGA
    }

    struct UserInfo
    {
        uint256 numberofBobots;
        uint256 magicinWallet;
        BobotType bobotType;
    }

    // ------------------ VIEW FUNCTIONS -----------------
    function getBobotType() external view returns (BobotType);
    function getTokenURI(uint256 _tokenID) external view returns (string memory);
}

File 11 of 29 : InstallationCoreChamber.sol
// SPDX-License-Identifier: MIT

//,,,,,,,,,,,,,,,,,,,***************************************,*,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,**,,,,***********************,*,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,****,,,*,,,**,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,((*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*%%#(*/&%( #( %#.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*###(*....         #(,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,(###(,,...          .,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.,(#%%(*,,,...         ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/#%%%#**,,,,,... ,,   ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/###((/**,,,,*,,,,,*.  ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(##((#%%%%%##//##((/( ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*((/*........      .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(%&&&&&&&&&&&&&%%%%%%%%%#/,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,********,,,....                ,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,#(/,,,,,,*@%(#%%%%%&&&&&&&&%%%%%%%(((//,..  /,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,##(/,,&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%/*,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,##,.,*/((##(((//****,,,....                  .,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,((* .(####(***,,,,,#%%%%%%%%%%%%%#####%%%%%%((/,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,*&(%%#%%%%###(((((//#%%%######%%%%%%%###########, ,,,,,,,,,,,,,,
//*,,,,,,,,,,,,,,,,((%%%%%%%%###((((//#%%#(    .(##%########(/   (. ,,,,,,,,,,,,,,
//*,*,,,,,,,,,,,,,,/#%%%%%%%####((((//#%%#(    ,(#####   .(#(/   (. ,,,,,,,,,,,,,,
//*******,,,,,*/ .,(&(#%%%%%%###((((//#%%%%#####%%%%%%%%%%%#######, ,,,,,,,,,,,,,,
//********,*,///  ,/##&####(///*****(##%%%%%%%%%%%%%%%%%%%%%%##### ,,,,,,,,,,,,,,,
//********,*/(//  ,,##/.,,,,,,,,,,,,,,,,,*((*,,,,,,,,,,,,(     .*.,,,,,,,,,,,,,,,,
//**********(((*   *,,,..*(/,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,#(#(/,   ,,,,,,,,,,,,,,,
//*********&&&%*,  ,**((((#(//,/(%&&&%/*,   .%%%%%   ,*,#%## ((,,  (#/,,,,,,,,,,,,
//*********&&&&(##((,.,%%%%(*. ,#%##&&&&((    #%%%%.   ##%/.#/,   *,.. .,,,,,,,,,,
//*********@@@&#%(/*,..%@&%#/, .%%###((*, (&& . .**/(&&     /#(.  (*,. .,,,,,,,*,,
//********(@@@&#%(/*,..***/%%#* .%%%###((////*  %#((((///* .*%#/  #/*,..*,,,,*****
//********(&&@&#%(/*,.*******#.((%%%%%##////((((%#(/**//((((*,%%%#%(*,.***********
//*********#####%(/*,,*******#*(%%%%%%%########***%%%%%%%#/****%%#%%/,,,**********
//                      ____   ____  ____   ____ _______ _____                  //
//                     |  _ \ / __ \|  _ \ / __ \__   __/ ____|                 //
//                     | |_) | |  | | |_) | |  | | | | | (___                   //
//                     |  _ <| |  | |  _ <| |  | | | |  \___ \                  //
//                     | |_) | |__| | |_) | |__| | | |  ____)                   //
//                     |____/ \____/|____/ \____/  |_| |_____/                  //
//////////////////////////////////////////////////////////////////////////////////

pragma solidity ^0.8.13;
import "@openzeppelin/contracts/access/Ownable.sol";

//import Bobot genesis
import "./BobotGenesis.sol";
import "./BobotMegaBot.sol";
import "./interfaces/IBobot.sol";

contract CoreChamber is OwnableUpgradeable
{
    uint256 public constant WEEK = 7 days;

    uint256 public corePointsPerWeekGenesis;
    uint256 public corePointsPerWeekMegabot;

    uint256 constant maxGenesisSupply = 4040;
    uint256 constant maxMegabotSupply = 1000;
    //bobots genesis contract
    BobotGenesis public bobotGenesis;

    //bobots megabots contract 
    BobotMegaBot public bobotMegabot;
   
    uint256 public totalCorePointsStored;

    uint256 public lastRewardTimestamp;

    uint256 public genesisSupply;
    uint256 public megabotSupply;

    mapping(uint256 => uint256) public genesisTimestampJoined;
    mapping(uint256 => uint256) public megabotTimestampJoined;

    function initialize() external initializer 
    {
        __Ownable_init();
    }

    modifier atCoreChamberGenesis(uint256 _tokenId, bool atCore) {
        require(isAtCoreChamberGenesis(_tokenId) == atCore, "Core chamber: wrong attendance");
        _;
    }
    function isAtCoreChamberGenesis(uint256 _tokenId) public view returns (bool) {
        return genesisTimestampJoined[_tokenId] > 0;
    }
    modifier atCoreChamberMegabot(uint256 _tokenId, bool atCore) {
        require(isAtCoreChamberMegabot(_tokenId) == atCore, "Core chamber: wrong attendance");
        _;
    }
    function isAtCoreChamberMegabot(uint256 _tokenId) public view returns (bool) {
        return megabotTimestampJoined[_tokenId] > 0;
    }
    modifier onlyGenesisOwner(uint256 _tokenId) {
        require(bobotGenesis.ownerOf(_tokenId) == msg.sender, "Genesis: only owner can send to core chamber");
        _;
    }
    modifier onlyMegabotOwner(uint256 _tokenId) {
        require(bobotMegabot.ownerOf(_tokenId) == msg.sender, "Megabot: only megabot owner can send to core chamber");
        _;
    }
    /**************************************************************************/
    /*!
       \brief Update total core points
    */
    /**************************************************************************/
    modifier updateTotalCorePoints(bool isJoining, IBobot.BobotType _bobotType) {
        if (genesisSupply > 0) {
            totalCorePointsStored = totalCorePoints();
        }
        lastRewardTimestamp = block.timestamp;

        if(_bobotType == IBobot.BobotType.BOBOT_GEN)
            isJoining ? genesisSupply++ : genesisSupply--;
        if(_bobotType == IBobot.BobotType.BOBOT_MEGA)
            isJoining ? megabotSupply++ :  megabotSupply--;
        _;
    }
    /**************************************************************************/
    /*!
       \brief Total core points
    */
    /**************************************************************************/
    function totalCorePoints() public view returns (uint256) {
        uint256 timeDelta = block.timestamp - lastRewardTimestamp;
        return totalCorePointsStored +
         (genesisSupply * corePointsPerWeekGenesis * timeDelta / WEEK) + 
         (megabotSupply * corePointsPerWeekMegabot * timeDelta / WEEK);
    }

    /**************************************************************************/
    /*!
       \brief Core points earned
    */
    /**************************************************************************/
    function corePointsEarnedGenesis(uint256 _tokenId) public view 
    returns (uint256 points) 
    {
        if (genesisTimestampJoined[_tokenId] == 0) return 0;
        uint256 timedelta = block.timestamp -  genesisTimestampJoined[_tokenId];
        points = corePointsPerWeekGenesis * timedelta / WEEK;
    }
    /**************************************************************************/
    /*!
       \brief Core points earned
    */
    /**************************************************************************/
    function corePointsEarnedMegabot(uint256 _tokenId) public view 
    returns (uint256 points) 
    {
        if (megabotTimestampJoined[_tokenId] == 0) return 0;
        uint256 timedelta = block.timestamp -  megabotTimestampJoined[_tokenId];
        points = corePointsPerWeekMegabot * timedelta / WEEK;
    }
    /**************************************************************************/
    /*!
       \brief Stake Genesis
    */
    /**************************************************************************/
    function stakeGenesis(uint256 _tokenId)  
        external
        onlyGenesisOwner(_tokenId)
        atCoreChamberGenesis(_tokenId, false)
        updateTotalCorePoints(true,IBobot.BobotType.BOBOT_GEN) {
        genesisTimestampJoined[_tokenId] = block.timestamp;
    }
    /**************************************************************************/
    /*!
       \brief Unstake Genesis
    */
    /**************************************************************************/
    function unstakeGenesis(uint256 _tokenId) 
        external
        onlyGenesisOwner(_tokenId)
        atCoreChamberGenesis(_tokenId, true)
        updateTotalCorePoints(false,IBobot.BobotType.BOBOT_GEN)
        {
        bobotGenesis.coreChamberCorePointUpdate(_tokenId, corePointsEarnedGenesis(_tokenId));
        genesisTimestampJoined[_tokenId] = 0;
    }
    /**************************************************************************/
    /*!
       \brief Stake megabot
    */
    /**************************************************************************/
    function stakeMegabot(uint256 _tokenId)  
        external
        onlyMegabotOwner(_tokenId)
        atCoreChamberMegabot(_tokenId, false)
        updateTotalCorePoints(true,IBobot.BobotType.BOBOT_MEGA) {
        megabotTimestampJoined[_tokenId] = block.timestamp;
    }
    /**************************************************************************/
    /*!
       \brief Unstake megabot
    */
    /**************************************************************************/
    function unstakeMegabot(uint256 _tokenId) 
        external
        onlyMegabotOwner(_tokenId)
        atCoreChamberMegabot(_tokenId, true)
        updateTotalCorePoints(false,IBobot.BobotType.BOBOT_MEGA)
        {
        bobotMegabot.coreChamberCorePointUpdate(_tokenId, corePointsEarnedMegabot(_tokenId));
        megabotTimestampJoined[_tokenId] = 0;
    }
    
    /**************************************************************************/
    /*!
       \brief Set Bobot Genesis contract
    */
    /**************************************************************************/
    function UnstakeAllBobots()
        external
        onlyOwner{
        for (uint256 i; i < maxGenesisSupply; ++i)
        {
            if(isAtCoreChamberGenesis(i))
            {
                bobotGenesis.coreChamberCorePointUpdate(i, corePointsEarnedGenesis(i));
                genesisTimestampJoined[i] = 0;
                
            }
        }

        for (uint256 i; i < maxMegabotSupply; ++i)
        {
            if (isAtCoreChamberMegabot(i))
            {
                bobotMegabot.coreChamberCorePointUpdate(i, corePointsEarnedMegabot(i));
                megabotTimestampJoined[i] = 0;
                
            }
        }

        genesisSupply = 0;
        megabotSupply = 0;
    }

    //admin function

    /**************************************************************************/
    /*!
       \brief Set Bobot Genesis contract
    */
    /**************************************************************************/
    function setBobotGenesis(address _bobotGenesis) external onlyOwner {
        bobotGenesis = BobotGenesis(_bobotGenesis);
    }
    /**************************************************************************/
    /*!
       \brief Set Bobot Megabots contract
    */
    /**************************************************************************/
   function setBobotMegabot(address _bobotMegabot) external onlyOwner {
        bobotMegabot = BobotMegaBot(_bobotMegabot);
    }
    /**************************************************************************/
    /*!
       \brief Set how much core points genesis can earn
    */
    /**************************************************************************/
    function setCorePointsPerWeekGenesis(uint256 _corePointsPerWeekGenesis) external onlyOwner {
        corePointsPerWeekGenesis = _corePointsPerWeekGenesis;
    }
    /**************************************************************************/
    /*!
       \brief Set how much core points megabot can earn
    */
    /**************************************************************************/
    function setCorePointsPerWeekMegabot(uint256 _corePointsPerWeekMegabot) external onlyOwner {
        corePointsPerWeekMegabot = _corePointsPerWeekMegabot;
    }
}

File 12 of 29 : 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 13 of 29 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = 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 || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

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

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

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

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

        _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 14 of 29 : 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 15 of 29 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * 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 prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = _setInitializedVersion(1);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        bool isTopLevelCall = _setInitializedVersion(version);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(version);
        }
    }

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

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        _setInitializedVersion(type(uint8).max);
    }

    function _setInitializedVersion(uint8 version) private returns (bool) {
        // 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, and for the lowest level
        // of initializers, because in other contexts the contract may have been reentered.
        if (_initializing) {
            require(
                version == 1 && !AddressUpgradeable.isContract(address(this)),
                "Initializable: contract is already initialized"
            );
            return false;
        } else {
            require(_initialized < version, "Initializable: contract is already initialized");
            _initialized = version;
            return true;
        }
    }
}

File 16 of 29 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (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`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must 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 Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

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

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

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

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface 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 `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 18 of 29 : 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 29 : 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 20 of 29 : 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 21 of 29 : 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 22 of 29 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _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);
    }
}

File 23 of 29 : BobotGenesis.sol
// SPDX-License-Identifier: MIT

//,,,,,,,,,,,,,,,,,,,***************************************,*,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,**,,,,***********************,*,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,****,,,*,,,**,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,((*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*%%#(*/&%( #( %#.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*###(*....         #(,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,(###(,,...          .,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.,(#%%(*,,,...         ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/#%%%#**,,,,,... ,,   ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/###((/**,,,,*,,,,,*.  ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(##((#%%%%%##//##((/( ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*((/*........      .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(%&&&&&&&&&&&&&%%%%%%%%%#/,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,********,,,....                ,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,#(/,,,,,,*@%(#%%%%%&&&&&&&&%%%%%%%(((//,..  /,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,##(/,,&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%/*,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,##,.,*/((##(((//****,,,....                  .,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,((* .(####(***,,,,,#%%%%%%%%%%%%%#####%%%%%%((/,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,*&(%%#%%%%###(((((//#%%%######%%%%%%%###########, ,,,,,,,,,,,,,,
//*,,,,,,,,,,,,,,,,((%%%%%%%%###((((//#%%#(    .(##%########(/   (. ,,,,,,,,,,,,,,
//*,*,,,,,,,,,,,,,,/#%%%%%%%####((((//#%%#(    ,(#####   .(#(/   (. ,,,,,,,,,,,,,,
//*******,,,,,*/ .,(&(#%%%%%%###((((//#%%%%#####%%%%%%%%%%%#######, ,,,,,,,,,,,,,,
//********,*,///  ,/##&####(///*****(##%%%%%%%%%%%%%%%%%%%%%%##### ,,,,,,,,,,,,,,,
//********,*/(//  ,,##/.,,,,,,,,,,,,,,,,,*((*,,,,,,,,,,,,(     .*.,,,,,,,,,,,,,,,,
//**********(((*   *,,,..*(/,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,#(#(/,   ,,,,,,,,,,,,,,,
//*********&&&%*,  ,**((((#(//,/(%&&&%/*,   .%%%%%   ,*,#%## ((,,  (#/,,,,,,,,,,,,
//*********&&&&(##((,.,%%%%(*. ,#%##&&&&((    #%%%%.   ##%/.#/,   *,.. .,,,,,,,,,,
//*********@@@&#%(/*,..%@&%#/, .%%###((*, (&& . .**/(&&     /#(.  (*,. .,,,,,,,*,,
//********(@@@&#%(/*,..***/%%#* .%%%###((////*  %#((((///* .*%#/  #/*,..*,,,,*****
//********(&&@&#%(/*,.*******#.((%%%%%##////((((%#(/**//((((*,%%%#%(*,.***********
//*********#####%(/*,,*******#*(%%%%%%%########***%%%%%%%#/****%%#%%/,,,**********
//                      ____   ____  ____   ____ _______ _____                  //
//                     |  _ \ / __ \|  _ \ / __ \__   __/ ____|                 //
//                     | |_) | |  | | |_) | |  | | | | | (___                   //
//                     |  _ <| |  | |  _ <| |  | | | |  \___ \                  //
//                     | |_) | |__| | |_) | |__| | | |  ____)                   //
//                     |____/ \____/|____/ \____/  |_| |_____/                  //
//////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.13;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";

//other staking contracts
import "./interfaces/IBobot.sol";
import "./InstallationCoreChamber.sol";


contract BobotGenesis is IBobot, ERC721EnumerableUpgradeable, OwnableUpgradeable 
{
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using AddressUpgradeable for address;
    using CountersUpgradeable for CountersUpgradeable.Counter;
    using StringsUpgradeable for uint256;

    //revealed and unrevealed uri
    string public baseRevealedURI;
    string public baseHiddenURI;

    string public baseExtention;
    uint256 constant maxSupply = 4040;
    uint256 public maxLevelAmount;

    //reveal whitelist variables
    bool public revealed;

    //root hash for merkle proof
    bytes32 public rootGuardiansHash_1;
    bytes32 public rootGuardiansHash_2;
    bytes32 public rootLunarsHash;

    //core chamber level update cost
    uint256 public coreChamberLevelCost;

    //token id counter
    CountersUpgradeable.Counter private _tokenIdCounter;

    //level cost
    uint256 levelCost;

    //amount mintable per whitelist
    mapping(address => bool) public whitelistedAddressesClaimed;

    //core chamber
    CoreChamber public coreChamber;

    //is the contract mint running
    bool public paused;

    //core points on a per bobot basis
    //one bobot -> core point
    mapping(uint256 => uint256) public bobotCorePoints;


    function initialize() external initializer 
    {
        __ERC721Enumerable_init();
        __Ownable_init();

        baseExtention = ""; 
        maxLevelAmount = 10; 
        revealed = false; 
        paused = false;
    }
    
    //modifiers
    /**************************************************************************/
    /*!
       \brief only core chamber can access this function
    */
    /**************************************************************************/
    modifier onlyCoreChamber() {
        require(msg.sender == address(coreChamber), "Bobots: !CoreChamber");
        _;
    }

    /**************************************************************************/
    /*!
       \brief view URI reveal / hidden
    */
    /**************************************************************************/
    function _baseURI() internal view virtual override returns (string memory) {
        return revealed ? baseRevealedURI : baseHiddenURI; // return own base URI
    }

    // public
    /**************************************************************************/
    /*!
       \brief mint a bobot - multiple things to check 
       does user have $MAGIC in their wallet?
    */
    /**************************************************************************/
    function mintBobot(
        bytes32[] calldata _merkleProof
    ) public payable {
        //is contract running?
        require(!paused);
       
        uint256 mintCount = 0;
        
        //minter must be whitelisted

        // check if user already white listed either as a guardian or lunar
        require(
             whitelistedAddressesClaimed[msg.sender] == false,
            "user already whitelisted"
        );

        bytes32 leaf = keccak256(abi.encodePacked(msg.sender));

        bool isGuardiansGroup_1 = MerkleProof.verify( _merkleProof, rootGuardiansHash_1, leaf );
        bool isGuardiansGroup_2 = MerkleProof.verify( _merkleProof, rootGuardiansHash_2, leaf );
        bool isLunars = MerkleProof.verify(_merkleProof, rootLunarsHash, leaf);

        //check if leaf is valid
        require(
            isGuardiansGroup_1 || isGuardiansGroup_2 || isLunars,
            "Invalid proof - not whitelisted"
        );

        //guardians will have 1 mint
        //lunars will have 2 mint

        if (isGuardiansGroup_1 || isGuardiansGroup_2 ) {
            require(_getNextTokenId() <= maxSupply);
            mintCount = 1;
        }

        if (isLunars) {
            require(_getNextTokenId() + 1 <= maxSupply);
            mintCount = 2;
        }

        //user claimed WL
        whitelistedAddressesClaimed[msg.sender] = true;

        for (uint256 i = 1; i <= mintCount; ++i) {
            uint256 nextTokenId = _getNextTokenId();
            _safeMint(msg.sender, nextTokenId);
        }
    }
    /**************************************************************************/
    /*!
       \brief get bobots type
    */
    /**************************************************************************/

    function getBobotType()
        external
        view
        override
        returns (BobotType)
    {
        return BobotType.BOBOT_GEN;
    }

    /**************************************************************************/
    /*!
       \brief return all token ids a holder owns
    */
    /**************************************************************************/
    function getTokenIds(address _owner)
        public
        view
        returns (uint256[] memory)
    {
        uint256 t = ERC721Upgradeable.balanceOf(_owner);
        uint256[] memory _tokensOfOwner = new uint256[](t);

        for (uint256 i = 0; i < ERC721Upgradeable.balanceOf(_owner); i++) {
            _tokensOfOwner[i] = ERC721EnumerableUpgradeable.tokenOfOwnerByIndex(
                _owner,
                i
            );
        }
        return (_tokensOfOwner);
    }

    /**************************************************************************/
    /*!
       \brief return URI of a token - could be revealed or hidden
    */
    /**************************************************************************/
    function getTokenURI(uint256 tokenID)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(
            _exists(tokenID),
            "ERC721Metadata: URI query for nonexistent token"
        );

        string memory currentBaseURI = _baseURI();

        string memory revealedURI = string(
            abi.encodePacked(
                baseRevealedURI,
                tokenID.toString(),
                "/",
                getCurrentBobotLevel(tokenID).toString(),
                baseExtention
            )
        );

        return 
            bytes(currentBaseURI).length > 0
                ? (revealed ? revealedURI : baseHiddenURI)
                : "";
    }
    /**************************************************************************/
    /*!
       \brief return URI of a token - could be revealed or hidden
    */
    /**************************************************************************/
    function tokenURI(uint256 tokenID)
        public
        view
        virtual
        override
        returns (string memory)
    {
        return getTokenURI(tokenID);
    }
    /**************************************************************************/
    /*!
       \brief get next token id
    */
    /**************************************************************************/
    function _getNextTokenId() private view returns (uint256) {
        return (_tokenIdCounter.current() + 1);
    }
    /**************************************************************************/
    /*!
       \brief safe mint
    */
    /**************************************************************************/
    function _safeMint(address to, uint256 tokenId)
        internal
        override(ERC721Upgradeable)
    {
        super._safeMint(to, tokenId);
        _tokenIdCounter.increment();
    }

    /**************************************************************************/
    /*!
       \brief returns the bobots current level
    */
    /**************************************************************************/
    function getCurrentBobotLevel(uint256 _tokenID) 
        public 
        view 
        returns (uint256)
    {
        return  Math.min(
            bobotCorePoints[_tokenID] / coreChamberLevelCost,
            maxLevelAmount
        );
    }
    /**************************************************************************/
    /*!
       \brief check if WL is claimed
    */
    /**************************************************************************/
    function checkClaimed(address _claimed) external view  returns (bool) {
       return whitelistedAddressesClaimed[_claimed];
    }
    /**************************************************************************/
    /*!
       \brief earning core points logic
    */
    /**************************************************************************/
    function coreChamberCorePointUpdate(uint256 _tokenId, uint256 _coreEarned)
        external
        onlyCoreChamber
    {
        bobotCorePoints[_tokenId] += _coreEarned;
    }

    //------------------------- ADMIN FUNCTIONS -----------------------------------


    /**************************************************************************/
    /*!
       \brief airdrop
    */
    /**************************************************************************/

    function airdrop(address _to, uint256 _amount) public onlyOwner
    {
        require(_getNextTokenId() + _amount < maxSupply);
        for (uint256 i = 1; i <= _amount; ++i) 
        {
            uint256 nextTokenId = _getNextTokenId();
            _safeMint(_to, nextTokenId);
        }
    }

    /**************************************************************************/
    /*!
       \brief set merkleproof hash
    */
    /**************************************************************************/
    function setRootGuardiansHash_1(bytes32 _rootHash) external onlyOwner {
        rootGuardiansHash_1 = _rootHash;
    }
    /**************************************************************************/
    /*!
       \brief set merkleproof hash
    */
    /**************************************************************************/
    function setRootGuardiansHash_2(bytes32 _rootHash) external onlyOwner {
        rootGuardiansHash_2 = _rootHash;
    }
    /**************************************************************************/
    /*!
       \brief set merkleproof hash
    */
    /**************************************************************************/
    function setRootLunarsHash(bytes32 _rootHash) external onlyOwner {
        rootLunarsHash = _rootHash;
    }

    /**************************************************************************/
    /*!
       \brief enable reveal phase
    */
    /**************************************************************************/
    function reveal(bool _revealed) external onlyOwner {
        revealed = _revealed;
    }
    /**************************************************************************/
    /*!
       \brief set core chamber level up cost
    */
    /**************************************************************************/
    function setCoreChamberLevelCost(uint256 _cost) external onlyOwner {
        coreChamberLevelCost = _cost;
    }
    /**************************************************************************/
    /*!
       \brief set Core Chamber Contract
    */
    /**************************************************************************/
    function setCoreChamber(address _coreChamber) external onlyOwner {
        coreChamber = CoreChamber(_coreChamber);
    }

    /**************************************************************************/
    /*!
       \brief set base URI
    */
    /**************************************************************************/
    function setBaseRevealedURI(string memory _newBaseURI) public onlyOwner {
        baseRevealedURI = _newBaseURI;
    }

    /**************************************************************************/
    /*!
       \brief set base URI
    */
    /**************************************************************************/
    function setBaseHiddenURI(string memory _newBaseURI) public onlyOwner {
        baseHiddenURI = _newBaseURI;
    }
    /**************************************************************************/
    /*!
       \brief set Base Extensions
    */
    /**************************************************************************/
    function setBaseExtentions(string memory _newBaseExtentions)
        public
        onlyOwner
    {
        baseExtention = _newBaseExtentions;
    }
    /**************************************************************************/
    /*!
       \brief before token transfer
    */
    /**************************************************************************/
    function _beforeTokenTransfer(
        address _from,
        address _to,
        uint256 _tokenId
    ) internal override {

        super._beforeTokenTransfer(_from, _to, _tokenId);

        if (address(coreChamber) != address(0))
            require(!coreChamber.isAtCoreChamberGenesis(_tokenId), "Genesis: at core chamber. Unstake to transfer.");
    }

    /**************************************************************************/
    /*!
       \brief set Max Level
    */
    /**************************************************************************/
    function setMaxLevel(uint256 _newLevelAmount)
        public
        onlyOwner
    {
        maxLevelAmount = _newLevelAmount;
    }

    /**************************************************************************/
    /*!
       \brief pause smart contract (for safety purposes)
    */
    /**************************************************************************/
    function pause(bool _state) public onlyOwner {
        paused = _state;
    }
}

File 24 of 29 : BobotMegaBot.sol
// SPDX-License-Identifier: MIT

//,,,,,,,,,,,,,,,,,,,***************************************,*,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,**,,,,***********************,*,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,****,,,*,,,**,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,((*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*%%#(*/&%( #( %#.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*###(*....         #(,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,(###(,,...          .,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.,(#%%(*,,,...         ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/#%%%#**,,,,,... ,,   ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/###((/**,,,,*,,,,,*.  ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(##((#%%%%%##//##((/( ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*((/*........      .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(%&&&&&&&&&&&&&%%%%%%%%%#/,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,********,,,....                ,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,#(/,,,,,,*@%(#%%%%%&&&&&&&&%%%%%%%(((//,..  /,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,##(/,,&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%/*,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,##,.,*/((##(((//****,,,....                  .,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,((* .(####(***,,,,,#%%%%%%%%%%%%%#####%%%%%%((/,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,*&(%%#%%%%###(((((//#%%%######%%%%%%%###########, ,,,,,,,,,,,,,,
//*,,,,,,,,,,,,,,,,((%%%%%%%%###((((//#%%#(    .(##%########(/   (. ,,,,,,,,,,,,,,
//*,*,,,,,,,,,,,,,,/#%%%%%%%####((((//#%%#(    ,(#####   .(#(/   (. ,,,,,,,,,,,,,,
//*******,,,,,*/ .,(&(#%%%%%%###((((//#%%%%#####%%%%%%%%%%%#######, ,,,,,,,,,,,,,,
//********,*,///  ,/##&####(///*****(##%%%%%%%%%%%%%%%%%%%%%%##### ,,,,,,,,,,,,,,,
//********,*/(//  ,,##/.,,,,,,,,,,,,,,,,,*((*,,,,,,,,,,,,(     .*.,,,,,,,,,,,,,,,,
//**********(((*   *,,,..*(/,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,#(#(/,   ,,,,,,,,,,,,,,,
//*********&&&%*,  ,**((((#(//,/(%&&&%/*,   .%%%%%   ,*,#%## ((,,  (#/,,,,,,,,,,,,
//*********&&&&(##((,.,%%%%(*. ,#%##&&&&((    #%%%%.   ##%/.#/,   *,.. .,,,,,,,,,,
//*********@@@&#%(/*,..%@&%#/, .%%###((*, (&& . .**/(&&     /#(.  (*,. .,,,,,,,*,,
//********(@@@&#%(/*,..***/%%#* .%%%###((////*  %#((((///* .*%#/  #/*,..*,,,,*****
//********(&&@&#%(/*,.*******#.((%%%%%##////((((%#(/**//((((*,%%%#%(*,.***********
//*********#####%(/*,,*******#*(%%%%%%%########***%%%%%%%#/****%%#%%/,,,**********
//                      ____   ____  ____   ____ _______ _____                  //
//                     |  _ \ / __ \|  _ \ / __ \__   __/ ____|                 //
//                     | |_) | |  | | |_) | |  | | | | | (___                   //
//                     |  _ <| |  | |  _ <| |  | | | |  \___ \                  //
//                     | |_) | |__| | |_) | |__| | | |  ____)                   //
//                     |____/ \____/|____/ \____/  |_| |_____/                  //
//////////////////////////////////////////////////////////////////////////////////
pragma solidity ^0.8.13;
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";

//other staking contracts
import "./interfaces/IBobot.sol";
import "./InstallationCoreChamber.sol";

//$MAGIC transactions
import "./Magic20.sol";

contract BobotMegaBot is IBobot, ERC721EnumerableUpgradeable, OwnableUpgradeable
{
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using AddressUpgradeable for address;
    using CountersUpgradeable for CountersUpgradeable.Counter;
    using StringsUpgradeable for uint256;

    //magic contract
    IERC20Upgradeable public magic;

    uint256 currencyExchange = (10**9);
    uint256 magicBalanceCost = 20;
    uint256 mintCost = 1 ether;

    //revealed and unrevealed uri
    string public baseRevealedURI;
    string public baseHiddenURI;

    string public baseExtention = ".json";
    uint256 public maxSupply = 1000;
    uint256 public maxLevelAmount = 20;
    uint256 public currentLevelAmount = 0;

    //core chamber level update cost
    uint256 public coreChamberLevelCost;

    // reveal variables
    bool public revealed = false;

    //core chamber
    CoreChamber public coreChamber;

    //core points on a per bobot basis
    //one bobot -> core point
    mapping(uint256 => uint256) public bobotCorePoints;

    //is the contract running
    bool public paused = false;
    
    //token id counter
    CountersUpgradeable.Counter public _tokenIdCounter;

    modifier onlyCoreChamber() {
        require(msg.sender == address(coreChamber), "Bobots: !CoreChamber");
        _;
    }

    function initialize(address _magicAddress) external initializer {
        __ERC721Enumerable_init();
        __Ownable_init();

        magic = IERC20Upgradeable(_magicAddress);
    }
    
    function getBobotType()
        external
        pure
        override
        returns (BobotType)
    {
        return BobotType.BOBOT_MEGA;
    }


    /**************************************************************************/
    /*!
       \brief view URI reveal / hidden
    */
    /**************************************************************************/
    function _baseURI() internal view virtual override returns (string memory) {
        return baseRevealedURI ; // return own base URI
    }

    // public

    /**************************************************************************/
    /*!
       \brief mint a bobot - multiple things to check 
       does user have $MAGIC in their wallet?
    */
    /**************************************************************************/
    function mintBobot() public payable {
        //is contract running?
        require(!paused);

        uint256 mintCount = 0;

        for (uint256 i = 1; i <= mintCount; ++i) {
            uint256 nextTokenId = _getNextTokenId();
            _safeMint(msg.sender, nextTokenId + i);
        }
    }

    /**************************************************************************/
    /*!
       \brief mint a bobot - multiple things to check 
       does user have $MAGIC in their wallet?
    */
    /**************************************************************************/
    function mintBobotTest() public payable {
        //is contract running?
        require(!paused);
        uint256 nextTokenId = _getNextTokenId();
        _safeMint(msg.sender, nextTokenId);
    }


    /**************************************************************************/
    /*!
       \brief return URI of a token - could be revealed or hidden
    */
    /**************************************************************************/
    function getTokenURI(uint256 tokenID)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(
            _exists(tokenID),
            "ERC721Metadata: URI query for nonexistent token"
        );

        string memory currentBaseURI = _baseURI();
        uint256 level = Math.min(
            bobotCorePoints[tokenID] / coreChamberLevelCost,
            maxLevelAmount
        );

        string memory revealedURI = string(
            abi.encodePacked(
                baseRevealedURI,
                tokenID.toString(),
                "/",
                level.toString(),
                baseExtention
            )
        );

        return
            bytes(currentBaseURI).length > 0
                ? (revealedURI)
                : "";
    }

    function _getNextTokenId() private view returns (uint256) {
        return (_tokenIdCounter.current() + 1);
        //return ( 1);
    }

    function _safeMint(address to, uint256 tokenId)
        internal
        override(ERC721Upgradeable)
    {
        super._safeMint(to, tokenId);
        _tokenIdCounter.increment();
    }

    /**************************************************************************/
    /*!
       \brief returns the bobots current level
    */
    /**************************************************************************/
    function getCurrentBobotLevel(uint256 _tokenID) 
        public 
        view 
        returns (uint256)
    {
        //return bobotCorePoints[_tokenID].currentLevelAmount;
    }

    function coreChamberCorePointUpdate(uint256 _tokenId, uint256 _coreEarned)
        external
        onlyCoreChamber
    {
        bobotCorePoints[_tokenId] += _coreEarned;
    }

    /**************************************************************************/
    /*!
       \brief enable reveal phase
    */
    /**************************************************************************/
    function reveal(bool _revealed) external onlyOwner {
        revealed = _revealed;
    }


    /**************************************************************************/
    /*!
       \brief set base URI
    */
    /**************************************************************************/
    function setBaseRevealedURI(string memory _newBaseURI) public onlyOwner {
        baseRevealedURI = _newBaseURI;
    }

    function _beforeTokenTransfer(
        address _from,
        address _to,
        uint256 _tokenId
    ) internal override {

        super._beforeTokenTransfer(_from, _to, _tokenId);

        if (address(coreChamber) != address(0))
            require(!coreChamber.isAtCoreChamberMegabot(_tokenId), "Genesis: at core chamber. Unstake to transfer.");
    }

   
    /**************************************************************************/
    /*!
       \brief set Base Extensions
    */
    /**************************************************************************/
    function setBaseExtentions(string memory _newBaseExtentions)
        public
        onlyOwner
    {
        baseExtention = _newBaseExtentions;
    }
    /**************************************************************************/
    /*!
       \brief pause smart contract
    */
    /**************************************************************************/
    function pause(bool _state) public onlyOwner {
        paused = _state;
    }
    /**************************************************************************/
    /*!
       \brief withdraw
    */
    /**************************************************************************/
    function withdraw() public payable onlyOwner {
        require(payable(msg.sender).send(address(this).balance));
    }
}

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

pragma solidity ^0.8.0;

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

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

File 26 of 29 : Magic20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

//,,,,,,,,,,,,,,,,,,,***************************************,*,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,**,,,,***********************,*,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,****,,,*,,,**,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,((*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*%%#(*/&%( #( %#.,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*###(*....         #(,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,(###(,,...          .,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.,(#%%(*,,,...         ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/#%%%#**,,,,,... ,,   ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,/###((/**,,,,*,,,,,*.  ,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(##((#%%%%%##//##((/( ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*((/*........      .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,,,(%&&&&&&&&&&&&&%%%%%%%%%#/,,,,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,,,,,,,,,,********,,,....                ,,,,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,#(/,,,,,,*@%(#%%%%%&&&&&&&&%%%%%%%(((//,..  /,,,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,##(/,,&&&&&&&&&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%/*,,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,##,.,*/((##(((//****,,,....                  .,,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,,((* .(####(***,,,,,#%%%%%%%%%%%%%#####%%%%%%((/,,,,,,,,,,,,,,,,
//,,,,,,,,,,,,,,,,*&(%%#%%%%###(((((//#%%%######%%%%%%%###########, ,,,,,,,,,,,,,,
//*,,,,,,,,,,,,,,,,((%%%%%%%%###((((//#%%#(    .(##%########(/   (. ,,,,,,,,,,,,,,
//*,*,,,,,,,,,,,,,,/#%%%%%%%####((((//#%%#(    ,(#####   .(#(/   (. ,,,,,,,,,,,,,,
//*******,,,,,*/ .,(&(#%%%%%%###((((//#%%%%#####%%%%%%%%%%%#######, ,,,,,,,,,,,,,,
//********,*,///  ,/##&####(///*****(##%%%%%%%%%%%%%%%%%%%%%%##### ,,,,,,,,,,,,,,,
//********,*/(//  ,,##/.,,,,,,,,,,,,,,,,,*((*,,,,,,,,,,,,(     .*.,,,,,,,,,,,,,,,,
//**********(((*   *,,,..*(/,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,#(#(/,   ,,,,,,,,,,,,,,,
//*********&&&%*,  ,**((((#(//,/(%&&&%/*,   .%%%%%   ,*,#%## ((,,  (#/,,,,,,,,,,,,
//*********&&&&(##((,.,%%%%(*. ,#%##&&&&((    #%%%%.   ##%/.#/,   *,.. .,,,,,,,,,,
//*********@@@&#%(/*,..%@&%#/, .%%###((*, (&& . .**/(&&     /#(.  (*,. .,,,,,,,*,,
//********(@@@&#%(/*,..***/%%#* .%%%###((////*  %#((((///* .*%#/  #/*,..*,,,,*****
//********(&&@&#%(/*,.*******#.((%%%%%##////((((%#(/**//((((*,%%%#%(*,.***********
//*********#####%(/*,,*******#*(%%%%%%%########***%%%%%%%#/****%%#%%/,,,**********
//                      ____   ____  ____   ____ _______ _____                  //
//                     |  _ \ / __ \|  _ \ / __ \__   __/ ____|                 //
//                     | |_) | |  | | |_) | |  | | | | | (___                   //
//                     |  _ <| |  | |  _ <| |  | | | |  \___ \                  //
//                     | |_) | |__| | |_) | |__| | | |  ____)                   //
//                     |____/ \____/|____/ \____/  |_| |_____/                  //
//////////////////////////////////////////////////////////////////////////////////                                    

contract Magic20 is Ownable {
    using SafeERC20 for IERC20;

    //$magic contract address
    address public magicAddress;

    //wallet address
    address public mainAddress;

    //store magic address

    constructor() {
        //tokenContract = token;
    }

    //public

    /**************************************************************************/
    /*!
       \brief check balance of magic holder
    */
    /**************************************************************************/
    function checkBalance(address _holder) public view returns (uint256) {
        IERC20 magic = IERC20(magicAddress);
        return magic.balanceOf(_holder);
    }

    /**************************************************************************/
    /*!
       \brief magic safe transfer
    */
    /**************************************************************************/
    function safeMagicTransfer(address _holder, uint256 _value) public payable {
        IERC20 magic = IERC20(magicAddress);
        magic.safeTransferFrom(mainAddress, _holder, _value);
    }

    //admin

    /**************************************************************************/
    /*!
       \brief set magic address
    */
    /**************************************************************************/
    function setMagicAddress(address _magicAddress) external onlyOwner {
        magicAddress = _magicAddress;
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

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

File 28 of 29 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 29 of 29 : Address.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 Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":"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"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseExtention","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseHiddenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseRevealedURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"bobotCorePoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_claimed","type":"address"}],"name":"checkClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coreChamber","outputs":[{"internalType":"contract CoreChamber","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_coreEarned","type":"uint256"}],"name":"coreChamberCorePointUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"coreChamberLevelCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBobotType","outputs":[{"internalType":"enum IBobot.BobotType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenID","type":"uint256"}],"name":"getCurrentBobotLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"getTokenIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"getTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","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":"maxLevelAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"mintBobot","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_revealed","type":"bool"}],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rootGuardiansHash_1","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rootGuardiansHash_2","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rootLunarsHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseExtentions","type":"string"}],"name":"setBaseExtentions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURI","type":"string"}],"name":"setBaseHiddenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_newBaseURI","type":"string"}],"name":"setBaseRevealedURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_coreChamber","type":"address"}],"name":"setCoreChamber","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cost","type":"uint256"}],"name":"setCoreChamberLevelCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newLevelAmount","type":"uint256"}],"name":"setMaxLevel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_rootHash","type":"bytes32"}],"name":"setRootGuardiansHash_1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_rootHash","type":"bytes32"}],"name":"setRootGuardiansHash_2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_rootHash","type":"bytes32"}],"name":"setRootLunarsHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelistedAddressesClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b50615b6a80620000216000396000f3fe6080604052600436106102ff5760003560e01c8063715018a611610190578063b6e2a182116100dc578063d4c9a70f11610095578063ed6f57b71161006f578063ed6f57b714610ba7578063f2fde38b14610bd0578063f5c8834c14610bf9578063fed71b2814610c22576102ff565b8063d4c9a70f14610b04578063d60f2e6514610b41578063e985e9c514610b6a576102ff565b8063b6e2a182146109e2578063b88d4fde14610a0b578063ba58473714610a34578063c329a8cd14610a5f578063c87b56dd14610a8a578063d004b03614610ac7576102ff565b806395d89b4111610149578063a6a0305411610123578063a6a030541461094b578063a8fef08e14610974578063ab5e6df714610990578063aeb8e1cc146109b9576102ff565b806395d89b41146108ba578063a22cb465146108e5578063a3019cd01461090e576102ff565b8063715018a6146107d2578063768300f2146107e95780638129fc1c146108265780638ba4cc3c1461083d5780638da5cb5b14610866578063940cd05b14610891576102ff565b80632f745c591161024f5780634ba5f378116102085780635c975abb116101e25780635c975abb146107025780636352211e1461072d578063662125571461076a57806370a0823114610795576102ff565b80634ba5f3781461066f5780634f6ccce71461069a57806351830227146106d7576102ff565b80632f745c591461054d578063344f1ba51461058a5780633a5958e3146105b35780633bb3a24d146105de57806342842e0e1461061b57806343b946af14610644576102ff565b80630cf7572f116102bc57806318160ddd1161029657806318160ddd146104a557806323b872dd146104d057806325c13203146104f95780632793a0e314610522576102ff565b80630cf7572f146104265780630f774d0414610451578063133a979b1461047a576102ff565b806301ffc9a71461030457806302329a291461034157806306fdde031461036a578063081812fc1461039557806308454e12146103d2578063095ea7b3146103fd575b600080fd5b34801561031057600080fd5b5061032b60048036038101906103269190613ed8565b610c5f565b6040516103389190613f20565b60405180910390f35b34801561034d57600080fd5b5061036860048036038101906103639190613f67565b610cd9565b005b34801561037657600080fd5b5061037f610d73565b60405161038c919061402d565b60405180910390f35b3480156103a157600080fd5b506103bc60048036038101906103b79190614085565b610e05565b6040516103c991906140f3565b60405180910390f35b3480156103de57600080fd5b506103e7610e8a565b6040516103f4919061402d565b60405180910390f35b34801561040957600080fd5b50610424600480360381019061041f919061413a565b610f18565b005b34801561043257600080fd5b5061043b61102f565b6040516104489190614193565b60405180910390f35b34801561045d57600080fd5b50610478600480360381019061047391906141da565b611036565b005b34801561048657600080fd5b5061048f6110bd565b60405161049c9190614216565b60405180910390f35b3480156104b157600080fd5b506104ba6110c4565b6040516104c79190614216565b60405180910390f35b3480156104dc57600080fd5b506104f760048036038101906104f29190614231565b6110d1565b005b34801561050557600080fd5b50610520600480360381019061051b91906143b9565b611131565b005b34801561052e57600080fd5b506105376111c7565b6040516105449190614193565b60405180910390f35b34801561055957600080fd5b50610574600480360381019061056f919061413a565b6111ce565b6040516105819190614216565b60405180910390f35b34801561059657600080fd5b506105b160048036038101906105ac9190614085565b611273565b005b3480156105bf57600080fd5b506105c86112f9565b6040516105d5919061402d565b60405180910390f35b3480156105ea57600080fd5b5061060560048036038101906106009190614085565b611387565b604051610612919061402d565b60405180910390f35b34801561062757600080fd5b50610642600480360381019061063d9190614231565b6114ef565b005b34801561065057600080fd5b5061065961150f565b6040516106669190614461565b60405180910390f35b34801561067b57600080fd5b50610684611536565b604051610691919061402d565b60405180910390f35b3480156106a657600080fd5b506106c160048036038101906106bc9190614085565b6115c4565b6040516106ce9190614216565b60405180910390f35b3480156106e357600080fd5b506106ec611635565b6040516106f99190613f20565b60405180910390f35b34801561070e57600080fd5b50610717611648565b6040516107249190613f20565b60405180910390f35b34801561073957600080fd5b50610754600480360381019061074f9190614085565b61165c565b60405161076191906140f3565b60405180910390f35b34801561077657600080fd5b5061077f61170d565b60405161078c9190614216565b60405180910390f35b3480156107a157600080fd5b506107bc60048036038101906107b7919061447c565b611713565b6040516107c99190614216565b60405180910390f35b3480156107de57600080fd5b506107e76117ca565b005b3480156107f557600080fd5b50610810600480360381019061080b919061447c565b611852565b60405161081d9190613f20565b60405180910390f35b34801561083257600080fd5b5061083b611873565b005b34801561084957600080fd5b50610864600480360381019061085f919061413a565b611974565b005b34801561087257600080fd5b5061087b611a4b565b60405161088891906140f3565b60405180910390f35b34801561089d57600080fd5b506108b860048036038101906108b39190613f67565b611a75565b005b3480156108c657600080fd5b506108cf611b0e565b6040516108dc919061402d565b60405180910390f35b3480156108f157600080fd5b5061090c600480360381019061090791906144a9565b611ba0565b005b34801561091a57600080fd5b5061093560048036038101906109309190614085565b611bb6565b6040516109429190614216565b60405180910390f35b34801561095757600080fd5b50610972600480360381019061096d91906143b9565b611c75565b005b61098e60048036038101906109899190614549565b611d0b565b005b34801561099c57600080fd5b506109b760048036038101906109b29190614085565b61201e565b005b3480156109c557600080fd5b506109e060048036038101906109db91906141da565b6120a5565b005b3480156109ee57600080fd5b50610a096004803603810190610a0491906143b9565b61212c565b005b348015610a1757600080fd5b50610a326004803603810190610a2d9190614637565b6121c2565b005b348015610a4057600080fd5b50610a49612224565b604051610a569190614731565b60405180910390f35b348015610a6b57600080fd5b50610a74612229565b604051610a819190614193565b60405180910390f35b348015610a9657600080fd5b50610ab16004803603810190610aac9190614085565b612230565b604051610abe919061402d565b60405180910390f35b348015610ad357600080fd5b50610aee6004803603810190610ae9919061447c565b612242565b604051610afb919061480a565b60405180910390f35b348015610b1057600080fd5b50610b2b6004803603810190610b26919061447c565b6122f8565b604051610b389190613f20565b60405180910390f35b348015610b4d57600080fd5b50610b686004803603810190610b6391906141da565b61234f565b005b348015610b7657600080fd5b50610b916004803603810190610b8c919061482c565b6123d6565b604051610b9e9190613f20565b60405180910390f35b348015610bb357600080fd5b50610bce6004803603810190610bc9919061447c565b61246a565b005b348015610bdc57600080fd5b50610bf76004803603810190610bf2919061447c565b61252b565b005b348015610c0557600080fd5b50610c206004803603810190610c1b919061486c565b612622565b005b348015610c2e57600080fd5b50610c496004803603810190610c449190614085565b6126e2565b604051610c569190614216565b60405180910390f35b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610cd25750610cd1826126fb565b5b9050919050565b610ce16127dd565b73ffffffffffffffffffffffffffffffffffffffff16610cff611a4b565b73ffffffffffffffffffffffffffffffffffffffff1614610d55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4c906148f8565b60405180910390fd5b8061010760146101000a81548160ff02191690831515021790555050565b606060658054610d8290614947565b80601f0160208091040260200160405190810160405280929190818152602001828054610dae90614947565b8015610dfb5780601f10610dd057610100808354040283529160200191610dfb565b820191906000526020600020905b815481529060010190602001808311610dde57829003601f168201915b5050505050905090565b6000610e10826127e5565b610e4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e46906149ea565b60405180910390fd5b6069600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60fb8054610e9790614947565b80601f0160208091040260200160405190810160405280929190818152602001828054610ec390614947565b8015610f105780601f10610ee557610100808354040283529160200191610f10565b820191906000526020600020905b815481529060010190602001808311610ef357829003601f168201915b505050505081565b6000610f238261165c565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610f93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8a90614a7c565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610fb26127dd565b73ffffffffffffffffffffffffffffffffffffffff161480610fe15750610fe081610fdb6127dd565b6123d6565b5b611020576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101790614b0e565b60405180910390fd5b61102a8383612851565b505050565b6101025481565b61103e6127dd565b73ffffffffffffffffffffffffffffffffffffffff1661105c611a4b565b73ffffffffffffffffffffffffffffffffffffffff16146110b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a9906148f8565b60405180910390fd5b806101028190555050565b6101035481565b6000609980549050905090565b6110e26110dc6127dd565b8261290a565b611121576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111890614ba0565b60405180910390fd5b61112c8383836129e8565b505050565b6111396127dd565b73ffffffffffffffffffffffffffffffffffffffff16611157611a4b565b73ffffffffffffffffffffffffffffffffffffffff16146111ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a4906148f8565b60405180910390fd5b8060fd90805190602001906111c3929190613dc9565b5050565b6101015481565b60006111d983611713565b821061121a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121190614c32565b60405180910390fd5b609760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b61127b6127dd565b73ffffffffffffffffffffffffffffffffffffffff16611299611a4b565b73ffffffffffffffffffffffffffffffffffffffff16146112ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e6906148f8565b60405180910390fd5b8060fe8190555050565b60fc805461130690614947565b80601f016020809104026020016040519081016040528092919081815260200182805461133290614947565b801561137f5780601f106113545761010080835404028352916020019161137f565b820191906000526020600020905b81548152906001019060200180831161136257829003601f168201915b505050505081565b6060611392826127e5565b6113d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c890614cc4565b60405180910390fd5b60006113db612c4e565b9050600060fb6113ea85612cfc565b6113fb6113f687611bb6565b612cfc565b60fd6040516020016114109493929190614e00565b6040516020818303038152906040529050600082511161143f57604051806020016040528060008152506114e6565b60ff60009054906101000a900460ff166114e35760fc805461146090614947565b80601f016020809104026020016040519081016040528092919081815260200182805461148c90614947565b80156114d95780601f106114ae576101008083540402835291602001916114d9565b820191906000526020600020905b8154815290600101906020018083116114bc57829003601f168201915b50505050506114e5565b805b5b92505050919050565b61150a838383604051806020016040528060008152506121c2565b505050565b61010760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60fd805461154390614947565b80601f016020809104026020016040519081016040528092919081815260200182805461156f90614947565b80156115bc5780601f10611591576101008083540402835291602001916115bc565b820191906000526020600020905b81548152906001019060200180831161159f57829003601f168201915b505050505081565b60006115ce6110c4565b821061160f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160690614ebb565b60405180910390fd5b6099828154811061162357611622614edb565b5b90600052602060002001549050919050565b60ff60009054906101000a900460ff1681565b61010760149054906101000a900460ff1681565b6000806067600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611704576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fb90614f7c565b60405180910390fd5b80915050919050565b60fe5481565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611783576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177a9061500e565b60405180910390fd5b606860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6117d26127dd565b73ffffffffffffffffffffffffffffffffffffffff166117f0611a4b565b73ffffffffffffffffffffffffffffffffffffffff1614611846576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183d906148f8565b60405180910390fd5b6118506000612e5c565b565b6101066020528060005260406000206000915054906101000a900460ff1681565b600061187f6001612f22565b905080156118a3576001600060016101000a81548160ff0219169083151502179055505b6118ab613012565b6118b3613063565b6040518060200160405280600081525060fd90805190602001906118d8929190613dc9565b50600a60fe81905550600060ff60006101000a81548160ff021916908315150217905550600061010760146101000a81548160ff02191690831515021790555080156119715760008060016101000a81548160ff0219169083151502179055507f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249860016040516119689190615076565b60405180910390a15b50565b61197c6127dd565b73ffffffffffffffffffffffffffffffffffffffff1661199a611a4b565b73ffffffffffffffffffffffffffffffffffffffff16146119f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e7906148f8565b60405180910390fd5b610fc8816119fc6130bc565b611a0691906150c0565b10611a1057600080fd5b6000600190505b818111611a46576000611a286130bc565b9050611a3484826130da565b5080611a3f90615116565b9050611a17565b505050565b600060c960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611a7d6127dd565b73ffffffffffffffffffffffffffffffffffffffff16611a9b611a4b565b73ffffffffffffffffffffffffffffffffffffffff1614611af1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae8906148f8565b60405180910390fd5b8060ff60006101000a81548160ff02191690831515021790555050565b606060668054611b1d90614947565b80601f0160208091040260200160405190810160405280929190818152602001828054611b4990614947565b8015611b965780601f10611b6b57610100808354040283529160200191611b96565b820191906000526020600020905b815481529060010190602001808311611b7957829003601f168201915b5050505050905090565b611bb2611bab6127dd565b83836130f3565b5050565b6000611c6e6101035461010760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166369f397a7856040518263ffffffff1660e01b8152600401611c1b9190614216565b602060405180830381865afa158015611c38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5c9190615173565b611c6691906151cf565b60fe5461325f565b9050919050565b611c7d6127dd565b73ffffffffffffffffffffffffffffffffffffffff16611c9b611a4b565b73ffffffffffffffffffffffffffffffffffffffff1614611cf1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce8906148f8565b60405180910390fd5b8060fb9080519060200190611d07929190613dc9565b5050565b61010760149054906101000a900460ff1615611d2657600080fd5b600080151561010660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611dbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db29061524c565b60405180910390fd5b600033604051602001611dce91906152b4565b6040516020818303038152906040528051906020012090506000611e37858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506101005484613278565b90506000611e8a868680806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506101015485613278565b90506000611edd878780806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506101025486613278565b90508280611ee85750815b80611ef05750805b611f2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f269061531b565b60405180910390fd5b8280611f385750815b15611f5857610fc8611f486130bc565b1115611f5357600080fd5b600194505b8015611f8557610fc86001611f6b6130bc565b611f7591906150c0565b1115611f8057600080fd5b600294505b600161010660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000600190505b858111612014576000611ff66130bc565b905061200233826130da565b508061200d90615116565b9050611fe5565b5050505050505050565b6120266127dd565b73ffffffffffffffffffffffffffffffffffffffff16612044611a4b565b73ffffffffffffffffffffffffffffffffffffffff161461209a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612091906148f8565b60405180910390fd5b806101038190555050565b6120ad6127dd565b73ffffffffffffffffffffffffffffffffffffffff166120cb611a4b565b73ffffffffffffffffffffffffffffffffffffffff1614612121576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612118906148f8565b60405180910390fd5b806101008190555050565b6121346127dd565b73ffffffffffffffffffffffffffffffffffffffff16612152611a4b565b73ffffffffffffffffffffffffffffffffffffffff16146121a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161219f906148f8565b60405180910390fd5b8060fc90805190602001906121be929190613dc9565b5050565b6121d36121cd6127dd565b8361290a565b612212576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161220990614ba0565b60405180910390fd5b61221e8484848461328f565b50505050565b600090565b6101005481565b606061223b82611387565b9050919050565b6060600061224f83611713565b905060008167ffffffffffffffff81111561226d5761226c61428e565b5b60405190808252806020026020018201604052801561229b5781602001602082028036833780820191505090505b50905060005b6122aa85611713565b8110156122ed576122bb85826111ce565b8282815181106122ce576122cd614edb565b5b60200260200101818152505080806122e590615116565b9150506122a1565b508092505050919050565b600061010660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6123576127dd565b73ffffffffffffffffffffffffffffffffffffffff16612375611a4b565b73ffffffffffffffffffffffffffffffffffffffff16146123cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123c2906148f8565b60405180910390fd5b806101018190555050565b6000606a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6124726127dd565b73ffffffffffffffffffffffffffffffffffffffff16612490611a4b565b73ffffffffffffffffffffffffffffffffffffffff16146124e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124dd906148f8565b60405180910390fd5b8061010760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6125336127dd565b73ffffffffffffffffffffffffffffffffffffffff16612551611a4b565b73ffffffffffffffffffffffffffffffffffffffff16146125a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161259e906148f8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260d906153ad565b60405180910390fd5b61261f81612e5c565b50565b61010760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146126b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126aa90615419565b60405180910390fd5b80610108600084815260200190815260200160002060008282546126d791906150c0565b925050819055505050565b6101086020528060005260406000206000915090505481565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806127c657507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806127d657506127d5826132eb565b5b9050919050565b600033905090565b60008073ffffffffffffffffffffffffffffffffffffffff166067600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816069600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166128c48361165c565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612915826127e5565b612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294b906154ab565b60405180910390fd5b600061295f8361165c565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806129a157506129a081856123d6565b5b806129df57508373ffffffffffffffffffffffffffffffffffffffff166129c784610e05565b73ffffffffffffffffffffffffffffffffffffffff16145b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612a088261165c565b73ffffffffffffffffffffffffffffffffffffffff1614612a5e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a559061553d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603612acd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ac4906155cf565b60405180910390fd5b612ad8838383613355565b612ae3600082612851565b6001606860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612b3391906155ef565b925050819055506001606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612b8a91906150c0565b92505081905550816067600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4612c4983838361349a565b505050565b606060ff60009054906101000a900460ff16612c6b5760fc612c6e565b60fb5b8054612c7990614947565b80601f0160208091040260200160405190810160405280929190818152602001828054612ca590614947565b8015612cf25780601f10612cc757610100808354040283529160200191612cf2565b820191906000526020600020905b815481529060010190602001808311612cd557829003601f168201915b5050505050905090565b606060008203612d43576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612e57565b600082905060005b60008214612d75578080612d5e90615116565b915050600a82612d6e91906151cf565b9150612d4b565b60008167ffffffffffffffff811115612d9157612d9061428e565b5b6040519080825280601f01601f191660200182016040528015612dc35781602001600182028036833780820191505090505b5090505b60008514612e5057600182612ddc91906155ef565b9150600a85612deb9190615623565b6030612df791906150c0565b60f81b818381518110612e0d57612e0c614edb565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85612e4991906151cf565b9450612dc7565b8093505050505b919050565b600060c960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160c960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008060019054906101000a900460ff1615612f995760018260ff16148015612f515750612f4f3061349f565b155b612f90576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f87906156c6565b60405180910390fd5b6000905061300d565b8160ff1660008054906101000a900460ff1660ff1610612fee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fe5906156c6565b60405180910390fd5b816000806101000a81548160ff021916908360ff160217905550600190505b919050565b600060019054906101000a900460ff16613061576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161305890615758565b60405180910390fd5b565b600060019054906101000a900460ff166130b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130a990615758565b60405180910390fd5b6130ba6134c2565b565b600060016130cb610104613523565b6130d591906150c0565b905090565b6130e48282613531565b6130ef61010461354f565b5050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603613161576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613158906157c4565b60405180910390fd5b80606a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516132529190613f20565b60405180910390a3505050565b600081831061326e5781613270565b825b905092915050565b6000826132858584613565565b1490509392505050565b61329a8484846129e8565b6132a6848484846135da565b6132e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132dc90615856565b60405180910390fd5b50505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b613360838383613761565b600073ffffffffffffffffffffffffffffffffffffffff1661010760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146134955761010760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639328f537826040518263ffffffff1660e01b81526004016134139190614216565b602060405180830381865afa158015613430573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613454919061588b565b15613494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161348b9061592a565b60405180910390fd5b5b505050565b505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600060019054906101000a900460ff16613511576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161350890615758565b60405180910390fd5b61352161351c6127dd565b612e5c565b565b600081600001549050919050565b61354b828260405180602001604052806000815250613873565b5050565b6001816000016000828254019250508190555050565b60008082905060005b84518110156135cf57600085828151811061358c5761358b614edb565b5b602002602001015190508083116135ae576135a783826138ce565b92506135bb565b6135b881846138ce565b92505b5080806135c790615116565b91505061356e565b508091505092915050565b60006135fb8473ffffffffffffffffffffffffffffffffffffffff1661349f565b15613754578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026136246127dd565b8786866040518563ffffffff1660e01b8152600401613646949392919061599f565b6020604051808303816000875af192505050801561368257506040513d601f19601f8201168201806040525081019061367f9190615a00565b60015b613704573d80600081146136b2576040519150601f19603f3d011682016040523d82523d6000602084013e6136b7565b606091505b5060008151036136fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136f390615856565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613759565b600190505b949350505050565b61376c8383836138e5565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036137ae576137a9816138ea565b6137ed565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146137ec576137eb8382613933565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361382f5761382a81613aa0565b61386e565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461386d5761386c8282613b71565b5b5b505050565b61387d8383613bf0565b61388a60008484846135da565b6138c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138c090615856565b60405180910390fd5b505050565b600082600052816020526040600020905092915050565b505050565b609980549050609a600083815260200190815260200160002081905550609981908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000600161394084611713565b61394a91906155ef565b9050600060986000848152602001908152602001600020549050818114613a2f576000609760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080609760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816098600083815260200190815260200160002081905550505b6098600084815260200190815260200160002060009055609760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001609980549050613ab491906155ef565b90506000609a6000848152602001908152602001600020549050600060998381548110613ae457613ae3614edb565b5b906000526020600020015490508060998381548110613b0657613b05614edb565b5b906000526020600020018190555081609a600083815260200190815260200160002081905550609a6000858152602001908152602001600020600090556099805480613b5557613b54615a2d565b5b6001900381819060005260206000200160009055905550505050565b6000613b7c83611713565b905081609760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806098600084815260200190815260200160002081905550505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603613c5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613c5690615aa8565b60405180910390fd5b613c68816127e5565b15613ca8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613c9f90615b14565b60405180910390fd5b613cb460008383613355565b6001606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613d0491906150c0565b92505081905550816067600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4613dc56000838361349a565b5050565b828054613dd590614947565b90600052602060002090601f016020900481019282613df75760008555613e3e565b82601f10613e1057805160ff1916838001178555613e3e565b82800160010185558215613e3e579182015b82811115613e3d578251825591602001919060010190613e22565b5b509050613e4b9190613e4f565b5090565b5b80821115613e68576000816000905550600101613e50565b5090565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613eb581613e80565b8114613ec057600080fd5b50565b600081359050613ed281613eac565b92915050565b600060208284031215613eee57613eed613e76565b5b6000613efc84828501613ec3565b91505092915050565b60008115159050919050565b613f1a81613f05565b82525050565b6000602082019050613f356000830184613f11565b92915050565b613f4481613f05565b8114613f4f57600080fd5b50565b600081359050613f6181613f3b565b92915050565b600060208284031215613f7d57613f7c613e76565b5b6000613f8b84828501613f52565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015613fce578082015181840152602081019050613fb3565b83811115613fdd576000848401525b50505050565b6000601f19601f8301169050919050565b6000613fff82613f94565b6140098185613f9f565b9350614019818560208601613fb0565b61402281613fe3565b840191505092915050565b600060208201905081810360008301526140478184613ff4565b905092915050565b6000819050919050565b6140628161404f565b811461406d57600080fd5b50565b60008135905061407f81614059565b92915050565b60006020828403121561409b5761409a613e76565b5b60006140a984828501614070565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006140dd826140b2565b9050919050565b6140ed816140d2565b82525050565b600060208201905061410860008301846140e4565b92915050565b614117816140d2565b811461412257600080fd5b50565b6000813590506141348161410e565b92915050565b6000806040838503121561415157614150613e76565b5b600061415f85828601614125565b925050602061417085828601614070565b9150509250929050565b6000819050919050565b61418d8161417a565b82525050565b60006020820190506141a86000830184614184565b92915050565b6141b78161417a565b81146141c257600080fd5b50565b6000813590506141d4816141ae565b92915050565b6000602082840312156141f0576141ef613e76565b5b60006141fe848285016141c5565b91505092915050565b6142108161404f565b82525050565b600060208201905061422b6000830184614207565b92915050565b60008060006060848603121561424a57614249613e76565b5b600061425886828701614125565b935050602061426986828701614125565b925050604061427a86828701614070565b9150509250925092565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6142c682613fe3565b810181811067ffffffffffffffff821117156142e5576142e461428e565b5b80604052505050565b60006142f8613e6c565b905061430482826142bd565b919050565b600067ffffffffffffffff8211156143245761432361428e565b5b61432d82613fe3565b9050602081019050919050565b82818337600083830152505050565b600061435c61435784614309565b6142ee565b90508281526020810184848401111561437857614377614289565b5b61438384828561433a565b509392505050565b600082601f8301126143a05761439f614284565b5b81356143b0848260208601614349565b91505092915050565b6000602082840312156143cf576143ce613e76565b5b600082013567ffffffffffffffff8111156143ed576143ec613e7b565b5b6143f98482850161438b565b91505092915050565b6000819050919050565b600061442761442261441d846140b2565b614402565b6140b2565b9050919050565b60006144398261440c565b9050919050565b600061444b8261442e565b9050919050565b61445b81614440565b82525050565b60006020820190506144766000830184614452565b92915050565b60006020828403121561449257614491613e76565b5b60006144a084828501614125565b91505092915050565b600080604083850312156144c0576144bf613e76565b5b60006144ce85828601614125565b92505060206144df85828601613f52565b9150509250929050565b600080fd5b600080fd5b60008083601f84011261450957614508614284565b5b8235905067ffffffffffffffff811115614526576145256144e9565b5b602083019150836020820283011115614542576145416144ee565b5b9250929050565b600080602083850312156145605761455f613e76565b5b600083013567ffffffffffffffff81111561457e5761457d613e7b565b5b61458a858286016144f3565b92509250509250929050565b600067ffffffffffffffff8211156145b1576145b061428e565b5b6145ba82613fe3565b9050602081019050919050565b60006145da6145d584614596565b6142ee565b9050828152602081018484840111156145f6576145f5614289565b5b61460184828561433a565b509392505050565b600082601f83011261461e5761461d614284565b5b813561462e8482602086016145c7565b91505092915050565b6000806000806080858703121561465157614650613e76565b5b600061465f87828801614125565b945050602061467087828801614125565b935050604061468187828801614070565b925050606085013567ffffffffffffffff8111156146a2576146a1613e7b565b5b6146ae87828801614609565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600381106146fa576146f96146ba565b5b50565b600081905061470b826146e9565b919050565b600061471b826146fd565b9050919050565b61472b81614710565b82525050565b60006020820190506147466000830184614722565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6147818161404f565b82525050565b60006147938383614778565b60208301905092915050565b6000602082019050919050565b60006147b78261474c565b6147c18185614757565b93506147cc83614768565b8060005b838110156147fd5781516147e48882614787565b97506147ef8361479f565b9250506001810190506147d0565b5085935050505092915050565b6000602082019050818103600083015261482481846147ac565b905092915050565b6000806040838503121561484357614842613e76565b5b600061485185828601614125565b925050602061486285828601614125565b9150509250929050565b6000806040838503121561488357614882613e76565b5b600061489185828601614070565b92505060206148a285828601614070565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006148e2602083613f9f565b91506148ed826148ac565b602082019050919050565b60006020820190508181036000830152614911816148d5565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061495f57607f821691505b60208210810361497257614971614918565b5b50919050565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b60006149d4602c83613f9f565b91506149df82614978565b604082019050919050565b60006020820190508181036000830152614a03816149c7565b9050919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b6000614a66602183613f9f565b9150614a7182614a0a565b604082019050919050565b60006020820190508181036000830152614a9581614a59565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b6000614af8603883613f9f565b9150614b0382614a9c565b604082019050919050565b60006020820190508181036000830152614b2781614aeb565b9050919050565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b6000614b8a603183613f9f565b9150614b9582614b2e565b604082019050919050565b60006020820190508181036000830152614bb981614b7d565b9050919050565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b6000614c1c602b83613f9f565b9150614c2782614bc0565b604082019050919050565b60006020820190508181036000830152614c4b81614c0f565b9050919050565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b6000614cae602f83613f9f565b9150614cb982614c52565b604082019050919050565b60006020820190508181036000830152614cdd81614ca1565b9050919050565b600081905092915050565b60008190508160005260206000209050919050565b60008154614d1181614947565b614d1b8186614ce4565b94506001821660008114614d365760018114614d4757614d7a565b60ff19831686528186019350614d7a565b614d5085614cef565b60005b83811015614d7257815481890152600182019150602081019050614d53565b838801955050505b50505092915050565b6000614d8e82613f94565b614d988185614ce4565b9350614da8818560208601613fb0565b80840191505092915050565b7f2f00000000000000000000000000000000000000000000000000000000000000600082015250565b6000614dea600183614ce4565b9150614df582614db4565b600182019050919050565b6000614e0c8287614d04565b9150614e188286614d83565b9150614e2382614ddd565b9150614e2f8285614d83565b9150614e3b8284614d04565b915081905095945050505050565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b6000614ea5602c83613f9f565b9150614eb082614e49565b604082019050919050565b60006020820190508181036000830152614ed481614e98565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b6000614f66602983613f9f565b9150614f7182614f0a565b604082019050919050565b60006020820190508181036000830152614f9581614f59565b9050919050565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b6000614ff8602a83613f9f565b915061500382614f9c565b604082019050919050565b6000602082019050818103600083015261502781614feb565b9050919050565b6000819050919050565b600060ff82169050919050565b600061506061505b6150568461502e565b614402565b615038565b9050919050565b61507081615045565b82525050565b600060208201905061508b6000830184615067565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006150cb8261404f565b91506150d68361404f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561510b5761510a615091565b5b828201905092915050565b60006151218261404f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361515357615152615091565b5b600182019050919050565b60008151905061516d81614059565b92915050565b60006020828403121561518957615188613e76565b5b60006151978482850161515e565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006151da8261404f565b91506151e58361404f565b9250826151f5576151f46151a0565b5b828204905092915050565b7f7573657220616c72656164792077686974656c69737465640000000000000000600082015250565b6000615236601883613f9f565b915061524182615200565b602082019050919050565b6000602082019050818103600083015261526581615229565b9050919050565b60008160601b9050919050565b60006152848261526c565b9050919050565b600061529682615279565b9050919050565b6152ae6152a9826140d2565b61528b565b82525050565b60006152c0828461529d565b60148201915081905092915050565b7f496e76616c69642070726f6f66202d206e6f742077686974656c697374656400600082015250565b6000615305601f83613f9f565b9150615310826152cf565b602082019050919050565b60006020820190508181036000830152615334816152f8565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000615397602683613f9f565b91506153a28261533b565b604082019050919050565b600060208201905081810360008301526153c68161538a565b9050919050565b7f426f626f74733a2021436f72654368616d626572000000000000000000000000600082015250565b6000615403601483613f9f565b915061540e826153cd565b602082019050919050565b60006020820190508181036000830152615432816153f6565b9050919050565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b6000615495602c83613f9f565b91506154a082615439565b604082019050919050565b600060208201905081810360008301526154c481615488565b9050919050565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b6000615527602583613f9f565b9150615532826154cb565b604082019050919050565b600060208201905081810360008301526155568161551a565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006155b9602483613f9f565b91506155c48261555d565b604082019050919050565b600060208201905081810360008301526155e8816155ac565b9050919050565b60006155fa8261404f565b91506156058361404f565b92508282101561561857615617615091565b5b828203905092915050565b600061562e8261404f565b91506156398361404f565b925082615649576156486151a0565b5b828206905092915050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b60006156b0602e83613f9f565b91506156bb82615654565b604082019050919050565b600060208201905081810360008301526156df816156a3565b9050919050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b6000615742602b83613f9f565b915061574d826156e6565b604082019050919050565b6000602082019050818103600083015261577181615735565b9050919050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b60006157ae601983613f9f565b91506157b982615778565b602082019050919050565b600060208201905081810360008301526157dd816157a1565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b6000615840603283613f9f565b915061584b826157e4565b604082019050919050565b6000602082019050818103600083015261586f81615833565b9050919050565b60008151905061588581613f3b565b92915050565b6000602082840312156158a1576158a0613e76565b5b60006158af84828501615876565b91505092915050565b7f47656e657369733a20617420636f7265206368616d6265722e20556e7374616b60008201527f6520746f207472616e736665722e000000000000000000000000000000000000602082015250565b6000615914602e83613f9f565b915061591f826158b8565b604082019050919050565b6000602082019050818103600083015261594381615907565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006159718261594a565b61597b8185615955565b935061598b818560208601613fb0565b61599481613fe3565b840191505092915050565b60006080820190506159b460008301876140e4565b6159c160208301866140e4565b6159ce6040830185614207565b81810360608301526159e08184615966565b905095945050505050565b6000815190506159fa81613eac565b92915050565b600060208284031215615a1657615a15613e76565b5b6000615a24848285016159eb565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b6000615a92602083613f9f565b9150615a9d82615a5c565b602082019050919050565b60006020820190508181036000830152615ac181615a85565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b6000615afe601c83613f9f565b9150615b0982615ac8565b602082019050919050565b60006020820190508181036000830152615b2d81615af1565b905091905056fea26469706673582212206f704ed7118d1f2ff8b07a39374b1390b9ce118296a965373585dbcc702ce9e464736f6c634300080d0033

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.