Contract 0x270D8Efc78fb3276379A7d94A59a0F89D8f753cE

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xca31db3ebcffeb2d78529a10b8d5e5b089371fbab6a24f1fc7bfddf81831c25c0x60806040201649232022-09-23 5:56:536 days 6 hrs ago0x4082e997ec720a4894efec53b0d9aabfeea44cbe IN  Create: Evo0 AVAX0.12547667525
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Evo

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 33 : Evo.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableMapUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/Base64Upgradeable.sol";

import "../extensions/ERC721EnumerableExtendedUpgradeable.sol";
import "../../utils/chainlink/ChainlinkVRFConsumerUpgradeable.sol";
import "../extensions/ERC721BlacklistUpgradeable.sol";
import "../extensions/ERC721BurnableUpgradeable.sol";
import "../../deprecated/OldTokenConstants.sol";
import "../interfaces/EvoStructs.sol";
import "../EvoEgg/IEvoEgg.sol";
import "../interfaces/IERC721L1.sol";

/**
* @title Evo v1.0.0
* @author @DirtyCajunRice
*/
contract Evo is Initializable, EvoStructs, ERC721Upgradeable, ERC721EnumerableExtendedUpgradeable,
PausableUpgradeable, AccessControlEnumerableUpgradeable, ERC721BurnableUpgradeable, OldTokenConstants,
ERC721BlacklistUpgradeable, ChainlinkVRFConsumerUpgradeable, IERC721L1 {
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
    using EnumerableMapUpgradeable for EnumerableMapUpgradeable.UintToUintMap;
    using StringsUpgradeable for uint256;

    IEvoEgg private EGG;

    // Hatch storage
    mapping (address => PendingHatch) private _pendingHatches;
    EnumerableSetUpgradeable.AddressSet private _pendingHatchAddresses;
    mapping (uint256 => address) private _requestIdToAddress;

    // Base gene storage
    // speciesId -> param -> value
    mapping(uint256 => EnumerableMapUpgradeable.UintToUintMap) private _speciesBase;
    // set of configured species
    EnumerableSetUpgradeable.UintSet private _speciesIds;

    // Evo Attribute storage
    // map speciesId to attribute id for value of attribute
    mapping(uint256 => EnumerableMapUpgradeable.UintToUintMap) private _attributes;
    mapping (uint256 => mapping(uint256 => string)) private _attributeStrings;

    string public imageBaseURI;
    string public animationBaseURI;

    uint256[] private _unused;

    bytes32 public constant BRIDGE_ROLE = keccak256("BRIDGE_ROLE");

    address public l2Contract;

    modifier teamTransferCheck(address from, address to, uint256 tokenId) {
        address teamProxyWallet = 0x2F52Abfca2074b99759b58345Bb984419D304243;
        address treasury = 0x39Af60141b91F7941Eb13AedA2124a61a953b7C0;
        address bridge = 0x328eb74673Eaa1D2d90A48E8137b015F1B6Ed35d;
        require(
            tokenId > 50
            || from == address(0)
            || to == address(0)
            || from == teamProxyWallet
            || to == teamProxyWallet
            || from == treasury
            || to == treasury
            || from == bridge
            || to == bridge
            ,"Team Evo are non-transferable"
        );
        _;
    }
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize() initializer public {
        __ERC721_init("Evo", "Evo");
        __ERC721EnumerableExtended_init();
        __Pausable_init();
        __AccessControlEnumerable_init();
        __ERC721Burnable_init();
        __ERC721Blacklist_init();

        address chainlinkCoordinator = 0xd5D517aBE5cF79B7e95eC98dB0f0277788aFF634;
        bytes32 keyHash = 0x83250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d;
        uint64 subscriptionId = 29;
        uint16 confirmations = 3;

        __ChainlinkVRFConsumer_init(chainlinkCoordinator, keyHash, subscriptionId, confirmations);

        _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _grantRole(ADMIN_ROLE, _msgSender());
        _grantRole(MINTER_ROLE, _msgSender());

        imageBaseURI = "https://github.com/EvoVerses/public-assets/raw/main/nfts/Evo/";
        EGG = IEvoEgg(0x75dDd2b19E6f7BEd3Bfe9D2D21dd226C38C0CbC4);
    }

    function pause() public onlyRole(ADMIN_ROLE) {
        _pause();
    }

    function unpause() public onlyRole(ADMIN_ROLE) {
        _unpause();
    }

    function setAttribute(uint256 tokenId, uint256 attributeId, uint256 value) public onlyRole(MINTER_ROLE) {
        _attributes[tokenId].set(attributeId, value);
    }

    function batchSetAttribute(
        uint256 tokenId,
        uint256[] memory attributeIds,
        uint256[] memory values
    ) public onlyRole(MINTER_ROLE) {
        for (uint256 i = 0; i < attributeIds.length; i++) {
            _attributes[tokenId].set(attributeIds[i], values[i]);
        }
    }

    function batchAddToAttribute(
        uint256 tokenId,
        uint256[] memory attributeIds,
        uint256[] memory values
    ) public onlyRole(MINTER_ROLE) {
        for (uint256 i = 0; i < attributeIds.length; i++) {
            uint256 value = _attributes[tokenId].get(attributeIds[i]);
            _attributes[tokenId].set(attributeIds[i], value + values[i]);
        }
    }

    function mint(address _address, EvoStructs.Evo memory evo) public onlyRole(MINTER_ROLE) {
        _attributes[evo.tokenId].set(0, evo.species);
        _attributes[evo.tokenId].set(1, evo.attributes.rarity);
        _attributes[evo.tokenId].set(2, evo.attributes.gender);
        _attributes[evo.tokenId].set(3, evo.generation);
        _attributes[evo.tokenId].set(4, evo.attributes.primaryType);
        _attributes[evo.tokenId].set(5, evo.attributes.secondaryType);
        _attributes[evo.tokenId].set(6, evo.breeds.total);
        _attributes[evo.tokenId].set(7, evo.experience);
        _attributes[evo.tokenId].set(8, evo.attributes.nature);
        _attributes[evo.tokenId].set(9, evo.stats.attack);
        _attributes[evo.tokenId].set(10, evo.stats.defense);
        _attributes[evo.tokenId].set(11, evo.stats.special);
        _attributes[evo.tokenId].set(12, evo.stats.resistance);
        _attributes[evo.tokenId].set(13, evo.stats.speed);
        _safeMint(_address, evo.tokenId);
    }

    function batchMint(address _address, EvoStructs.Evo[] memory evos) public onlyRole(MINTER_ROLE) {
        for (uint256 i = 0; i < evos.length; i++) {
            mint(_address, evos[i]);
        }
    }

    function getGeneralAttributes(uint256 tokenId) internal view returns (string memory) {
        string memory species = _attributeStrings[0][_attributes[tokenId].get(0)];
        string memory rarity = _attributeStrings[1][_attributes[tokenId].get(1)];
        string memory gender = _attributes[tokenId].get(2) == 0 ? 'Male' : 'Female';
        uint256 generation = _attributes[tokenId].get(3);

        return string(abi.encodePacked(
                '{"trait_type":"Species","value":"',  species, '"},',
                '{"trait_type":"Rarity","value":"',  rarity, '"},',
                '{"trait_type":"Gender","value":"',  gender, '"},',
                '{"trait_type":"Generation","value":',  generation.toString(), '},'
            ));
    }

    function getExtraAttributes(uint256 tokenId) internal view returns (string memory) {
        string memory primaryType = _attributeStrings[3][_attributes[tokenId].get(4)];
        string memory secondaryType = _attributeStrings[3][_attributes[tokenId].get(5)];
        uint256 breedCount = _attributes[tokenId].get(6);
        uint256 experience = _attributes[tokenId].get(7);
        return string(abi.encodePacked(
                '{"trait_type":"Primary Type","value":"',  primaryType, '"},',
                '{"trait_type":"Secondary Type","value":"',  secondaryType, '"},',
                '{"trait_type":"Breed Count","value":', breedCount.toString(), '},',
                '{"trait_type":"Available Breeds","value":',  '-1', '},',
                '{"trait_type":"Experience","value":',  experience.toString(), '},'
            ));
    }

    function getBattleAttributes(uint256 tokenId) internal view returns (string memory) {
        string memory nature = _attributeStrings[4][_attributes[tokenId].get(8)];
        uint256 attack = _attributes[tokenId].get(9);
        uint256 defense = _attributes[tokenId].get(10);
        uint256 special = _attributes[tokenId].get(11);
        uint256 specialDefense = _attributes[tokenId].get(12);
        uint256 speed = _attributes[tokenId].get(13);
        bytes memory attributesA = abi.encodePacked(
            '{"trait_type":"Nature","value":"',  nature, '"},',
            '{"trait_type":"Attack","value":',  attack.toString(), '},',
            '{"trait_type":"Defense","value":',  defense.toString(), '},'
        );
        bytes memory attributesB = abi.encodePacked(
            '{"trait_type":"Special","value":',  special.toString(), '},',
            '{"trait_type":"Special Defense","value":',  specialDefense.toString(), '},',
            '{"trait_type":"Speed","value":',  speed.toString(), '}'
        );
        return string(abi.encodePacked(attributesA, attributesB));
    }

    function getAttributesURI(uint256 tokenId) internal view returns (string memory) {
        string memory generalAttributes = getGeneralAttributes(tokenId);
        string memory extraAttributes = getExtraAttributes(tokenId);
        string memory battleAttributes = getBattleAttributes(tokenId);
        bytes memory attributesA = abi.encodePacked('"attributes": [', generalAttributes);
        bytes memory attributesB = abi.encodePacked(extraAttributes, battleAttributes, ']');
        return string(abi.encodePacked(string(attributesA), string(attributesB)));
    }

    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        uint256 speciesId = _attributes[tokenId].get(0);
        string memory species = _attributeStrings[0][speciesId];
        string memory imageURI = string(abi.encodePacked(imageBaseURI, speciesId.toString()));
        string memory animationURI = string(abi.encodePacked(animationBaseURI, tokenId.toString()));

        string memory dataURIGeneral = string(abi.encodePacked(
                '"name":"', species, ' #', tokenId.toString(), '",',
                '"description":"EvoVerses Evo",',
                '"image":"', imageURI, '.png",',
                '"animation_url":"', animationURI, '",'
            ));
        string memory attributesURI = getAttributesURI(tokenId);
        bytes memory dataURI = abi.encodePacked('{', dataURIGeneral, attributesURI, '}');
        return string(abi.encodePacked("data:application/json;base64,", Base64Upgradeable.encode(dataURI)));
    }

    function batchTokenURI(uint256[] memory tokenIds) public view returns(string[] memory) {
        string[] memory uris = new string[](tokenIds.length);
        for (uint256 i = 0; i < tokenIds.length; i++) {
            uris[i] = tokenURI(tokenIds[i]);
        }
        return uris;
    }

    function tokenURIRaw(uint256 tokenId) internal view virtual returns (string memory) {
        uint256 speciesId = _attributes[tokenId].get(0);
        string memory species = _attributeStrings[0][speciesId];
        string memory imageURI = string(abi.encodePacked(imageBaseURI, speciesId.toString()));
        string memory animationURI = string(abi.encodePacked(animationBaseURI, tokenId.toString()));

        string memory dataURIGeneral = string(abi.encodePacked(
                '"name":"', species, ' #', tokenId.toString(), '",',
                '"description":"EvoVerses Evo",',
                '"image":"', imageURI, '.png",',
                '"animation_url":"', animationURI, '",'
            ));
        string memory attributesURI = getAttributesURI(tokenId);
        return string(abi.encodePacked('{', dataURIGeneral, attributesURI, '}'));
    }

    function batchTokenUriJson(uint256[] memory tokenIds) public view returns(string[] memory) {
        string[] memory uris = new string[](tokenIds.length);
        for (uint256 i = 0; i < tokenIds.length; i++) {
            uris[i] = tokenURIRaw(tokenIds[i]);
        }
        return uris;
    }

    function setImageBaseURI(string memory _imageBaseURI) public onlyRole(ADMIN_ROLE) {
        imageBaseURI = _imageBaseURI;
    }

    function setAnimationBaseURI(string memory _animationBaseURI) public onlyRole(ADMIN_ROLE) {
        animationBaseURI = _animationBaseURI;
    }

    function setBaseAttributeStrings(uint256 attributeId, uint256[] memory indexes, string[] memory strings) public onlyRole(ADMIN_ROLE) {
        for (uint256 i = 0; i < indexes.length; i++) {
            _attributeStrings[attributeId][indexes[i]] = strings[i];
        }
    }

    // Used before HatcherHarry was created
    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
        _pendingHatches[_requestIdToAddress[requestId]].words = randomWords;
    }

    // HatcherHarry migration
    function getPendingHatchFor(address _address) public view onlyRole(MINTER_ROLE) returns(PendingHatch memory) {
        return _pendingHatches[_address];
    }

    function clearPendingHatch(address _address) public onlyRole(MINTER_ROLE) {
        delete _requestIdToAddress[_pendingHatches[_address].requestId];
        delete _pendingHatches[_address];
        _pendingHatchAddresses.remove(_address);
    }

    function getPendingHatchWallets() public view onlyRole(ADMIN_ROLE) returns(address[] memory) {
        return _pendingHatchAddresses.values();
    }

    function setL2Contract(address _address) public onlyRole(ADMIN_ROLE) {
        l2Contract = _address;
    }

    function bridgeExtraData(uint256 tokenId) external view returns(bytes memory) {
        Attributes memory attributes = Attributes({
            gender: _attributes[tokenId].get(2),
            rarity: _attributes[tokenId].get(1),
            primaryType: _attributes[tokenId].get(4),
            secondaryType: _attributes[tokenId].get(5),
            nature: _attributes[tokenId].get(8),
            size: 0 // _attributes[tokenId].get(14)
        });
        Stats memory stats = Stats({
            health: 50,
            attack: _attributes[tokenId].get(9),
            defense: _attributes[tokenId].get(10),
            special: _attributes[tokenId].get(11),
            resistance: _attributes[tokenId].get(12),
            speed: 0
        });
        Evo memory evo = Evo({
            tokenId: tokenId,
            species: _attributes[tokenId].get(0),
            generation: _attributes[tokenId].get(3),
            experience: _attributes[tokenId].get(7),
            attributes: attributes,
            stats: stats,
            breeds: Breeds(_attributes[tokenId].get(6), 0, 0),
            moves: Moves(0, 0, 0, 0)
        });
        return abi.encode(evo);
    }

    // The following functions are overrides required by Solidity.

    function tokensOfOwner(address owner) public view virtual
    override(ERC721EnumerableExtendedUpgradeable) returns(uint256[] memory) {
        return super.tokensOfOwner(owner);
    }

    function _beforeTokenTransfer(address from, address to, uint256 tokenId)
    internal
    whenNotPaused
    teamTransferCheck(from, to, tokenId)
    override(ERC721Upgradeable, ERC721EnumerableExtendedUpgradeable, ERC721BlacklistUpgradeable)
    {
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function _exists(uint256 tokenId) internal view virtual
    override(ERC721Upgradeable) returns (bool) {
        return super._exists(tokenId);
    }

    function approve(address to, uint256 tokenId) public virtual override(ERC721Upgradeable, IERC721Upgradeable) notBlacklisted(to) {
        super.approve(to, tokenId);
    }

    function setApprovalForAll(address operator, bool approved) public virtual override(ERC721Upgradeable, IERC721Upgradeable) notBlacklisted(operator) {
        super.setApprovalForAll(operator, approved);
    }

    function supportsInterface(bytes4 interfaceId)
    public
    view
    override(
        IERC165Upgradeable,
        ERC721Upgradeable,
        ERC721EnumerableExtendedUpgradeable,
        AccessControlEnumerableUpgradeable,
        ERC721BlacklistUpgradeable
    )
    returns (bool) {
        return interfaceId == 0x9b9284f9 || super.supportsInterface(interfaceId);
    }
}

File 2 of 33 : OldTokenConstants.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

abstract contract OldTokenConstants {
    bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    uint256[49] private __gap;
}

File 3 of 33 : ERC721EnumerableExtendedUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/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 ERC721EnumerableExtendedUpgradeable is Initializable, ERC721Upgradeable, ERC721EnumerableUpgradeable {
    function __ERC721EnumerableExtended_init() internal onlyInitializing {
        __ERC721Enumerable_init();
    }

    function __ERC721EnumerableExtended_init_unchained() internal onlyInitializing {
    }

    function tokensOfOwner(address owner) public view virtual returns(uint256[] memory) {
        uint256 total = ERC721Upgradeable.balanceOf(owner);
        uint256[] memory tokens = new uint256[](total);
        for (uint256 i = 0; i < total; i++) {
            tokens[i] = ERC721EnumerableUpgradeable.tokenOfOwnerByIndex(owner, i);
        }
        return tokens;
    }

    function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(ERC721Upgradeable, ERC721EnumerableUpgradeable)
    returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

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

    uint256[50] private __gap;
}

File 4 of 33 : ChainlinkVRFConsumerUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";

import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "../../deprecated/OldTokenConstants.sol";
import "./VRFConsumerBaseV2.sol";

abstract contract ChainlinkVRFConsumerUpgradeable is Initializable, VRFConsumerBaseV2Upgradeable,
AccessControlEnumerableUpgradeable, OldTokenConstants {
    VRFCoordinatorV2Interface private _coordinator;

    bytes32 private _keyHash;
    uint64 private _subscriptionId;
    uint16 _confirmations;

    function __ChainlinkVRFConsumer_init(
        address coordinator,
        bytes32 keyHash,
        uint64 subscriptionId,
        uint16 confirmations
    ) internal onlyInitializing {
        __AccessControlEnumerable_init();
        __VRFConsumerBaseV2_init(coordinator);
        __ChainlinkVRFConsumer_init_unchained(coordinator, keyHash, subscriptionId, confirmations);
    }

    function __ChainlinkVRFConsumer_init_unchained(
        address coordinator,
        bytes32 keyHash,
        uint64 subscriptionId,
        uint16 confirmations
    ) internal onlyInitializing {
        _coordinator = VRFCoordinatorV2Interface(coordinator);
        _subscriptionId = subscriptionId;
        _keyHash = keyHash;
        _confirmations = confirmations;
    }

    function requestRandomWords(uint32 count) internal returns(uint256 requestId) {
        uint32 gasLimit = (count * 20_000) + 100_000;
        return _coordinator.requestRandomWords(_keyHash, _subscriptionId, _confirmations, gasLimit, count);
    }

    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual override;

    uint256[46] private __gap;
}

File 5 of 33 : ERC721BlacklistUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "../../deprecated/OldTokenConstants.sol";

/**
* @title ERC721 Blacklist v1.0.0
* @author @DirtyCajunRice
*/
abstract contract ERC721BlacklistUpgradeable is Initializable, ERC721Upgradeable,
AccessControlEnumerableUpgradeable, OldTokenConstants {
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    EnumerableSetUpgradeable.AddressSet private blacklist;

    modifier notBlacklisted(address _address) {
        require(!blacklist.contains(_address), "Blacklisted address");
        _;
    }

    function __ERC721Blacklist_init() internal onlyInitializing {
        __AccessControlEnumerable_init();
        __ERC721Blacklist_init_unchained();
    }

    function __ERC721Blacklist_init_unchained() internal onlyInitializing {

    }

    function addBlacklist(address _address) public onlyRole(ADMIN_ROLE) {
        blacklist.add(_address);
    }

    function removeBlacklist(address _address) public onlyRole(ADMIN_ROLE) {
        blacklist.remove(_address);
    }

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

    function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(
        ERC721Upgradeable,
        AccessControlEnumerableUpgradeable
    )
    returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    uint256[49] private __gap;
}

File 6 of 33 : ERC721BurnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// Based on OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity 0.8.9;

import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be burned (destroyed).
 */
abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;

    EnumerableSetUpgradeable.UintSet private _burnedIds;

    function __ERC721Burnable_init() internal onlyInitializing {
    }

    function __ERC721Burnable_init_unchained() internal onlyInitializing {
    }

    function totalBurned() public view virtual returns (uint256) {
        return _burnedIds.length();
    }

    function burnedIds() public view virtual returns (uint256[] memory) {
        return _burnedIds.values();
    }

    function _addBurnedId(uint256 tokenId) internal virtual {
        _burnedIds.add(tokenId);
    }

    function _removeBurnedId(uint256 tokenId) internal virtual {
        _burnedIds.remove(tokenId);
    }

    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _burnedIds.add(tokenId);
        super._burn(tokenId);
    }

    /**
     * @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[48] private __gap;
}

File 7 of 33 : IERC721L1.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";

/**
 * @title ERC721 L2 Token
 * @dev ERC721 Token that can be burned (destroyed).
 */
interface IERC721L1 is IERC721Upgradeable {
    function l2Contract() external returns (address);

    function bridgeExtraData(uint256 tokenId) external returns(bytes memory);
}

File 8 of 33 : IEvoEgg.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "../interfaces/EvoStructs.sol";
import "./IEggAttributeStorage.sol";

interface IEvoEgg is EvoStructs {
    function incubate(address to, Egg memory egg) external;
    function hatch(uint256 tokenId) external;
    function getEgg(uint256 tokenId) external view returns(Egg memory egg);
}

File 9 of 33 : EvoStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

interface EvoStructs {
    struct Moves {
        uint256 move0;
        uint256 move1;
        uint256 move2;
        uint256 move3;
    }

    struct Breeds {
        uint256 total;
        uint256 remaining;
        uint256 lastBreedTime;
    }

    struct Stats {
        uint256 health;
        uint256 attack;
        uint256 defense;
        uint256 special;
        uint256 resistance;
        uint256 speed;
    }

    struct Attributes {
        uint256 gender;
        uint256 rarity;
        uint256 primaryType;
        uint256 secondaryType;
        uint256 nature;
        uint256 size;
    }

    struct Evo {
        uint256 tokenId;
        uint256 species;
        uint256 generation;
        uint256 experience;
        Attributes attributes;
        Stats stats;
        Breeds breeds;
        Moves moves;
    }

    struct PendingHatch {
        uint256[] ids;
        uint256 requestId;
        uint256[] words;
    }

    struct Egg {
        uint256 tokenId;
        uint256 species;
        uint256 generation;
        uint256 parent1;
        uint256 parent2;
        uint256 treated;
        uint256 createdAt;
    }
}

File 10 of 33 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
    function __AccessControlEnumerable_init() internal onlyInitializing {
    }

    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;

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

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

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

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }

    /**
     * @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 11 of 33 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

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

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

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

File 12 of 33 : 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 13 of 33 : Base64Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return result;
    }
}

File 14 of 33 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // 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);
    }

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

File 15 of 33 : EnumerableMapUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableMap.sol)

pragma solidity ^0.8.0;

import "./EnumerableSetUpgradeable.sol";

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * The following map types are supported:
 *
 * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0
 * - `bytes32 -> bytes32` (`Bytes32ToBytes32`) since v4.6.0
 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an array of EnumerableMap.
 * ====
 */
library EnumerableMapUpgradeable {
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.Bytes32Set;

    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct Bytes32ToBytes32Map {
        // Storage of keys
        EnumerableSetUpgradeable.Bytes32Set _keys;
        mapping(bytes32 => bytes32) _values;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        bytes32 value
    ) internal returns (bool) {
        map._values[key] = value;
        return map._keys.add(key);
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
        delete map._values[key];
        return map._keys.remove(key);
    }

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

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

    /**
     * @dev Returns the key-value pair stored at position `index` in the map. O(1).
     *
     * Note that there are no guarantees on the ordering of entries inside the
     * array, and it may change when more entries are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) {
        bytes32 key = map._keys.at(index);
        return (key, map._values[key]);
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
        bytes32 value = map._values[key];
        if (value == bytes32(0)) {
            return (contains(map, key), bytes32(0));
        } else {
            return (true, value);
        }
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
        return value;
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function get(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), errorMessage);
        return value;
    }

    // UintToUintMap

    struct UintToUintMap {
        Bytes32ToBytes32Map _inner;
    }

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

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

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

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

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

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, uint256(value));
    }

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

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToUintMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(key), errorMessage));
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Bytes32ToBytes32Map _inner;
    }

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

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

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

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

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

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     *
     * _Available since v3.4._
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

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

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToAddressMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (address) {
        return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));
    }

    // AddressToUintMap

    struct AddressToUintMap {
        Bytes32ToBytes32Map _inner;
    }

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

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

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

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

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

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));
        return (success, uint256(value));
    }

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

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        AddressToUintMap storage map,
        address key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));
    }

    // Bytes32ToUintMap

    struct Bytes32ToUintMap {
        Bytes32ToBytes32Map _inner;
    }

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

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

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

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

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

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, key);
        return (success, uint256(value));
    }

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

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        Bytes32ToUintMap storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, key, errorMessage));
    }
}

File 16 of 33 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 17 of 33 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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: address zero is not a valid owner");
        return _balances[owner];
    }

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner 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: caller is not token 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) {
        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 an {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 an {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

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

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try 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 {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * 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 18 of 33 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 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) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _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 {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}

File 19 of 33 : 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 20 of 33 : 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 21 of 33 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 22 of 33 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 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 23 of 33 : 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 24 of 33 : 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 25 of 33 : 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 26 of 33 : 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 27 of 33 : 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 28 of 33 : VRFConsumerBaseV2.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

abstract contract VRFConsumerBaseV2Upgradeable is Initializable {
    error OnlyCoordinatorCanFulfill(address have, address want);
    address private vrfCoordinator;

    /**
    * @param _vrfCoordinator address of VRFCoordinator contract
    */
    function __VRFConsumerBaseV2_init(address _vrfCoordinator) internal onlyInitializing {
        __VRFConsumerBaseV2_init_unchained(_vrfCoordinator);
    }

    function __VRFConsumerBaseV2_init_unchained(address _vrfCoordinator) internal onlyInitializing {
        vrfCoordinator = _vrfCoordinator;
    }

    /**
    * @notice fulfillRandomness handles the VRF response. Your contract must
    * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
    * @notice principles to keep in mind when implementing your fulfillRandomness
    * @notice method.
    *
    * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this
    * @dev signature, and will call it once it has verified the proof
    * @dev associated with the randomness. (It is triggered via a call to
    * @dev rawFulfillRandomness, below.)
    *
    * @param requestId The Id initially returned by requestRandomness
    * @param randomWords the VRF output expanded to the requested number of words
    */
    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;

    // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
    // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
    // the origin of the call
    function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
        if (msg.sender != vrfCoordinator) {
            revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);
        }
        fulfillRandomWords(requestId, randomWords);
    }

    uint256[49] private __gap;
}

File 29 of 33 : VRFCoordinatorV2Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface VRFCoordinatorV2Interface {
  /**
   * @notice Get configuration relevant for making requests
   * @return minimumRequestConfirmations global min for request confirmations
   * @return maxGasLimit global max for request gas limit
   * @return s_provingKeyHashes list of registered key hashes
   */
  function getRequestConfig()
    external
    view
    returns (
      uint16,
      uint32,
      bytes32[] memory
    );

  /**
   * @notice Request a set of random words.
   * @param keyHash - Corresponds to a particular oracle job which uses
   * that key for generating the VRF proof. Different keyHash's have different gas price
   * ceilings, so you can select a specific one to bound your maximum per request cost.
   * @param subId  - The ID of the VRF subscription. Must be funded
   * with the minimum subscription balance required for the selected keyHash.
   * @param minimumRequestConfirmations - How many blocks you'd like the
   * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS
   * for why you may want to request more. The acceptable range is
   * [minimumRequestBlockConfirmations, 200].
   * @param callbackGasLimit - How much gas you'd like to receive in your
   * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords
   * may be slightly less than this amount because of gas used calling the function
   * (argument decoding etc.), so you may need to request slightly more than you expect
   * to have inside fulfillRandomWords. The acceptable range is
   * [0, maxGasLimit]
   * @param numWords - The number of uint256 random values you'd like to receive
   * in your fulfillRandomWords callback. Note these numbers are expanded in a
   * secure way by the VRFCoordinator from a single random value supplied by the oracle.
   * @return requestId - A unique identifier of the request. Can be used to match
   * a request to a response in fulfillRandomWords.
   */
  function requestRandomWords(
    bytes32 keyHash,
    uint64 subId,
    uint16 minimumRequestConfirmations,
    uint32 callbackGasLimit,
    uint32 numWords
  ) external returns (uint256 requestId);

  /**
   * @notice Create a VRF subscription.
   * @return subId - A unique subscription id.
   * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer.
   * @dev Note to fund the subscription, use transferAndCall. For example
   * @dev  LINKTOKEN.transferAndCall(
   * @dev    address(COORDINATOR),
   * @dev    amount,
   * @dev    abi.encode(subId));
   */
  function createSubscription() external returns (uint64 subId);

  /**
   * @notice Get a VRF subscription.
   * @param subId - ID of the subscription
   * @return balance - LINK balance of the subscription in juels.
   * @return reqCount - number of requests for this subscription, determines fee tier.
   * @return owner - owner of the subscription.
   * @return consumers - list of consumer address which are able to use this subscription.
   */
  function getSubscription(uint64 subId)
    external
    view
    returns (
      uint96 balance,
      uint64 reqCount,
      address owner,
      address[] memory consumers
    );

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @param newOwner - proposed new owner of the subscription
   */
  function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @dev will revert if original owner of subId has
   * not requested that msg.sender become the new owner.
   */
  function acceptSubscriptionOwnerTransfer(uint64 subId) external;

  /**
   * @notice Add a consumer to a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - New consumer which can use the subscription
   */
  function addConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Remove a consumer from a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - Consumer to remove from the subscription
   */
  function removeConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Cancel a subscription
   * @param subId - ID of the subscription
   * @param to - Where to send the remaining LINK to
   */
  function cancelSubscription(uint64 subId, address to) external;
}

File 30 of 33 : IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";

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

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

File 31 of 33 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

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

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

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

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

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

        _revokeRole(role, account);
    }

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

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

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

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

File 32 of 33 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

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

File 33 of 33 : IEggAttributeStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

interface IEggAttributeStorage {
    function setAttribute(uint256 tokenId, uint256 attributeId, uint256 value) external;
    function batchSetAttribute(uint256 tokenId, uint256[] memory attributeIds, uint256[] memory values) external;
    function addToAttribute(uint256 tokenId, uint256 attributeId, uint256 value) external;
    function batchAddToAttribute(uint256 tokenId, uint256[] memory attributeIds, uint256[] memory values) external;
    function setAttributeString(uint256 attributeId, uint256 index, string memory value) external;
    function batchSetAttributeStrings(uint256 attributeId, uint256[] memory indices, string[] memory values) external;
}

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

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BRIDGE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"addBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"animationBaseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256[]","name":"attributeIds","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"batchAddToAttribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"species","type":"uint256"},{"internalType":"uint256","name":"generation","type":"uint256"},{"internalType":"uint256","name":"experience","type":"uint256"},{"components":[{"internalType":"uint256","name":"gender","type":"uint256"},{"internalType":"uint256","name":"rarity","type":"uint256"},{"internalType":"uint256","name":"primaryType","type":"uint256"},{"internalType":"uint256","name":"secondaryType","type":"uint256"},{"internalType":"uint256","name":"nature","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"}],"internalType":"struct EvoStructs.Attributes","name":"attributes","type":"tuple"},{"components":[{"internalType":"uint256","name":"health","type":"uint256"},{"internalType":"uint256","name":"attack","type":"uint256"},{"internalType":"uint256","name":"defense","type":"uint256"},{"internalType":"uint256","name":"special","type":"uint256"},{"internalType":"uint256","name":"resistance","type":"uint256"},{"internalType":"uint256","name":"speed","type":"uint256"}],"internalType":"struct EvoStructs.Stats","name":"stats","type":"tuple"},{"components":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"remaining","type":"uint256"},{"internalType":"uint256","name":"lastBreedTime","type":"uint256"}],"internalType":"struct EvoStructs.Breeds","name":"breeds","type":"tuple"},{"components":[{"internalType":"uint256","name":"move0","type":"uint256"},{"internalType":"uint256","name":"move1","type":"uint256"},{"internalType":"uint256","name":"move2","type":"uint256"},{"internalType":"uint256","name":"move3","type":"uint256"}],"internalType":"struct EvoStructs.Moves","name":"moves","type":"tuple"}],"internalType":"struct EvoStructs.Evo[]","name":"evos","type":"tuple[]"}],"name":"batchMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256[]","name":"attributeIds","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"batchSetAttribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchTokenURI","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"batchTokenUriJson","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"bridgeExtraData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnedIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"clearPendingHatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getPendingHatchFor","outputs":[{"components":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"words","type":"uint256[]"}],"internalType":"struct EvoStructs.PendingHatch","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingHatchWallets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"imageBaseURI","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":"l2Contract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"species","type":"uint256"},{"internalType":"uint256","name":"generation","type":"uint256"},{"internalType":"uint256","name":"experience","type":"uint256"},{"components":[{"internalType":"uint256","name":"gender","type":"uint256"},{"internalType":"uint256","name":"rarity","type":"uint256"},{"internalType":"uint256","name":"primaryType","type":"uint256"},{"internalType":"uint256","name":"secondaryType","type":"uint256"},{"internalType":"uint256","name":"nature","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"}],"internalType":"struct EvoStructs.Attributes","name":"attributes","type":"tuple"},{"components":[{"internalType":"uint256","name":"health","type":"uint256"},{"internalType":"uint256","name":"attack","type":"uint256"},{"internalType":"uint256","name":"defense","type":"uint256"},{"internalType":"uint256","name":"special","type":"uint256"},{"internalType":"uint256","name":"resistance","type":"uint256"},{"internalType":"uint256","name":"speed","type":"uint256"}],"internalType":"struct EvoStructs.Stats","name":"stats","type":"tuple"},{"components":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"remaining","type":"uint256"},{"internalType":"uint256","name":"lastBreedTime","type":"uint256"}],"internalType":"struct EvoStructs.Breeds","name":"breeds","type":"tuple"},{"components":[{"internalType":"uint256","name":"move0","type":"uint256"},{"internalType":"uint256","name":"move1","type":"uint256"},{"internalType":"uint256","name":"move2","type":"uint256"},{"internalType":"uint256","name":"move3","type":"uint256"}],"internalType":"struct EvoStructs.Moves","name":"moves","type":"tuple"}],"internalType":"struct EvoStructs.Evo","name":"evo","type":"tuple"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"removeBlacklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_animationBaseURI","type":"string"}],"name":"setAnimationBaseURI","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":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"attributeId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"setAttribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"attributeId","type":"uint256"},{"internalType":"uint256[]","name":"indexes","type":"uint256[]"},{"internalType":"string[]","name":"strings","type":"string[]"}],"name":"setBaseAttributeStrings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_imageBaseURI","type":"string"}],"name":"setImageBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setL2Contract","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":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61595780620000f46000396000f3fe608060405234801561001057600080fd5b50600436106103785760003560e01c8063779c7527116101d3578063a2c6e88811610104578063cfa4e54f116100a2578063d89135cd1161007c578063d89135cd1461077d578063e985e9c514610785578063eb91e651146107c1578063fd5eea4e146107d457600080fd5b8063cfa4e54f1461074d578063d539139314610755578063d547741f1461076a57600080fd5b8063b5bfddea116100de578063b5bfddea146106ed578063b88d4fde14610714578063c87b56dd14610727578063ca15c8731461073a57600080fd5b8063a2c6e888146106a7578063a5435ec1146106ba578063ac81d361146106da57600080fd5b806395d89b41116101715780639bf66fa71161014b5780639bf66fa7146106665780639cfe42da14610679578063a217fddf1461068c578063a22cb4651461069457600080fd5b806395d89b41146106385780639b57b7d0146106405780639b9284f91461065357600080fd5b80638456cb59116101ad5780638456cb59146105ea5780638462151c146105f25780639010d07c1461061257806391d148541461062557600080fd5b8063779c7527146105bc5780637d7a6d13146105cf5780638129fc1c146105e257600080fd5b80633f4ba83a116102ad5780636352211e1161024b5780636d94f13a116102255780636d94f13a1461056c57806370a082311461058c57806375b238fc1461059f57806377645839146105b457600080fd5b80636352211e1461053357806364cb59d6146105465780636cfa24cc1461055957600080fd5b80634c35ec44116102875780634c35ec44146104f75780634f6ccce71461050c5780635c975abb1461051f578063633f43f71461052b57600080fd5b80633f4ba83a146104c957806342842e0e146104d157806342966c68146104e457600080fd5b80631fe543e31161031a5780632f2ff15d116102f45780632f2ff15d1461047c5780632f745c591461048f57806336568abe146104a25780633aced149146104b557600080fd5b80631fe543e31461043257806323b872dd14610445578063248a9ca31461045857600080fd5b8063095ea7b311610356578063095ea7b3146103e55780630c9ac092146103fa5780630f3002c11461040d57806318160ddd1461042057600080fd5b806301ffc9a71461037d57806306fdde03146103a5578063081812fc146103ba575b600080fd5b61039061038b3660046142ee565b6107e7565b60405190151581526020015b60405180910390f35b6103ad610812565b60405161039c9190614363565b6103cd6103c8366004614376565b6108a4565b6040516001600160a01b03909116815260200161039c565b6103f86103f33660046143ab565b6108cb565b005b6103f86104083660046143d5565b61090d565b6103f861041b36600461464b565b610993565b60ca545b60405190815260200161039c565b6103f8610440366004614763565b6109f2565b6103f86104533660046147a9565b610a4b565b610424610466366004614376565b600090815261015e602052604090206001015490565b6103f861048a3660046147e5565b610a7d565b61042461049d3660046143ab565b610aa3565b6103f86104b03660046147e5565b610b39565b610296546103cd906001600160a01b031681565b6103f8610bb3565b6103f86104df3660046147a9565b610bd6565b6103f86104f2366004614376565b610bf1565b6104ff610c2c565b60405161039c9190614811565b61042461051a366004614376565b610c58565b61012c5460ff16610390565b6103ad610ceb565b6103cd610541366004614376565b610d7a565b6103f861055436600461485e565b610dda565b6103f8610567366004614941565b610eb5565b61057f61057a366004614975565b610ee1565b60405161039c91906149a9565b61042461059a3660046143d5565b610f99565b61042460008051602061590283398151915281565b6103ad61101f565b6103f86105ca366004614a0b565b61102d565b6103f86105dd36600461485e565b61126c565b6103f86112fd565b6103f8611549565b6106056106003660046143d5565b611569565b60405161039c9190614a72565b6103cd610620366004614a85565b611574565b6103906106333660046147e5565b611594565b6103ad6115c0565b6103f861064e3660046143d5565b6115cf565b6103ad610661366004614376565b61160b565b6103f8610674366004614aa7565b6118a2565b6103f86106873660046143d5565b611944565b610424600081565b6103f86106a2366004614b87565b611968565b6103f86106b5366004614941565b61199c565b6106cd6106c83660046143d5565b6119c8565b60405161039c9190614bc3565b61057f6106e8366004614975565b611ae3565b6104247f52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5f81565b6103f8610722366004614c0f565b611b94565b6103ad610735366004614376565b611bc6565b610424610748366004614376565b611d9b565b610605611db3565b6104246000805160206158a583398151915281565b6103f86107783660046147e5565b611dc5565b610424611deb565b610390610793366004614c8a565b6001600160a01b039182166000908152609b6020908152604080832093909416825291909152205460ff1690565b6103f86107cf3660046143d5565b611df8565b6103f86107e2366004614cb4565b611e1c565b6000639b9284f960e01b6001600160e01b03198316148061080c575061080c82611e4e565b92915050565b60606096805461082190614ce0565b80601f016020809104026020016040519081016040528092919081815260200182805461084d90614ce0565b801561089a5780601f1061086f5761010080835404028352916020019161089a565b820191906000526020600020905b81548152906001019060200180831161087d57829003601f168201915b5050505050905090565b60006108af82611e59565b506000908152609a60205260409020546001600160a01b031690565b816108d861022582611ea9565b156108fe5760405162461bcd60e51b81526004016108f590614d15565b60405180910390fd5b6109088383611ecb565b505050565b6000805160206158a583398151915261092581611fdc565b6001600160a01b038216600081815261028a602081815260408084206001810154855261028d835290842080546001600160a01b03191690559383525261096c82826141eb565b600182016000905560028201600061098491906141eb565b50610908905061028b83611fe6565b6000805160206158a58339815191526109ab81611fdc565b60005b82518110156109ec576109da848483815181106109cd576109cd614d42565b602002602001015161102d565b806109e481614d6e565b9150506109ae565b50505050565b6000546201000090046001600160a01b03163314610a3d5760005460405163073e64fd60e21b8152336004820152620100009091046001600160a01b031660248201526044016108f5565b610a478282611ffb565b5050565b610a56335b82612035565b610a725760405162461bcd60e51b81526004016108f590614d89565b6109088383836120b4565b600082815261015e6020526040902060010154610a9981611fdc565b610908838361225b565b6000610aae83610f99565b8210610b105760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016108f5565b506001600160a01b0391909116600090815260c860209081526040808320938352929052205490565b6001600160a01b0381163314610ba95760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016108f5565b610a47828261227e565b600080516020615902833981519152610bcb81611fdc565b610bd36122a1565b50565b61090883838360405180602001604052806000815250611b94565b610bfa33610a50565b610c165760405162461bcd60e51b81526004016108f590614d89565b610c226101c2826122f4565b50610bd381612300565b6060600080516020615902833981519152610c4681611fdc565b610c5161028b6123a7565b91505b5090565b6000610c6360ca5490565b8210610cc65760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016108f5565b60ca8281548110610cd957610cd9614d42565b90600052602060002001549050919050565b6102948054610cf990614ce0565b80601f0160208091040260200160405190810160405280929190818152602001828054610d2590614ce0565b8015610d725780601f10610d4757610100808354040283529160200191610d72565b820191906000526020600020905b815481529060010190602001808311610d5557829003601f168201915b505050505081565b6000818152609860205260408120546001600160a01b03168061080c5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016108f5565b6000805160206158a5833981519152610df281611fdc565b60005b8351811015610eae576000610e3f858381518110610e1557610e15614d42565b602002602001015161029160008981526020019081526020016000206123b490919063ffffffff16565b9050610e99858381518110610e5657610e56614d42565b6020026020010151858481518110610e7057610e70614d42565b602002602001015183610e839190614dd7565b60008981526102916020526040902091906123c0565b50508080610ea690614d6e565b915050610df5565b5050505050565b600080516020615902833981519152610ecd81611fdc565b815161090890610293906020850190614209565b6060600082516001600160401b03811115610efe57610efe6143f0565b604051908082528060200260200182016040528015610f3157816020015b6060815260200190600190039081610f1c5790505b50905060005b8351811015610f9257610f62848281518110610f5557610f55614d42565b6020026020010151611bc6565b828281518110610f7457610f74614d42565b60200260200101819052508080610f8a90614d6e565b915050610f37565b5092915050565b60006001600160a01b0382166110035760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016108f5565b506001600160a01b031660009081526099602052604090205490565b6102938054610cf990614ce0565b6000805160206158a583398151915261104581611fdc565b60208083015183516000908152610291909252604082206110679290916123c0565b506080820151602090810151835160009081526102919092526040909120611091916001906123c0565b5060808201515182516000908152610291602052604090206110b5916002906123c0565b5060408083015183516000908152610291602052919091206110d9916003906123c0565b5060808201516040908101518351600090815261029160205291909120611102916004906123c0565b506080820151606001518251600090815261029160205260409020611129916005906123c0565b5060c082015151825160009081526102916020526040902061114d916006906123c0565b5060608201518251600090815261029160205260409020611170916007906123c0565b5060808083015101518251600090815261029160205260409020611196916008906123c0565b5060a08201516020908101518351600090815261029190925260409091206111c0916009906123c0565b5060a082015160409081015183516000908152610291602052919091206111e991600a906123c0565b5060a082015160600151825160009081526102916020526040902061121091600b906123c0565b5060a082015160800151825160009081526102916020526040902061123791600c906123c0565b5060a0808301510151825160009081526102916020526040902061125d91600d906123c0565b506109088383600001516123cd565b6000805160206158a583398151915261128481611fdc565b60005b8351811015610eae576112ea8482815181106112a5576112a5614d42565b60200260200101518483815181106112bf576112bf614d42565b602002602001015161029160008981526020019081526020016000206123c09092919063ffffffff16565b50806112f581614d6e565b915050611287565b600054610100900460ff161580801561131d5750600054600160ff909116105b806113375750303b158015611337575060005460ff166001145b61139a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108f5565b6000805460ff1916600117905580156113bd576000805461ff0019166101001790555b6113fd6040518060400160405280600381526020016245766f60e81b8152506040518060400160405280600381526020016245766f60e81b8152506123e7565b611405612418565b61140d612449565b611415612478565b61141d612478565b61142561249f565b73d5d517abe5cf79b7e95ec98db0f0277788aff6347f83250c5584ffa93feb6ee082981c5ebe484c865196750b39835ad4f13780435d601d600361146b848484846124ce565b61147660003361225b565b61148e6000805160206159028339815191523361225b565b6114a66000805160206158a58339815191523361225b565b6040518060600160405280603d81526020016158c5603d913980516114d49161029391602090910190614209565b505061028980546001600160a01b0319167375ddd2b19e6f7bed3bfe9d2d21dd226c38c0cbc4179055505081159050610bd3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b60008051602061590283398151915261156181611fdc565b610bd3612512565b606061080c82612550565b60008281526101906020526040812061158d90836125f1565b9392505050565b600091825261015e602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606097805461082190614ce0565b6000805160206159028339815191526115e781611fdc565b5061029680546001600160a01b0319166001600160a01b0392909216919091179055565b6040805160c0810182526000838152610291602052918220606092919081906116359060026123b4565b81526000858152610291602090815260409091209101906116579060016123b4565b81526000858152610291602090815260409091209101906116799060046123b4565b815260008581526102916020908152604090912091019061169b9060056123b4565b81526000858152610291602090815260409091209101906116bd9060086123b4565b81526020016000815250905060006040518060c0016040528060328152602001611704600961029160008981526020019081526020016000206123b490919063ffffffff16565b815260008681526102916020908152604090912091019061172690600a6123b4565b815260008681526102916020908152604090912091019061174890600b6123b4565b815260008681526102916020908152604090912091019061176a90600c6123b4565b81526020016000815250905060006040518061010001604052808681526020016117b1600061029160008a81526020019081526020016000206123b490919063ffffffff16565b81526000878152610291602090815260409091209101906117d39060036123b4565b81526000878152610291602090815260409091209101906117f59060076123b4565b81526020018481526020018381526020016040518060600160405280611838600661029160008c81526020019081526020016000206123b490919063ffffffff16565b81526020016000815260200160008152508152602001604051806080016040528060008152602001600081526020016000815260200160008152508152509050806040516020016118899190614def565b6040516020818303038152906040529350505050919050565b6000805160206159028339815191526118ba81611fdc565b60005b8351811015610eae578281815181106118d8576118d8614d42565b60200260200101516102926000878152602001908152602001600020600086848151811061190857611908614d42565b602002602001015181526020019081526020016000209080519060200190611931929190614209565b508061193c81614d6e565b9150506118bd565b60008051602061590283398151915261195c81611fdc565b610908610225836125fd565b8161197561022582611ea9565b156119925760405162461bcd60e51b81526004016108f590614d15565b6109088383612612565b6000805160206159028339815191526119b481611fdc565b815161090890610294906020850190614209565b6119ec60405180606001604052806060815260200160008152602001606081525090565b6000805160206158a5833981519152611a0481611fdc565b6001600160a01b038316600090815261028a602090815260409182902082518154608093810282018401909452606081018481529093919284928491840182828015611a6f57602002820191906000526020600020905b815481526020019060010190808311611a5b575b505050505081526020016001820154815260200160028201805480602002602001604051908101604052809291908181526020018280548015611ad157602002820191906000526020600020905b815481526020019060010190808311611abd575b50505050508152505091505b50919050565b6060600082516001600160401b03811115611b0057611b006143f0565b604051908082528060200260200182016040528015611b3357816020015b6060815260200190600190039081611b1e5790505b50905060005b8351811015610f9257611b64848281518110611b5757611b57614d42565b602002602001015161261d565b828281518110611b7657611b76614d42565b60200260200101819052508080611b8c90614d6e565b915050611b39565b611b9e3383612035565b611bba5760405162461bcd60e51b81526004016108f590614d89565b6109ec848484846127c5565b60008181526102916020526040812060609190611be390826123b4565b60008181527f64b0ea277fa228112a0515bbec12ee5ad8763a1bd8c09dfcbf922eaedf8fb8a36020526040812080549293509091611c2090614ce0565b80601f0160208091040260200160405190810160405280929190818152602001828054611c4c90614ce0565b8015611c995780601f10611c6e57610100808354040283529160200191611c99565b820191906000526020600020905b815481529060010190602001808311611c7c57829003601f168201915b505050505090506000610293611cae846127f8565b604051602001611cbf929190614f15565b60405160208183030381529060405290506000610294611cde876127f8565b604051602001611cef929190614f15565b6040516020818303038152906040529050600083611d0c886127f8565b8484604051602001611d219493929190614fb3565b60405160208183030381529060405290506000611d3d886128f5565b905060008282604051602001611d549291906150ab565b6040516020818303038152906040529050611d6e81612996565b604051602001611d7e91906150f8565b604051602081830303815290604052975050505050505050919050565b60008181526101906020526040812061080c90612ae9565b6060611dc06101c26123a7565b905090565b600082815261015e6020526040902060010154611de181611fdc565b610908838361227e565b6000611dc06101c2612ae9565b600080516020615902833981519152611e1081611fdc565b61090861022583611fe6565b6000805160206158a5833981519152611e3481611fdc565b600084815261029160205260409020610eae9084846123c0565b600061080c82612af3565b611e6281612b18565b610bd35760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016108f5565b6001600160a01b0381166000908152600183016020526040812054151561158d565b6000611ed682610d7a565b9050806001600160a01b0316836001600160a01b03161415611f445760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016108f5565b336001600160a01b0382161480611f605750611f608133610793565b611fd25760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c000060648201526084016108f5565b6109088383612b37565b610bd38133612ba5565b600061158d836001600160a01b038416612c09565b600082815261028d60209081526040808320546001600160a01b0316835261028a8252909120825161090892600290920191840190614289565b60008061204183610d7a565b9050806001600160a01b0316846001600160a01b0316148061208857506001600160a01b038082166000908152609b602090815260408083209388168352929052205460ff165b806120ac5750836001600160a01b03166120a1846108a4565b6001600160a01b0316145b949350505050565b826001600160a01b03166120c782610d7a565b6001600160a01b03161461212b5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016108f5565b6001600160a01b03821661218d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016108f5565b612198838383612cfc565b6121a3600082612b37565b6001600160a01b03831660009081526099602052604081208054600192906121cc90849061513d565b90915550506001600160a01b03821660009081526099602052604081208054600192906121fa908490614dd7565b909155505060008181526098602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6122658282612e78565b60008281526101906020526040902061090890826125fd565b6122888282612eff565b6000828152610190602052604090206109089082611fe6565b6122a9612f67565b61012c805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061158d8383612fb1565b600061230b82610d7a565b905061231981600084612cfc565b612324600083612b37565b6001600160a01b038116600090815260996020526040812080546001929061234d90849061513d565b909155505060008281526098602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6060600061158d83613000565b600061158d838361305c565b60006120ac8484846130cc565b610a478282604051806020016040528060008152506130e9565b600054610100900460ff1661240e5760405162461bcd60e51b81526004016108f590615154565b610a47828261311c565b600054610100900460ff1661243f5760405162461bcd60e51b81526004016108f590615154565b612447612478565b565b600054610100900460ff166124705760405162461bcd60e51b81526004016108f590615154565b61244761316a565b600054610100900460ff166124475760405162461bcd60e51b81526004016108f590615154565b600054610100900460ff166124c65760405162461bcd60e51b81526004016108f590615154565b61243f612478565b600054610100900460ff166124f55760405162461bcd60e51b81526004016108f590615154565b6124fd612478565b6125068461319e565b6109ec848484846131ce565b61251a613255565b61012c805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122d73390565b6060600061255d83610f99565b90506000816001600160401b03811115612579576125796143f0565b6040519080825280602002602001820160405280156125a2578160200160208202803683370190505b50905060005b828110156125e9576125ba8582610aa3565b8282815181106125cc576125cc614d42565b6020908102919091010152806125e181614d6e565b9150506125a8565b509392505050565b600061158d838361329c565b600061158d836001600160a01b038416612fb1565b610a473383836132c6565b6000818152610291602052604081206060919061263a90826123b4565b60008181527f64b0ea277fa228112a0515bbec12ee5ad8763a1bd8c09dfcbf922eaedf8fb8a3602052604081208054929350909161267790614ce0565b80601f01602080910402602001604051908101604052809291908181526020018280546126a390614ce0565b80156126f05780601f106126c5576101008083540402835291602001916126f0565b820191906000526020600020905b8154815290600101906020018083116126d357829003601f168201915b505050505090506000610293612705846127f8565b604051602001612716929190614f15565b60405160208183030381529060405290506000610294612735876127f8565b604051602001612746929190614f15565b6040516020818303038152906040529050600083612763886127f8565b84846040516020016127789493929190614fb3565b60405160208183030381529060405290506000612794886128f5565b905081816040516020016127a99291906150ab565b6040516020818303038152906040529650505050505050919050565b6127d08484846120b4565b6127dc84848484613395565b6109ec5760405162461bcd60e51b81526004016108f59061519f565b60608161281c5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612846578061283081614d6e565b915061283f9050600a83615207565b9150612820565b6000816001600160401b03811115612860576128606143f0565b6040519080825280601f01601f19166020018201604052801561288a576020820181803683370190505b5090505b84156120ac5761289f60018361513d565b91506128ac600a8661521b565b6128b7906030614dd7565b60f81b8183815181106128cc576128cc614d42565b60200101906001600160f81b031916908160001a9053506128ee600a86615207565b945061288e565b60606000612902836134a2565b9050600061290f84613712565b9050600061291c8561392a565b9050600083604051602001612931919061522f565b604051602081830303815290604052905060008383604051602001612957929190615267565b6040516020818303038152906040529050818160405160200161297b9291906152a2565b60405160208183030381529060405295505050505050919050565b60608151600014156129b657505060408051602081019091526000815290565b600060405180606001604052806040815260200161586560409139905060006003845160026129e59190614dd7565b6129ef9190615207565b6129fa9060046152d1565b6001600160401b03811115612a1157612a116143f0565b6040519080825280601f01601f191660200182016040528015612a3b576020820181803683370190505b509050600182016020820185865187015b80821015612aa7576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250612a4c565b5050600386510660018114612ac35760028114612ad657612ade565b603d6001830353603d6002830353612ade565b603d60018303535b509195945050505050565b600061080c825490565b60006001600160e01b03198216635a05180f60e01b148061080c575061080c82613b45565b6000818152609860205260408120546001600160a01b0316151561080c565b6000818152609a6020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612b6c82610d7a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612baf8282611594565b610a4757612bc7816001600160a01b03166014613b6a565b612bd2836020613b6a565b604051602001612be39291906152f0565b60408051601f198184030181529082905262461bcd60e51b82526108f591600401614363565b60008181526001830160205260408120548015612cf2576000612c2d60018361513d565b8554909150600090612c419060019061513d565b9050818114612ca6576000866000018281548110612c6157612c61614d42565b9060005260206000200154905080876000018481548110612c8457612c84614d42565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612cb757612cb7615365565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061080c565b600091505061080c565b612d04613255565b828282732f52abfca2074b99759b58345bb984419d3042437339af60141b91f7941eb13aeda2124a61a953b7c073328eb74673eaa1d2d90a48e8137b015f1b6ed35d6032841180612d5c57506001600160a01b038616155b80612d6e57506001600160a01b038516155b80612d8a5750826001600160a01b0316866001600160a01b0316145b80612da65750826001600160a01b0316856001600160a01b0316145b80612dc25750816001600160a01b0316866001600160a01b0316145b80612dde5750816001600160a01b0316856001600160a01b0316145b80612dfa5750806001600160a01b0316866001600160a01b0316145b80612e165750806001600160a01b0316856001600160a01b0316145b612e625760405162461bcd60e51b815260206004820152601d60248201527f5465616d2045766f20617265206e6f6e2d7472616e7366657261626c6500000060448201526064016108f5565b612e6d898989613d05565b505050505050505050565b612e828282611594565b610a4757600082815261015e602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612ebb3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b612f098282611594565b15610a4757600082815261015e602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b61012c5460ff166124475760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108f5565b6000818152600183016020526040812054612ff85750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561080c565b50600061080c565b60608160000180548060200260200160405190810160405280929190818152602001828054801561305057602002820191906000526020600020905b81548152602001906001019080831161303c575b50505050509050919050565b60008181526002830160205260408120548015158061308057506130808484613d64565b61158d5760405162461bcd60e51b815260206004820152601e60248201527f456e756d657261626c654d61703a206e6f6e6578697374656e74206b6579000060448201526064016108f5565b600082815260028401602052604081208290556120ac84846122f4565b6130f38383613d70565b6131006000848484613395565b6109085760405162461bcd60e51b81526004016108f59061519f565b600054610100900460ff166131435760405162461bcd60e51b81526004016108f590615154565b8151613156906096906020850190614209565b508051610908906097906020840190614209565b600054610100900460ff166131915760405162461bcd60e51b81526004016108f590615154565b61012c805460ff19169055565b600054610100900460ff166131c55760405162461bcd60e51b81526004016108f590615154565b610bd381613eaf565b600054610100900460ff166131f55760405162461bcd60e51b81526004016108f590615154565b61025880546001600160a01b039095166001600160a01b03199095169490941790935561025a80546102599390935561ffff909316680100000000000000000269ffffffffffffffffffff199092166001600160401b0390911617179055565b61012c5460ff16156124475760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108f5565b60008260000182815481106132b3576132b3614d42565b9060005260206000200154905092915050565b816001600160a01b0316836001600160a01b031614156133285760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016108f5565b6001600160a01b038381166000818152609b6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60006001600160a01b0384163b1561349757604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906133d990339089908890889060040161537b565b602060405180830381600087803b1580156133f357600080fd5b505af1925050508015613423575060408051601f3d908101601f19168201909252613420918101906153b8565b60015b61347d573d808015613451576040519150601f19603f3d011682016040523d82523d6000602084013e613456565b606091505b5080516134755760405162461bcd60e51b81526004016108f59061519f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506120ac565b506001949350505050565b600081815261029160205260408120606091907f64b0ea277fa228112a0515bbec12ee5ad8763a1bd8c09dfcbf922eaedf8fb8a39082906134e390826123b4565b815260200190815260200160002080546134fc90614ce0565b80601f016020809104026020016040519081016040528092919081815260200182805461352890614ce0565b80156135755780601f1061354a57610100808354040283529160200191613575565b820191906000526020600020905b81548152906001019060200180831161355857829003601f168201915b505050600086815261029160205260408120939450927fdd65ea48f42c32853e504599a5705633f5988eee4bc61d4ec3f69b9a5eece21192508391506135bc9060016123b4565b815260200190815260200160002080546135d590614ce0565b80601f016020809104026020016040519081016040528092919081815260200182805461360190614ce0565b801561364e5780601f106136235761010080835404028352916020019161364e565b820191906000526020600020905b81548152906001019060200180831161363157829003601f168201915b505050600087815261029160205260408120939450926136729250905060026123b4565b1561369b576040518060400160405280600681526020016546656d616c6560d01b8152506136b9565b604051806040016040528060048152602001634d616c6560e01b8152505b600086815261029160205260408120919250906136d79060036123b4565b90508383836136e5846127f8565b6040516020016136f894939291906153d5565b604051602081830303815290604052945050505050919050565b600081815261029160205260408120606091907fda3736b6211b14d372b9ecb2464211a5db2c6794abdf366575bf09e94acae9c69082906137549060046123b4565b8152602001908152602001600020805461376d90614ce0565b80601f016020809104026020016040519081016040528092919081815260200182805461379990614ce0565b80156137e65780601f106137bb576101008083540402835291602001916137e6565b820191906000526020600020905b8154815290600101906020018083116137c957829003601f168201915b505050600086815261029160205260408120939450927fda3736b6211b14d372b9ecb2464211a5db2c6794abdf366575bf09e94acae9c6925083915061382d9060056123b4565b8152602001908152602001600020805461384690614ce0565b80601f016020809104026020016040519081016040528092919081815260200182805461387290614ce0565b80156138bf5780601f10613894576101008083540402835291602001916138bf565b820191906000526020600020905b8154815290600101906020018083116138a257829003601f168201915b505050600087815261029160205260408120939450926138e39250905060066123b4565b600086815261029160205260408120919250906139019060076123b4565b9050838361390e846127f8565b613917846127f8565b6040516020016136f894939291906154fd565b600081815261029160205260408120606091907f6278f01af0addd8c6e4df064e22ea61de8f79a3d04d6ca1865112dfd8f6ccf8590829061396c9060086123b4565b8152602001908152602001600020805461398590614ce0565b80601f01602080910402602001604051908101604052809291908181526020018280546139b190614ce0565b80156139fe5780601f106139d3576101008083540402835291602001916139fe565b820191906000526020600020905b8154815290600101906020018083116139e157829003601f168201915b50505060008681526102916020526040812093945092613a229250905060096123b4565b60008581526102916020526040812091925090613a4090600a6123b4565b60008681526102916020526040812091925090613a5e90600b6123b4565b60008781526102916020526040812091925090613a7c90600c6123b4565b60008881526102916020526040812091925090613a9a90600d6123b4565b9050600086613aa8876127f8565b613ab1876127f8565b604051602001613ac39392919061567d565b60405160208183030381529060405290506000613adf856127f8565b613ae8856127f8565b613af1856127f8565b604051602001613b039392919061575e565b60405160208183030381529060405290508181604051602001613b279291906152a2565b60405160208183030381529060405298505050505050505050919050565b60006001600160e01b03198216637965db0b60e01b148061080c575061080c82613f00565b60606000613b798360026152d1565b613b84906002614dd7565b6001600160401b03811115613b9b57613b9b6143f0565b6040519080825280601f01601f191660200182016040528015613bc5576020820181803683370190505b509050600360fc1b81600081518110613be057613be0614d42565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613c0f57613c0f614d42565b60200101906001600160f81b031916908160001a9053506000613c338460026152d1565b613c3e906001614dd7565b90505b6001811115613cb6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613c7257613c72614d42565b1a60f81b828281518110613c8857613c88614d42565b60200101906001600160f81b031916908160001a90535060049490941c93613caf8161584d565b9050613c41565b50831561158d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108f5565b82613d1261022582611ea9565b15613d2f5760405162461bcd60e51b81526004016108f590614d15565b82613d3c61022582611ea9565b15613d595760405162461bcd60e51b81526004016108f590614d15565b610eae858585613f0b565b600061158d8383613f16565b6001600160a01b038216613dc65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016108f5565b613dcf81612b18565b15613e1c5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016108f5565b613e2860008383612cfc565b6001600160a01b0382166000908152609960205260408120805460019290613e51908490614dd7565b909155505060008181526098602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600054610100900460ff16613ed65760405162461bcd60e51b81526004016108f590615154565b600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b600061080c82613f2e565b610908838383613f53565b6000818152600183016020526040812054151561158d565b60006001600160e01b0319821663780e9d6360e01b148061080c575061080c8261400b565b6001600160a01b038316613fae57613fa98160ca8054600083815260cb60205260408120829055600182018355919091527f42d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee10155565b613fd1565b816001600160a01b0316836001600160a01b031614613fd157613fd1838261405b565b6001600160a01b038216613fe857610908816140f8565b826001600160a01b0316826001600160a01b0316146109085761090882826141a7565b60006001600160e01b031982166380ac58cd60e01b148061403c57506001600160e01b03198216635b5e139f60e01b145b8061080c57506301ffc9a760e01b6001600160e01b031983161461080c565b6000600161406884610f99565b614072919061513d565b600083815260c960205260409020549091508082146140c5576001600160a01b038416600090815260c860209081526040808320858452825280832054848452818420819055835260c990915290208190555b50600091825260c9602090815260408084208490556001600160a01b03909416835260c881528383209183525290812055565b60ca5460009061410a9060019061513d565b600083815260cb602052604081205460ca805493945090928490811061413257614132614d42565b906000526020600020015490508060ca838154811061415357614153614d42565b600091825260208083209091019290925582815260cb909152604080822084905585825281205560ca80548061418b5761418b615365565b6001900381819060005260206000200160009055905550505050565b60006141b283610f99565b6001600160a01b03909316600090815260c860209081526040808320868452825280832085905593825260c99052919091209190915550565b5080546000825590600052602060002090810190610bd391906142c3565b82805461421590614ce0565b90600052602060002090601f016020900481019282614237576000855561427d565b82601f1061425057805160ff191683800117855561427d565b8280016001018555821561427d579182015b8281111561427d578251825591602001919060010190614262565b50610c549291506142c3565b82805482825590600052602060002090810192821561427d579160200282018281111561427d578251825591602001919060010190614262565b5b80821115610c5457600081556001016142c4565b6001600160e01b031981168114610bd357600080fd5b60006020828403121561430057600080fd5b813561158d816142d8565b60005b8381101561432657818101518382015260200161430e565b838111156109ec5750506000910152565b6000815180845261434f81602086016020860161430b565b601f01601f19169290920160200192915050565b60208152600061158d6020830184614337565b60006020828403121561438857600080fd5b5035919050565b80356001600160a01b03811681146143a657600080fd5b919050565b600080604083850312156143be57600080fd5b6143c78361438f565b946020939093013593505050565b6000602082840312156143e757600080fd5b61158d8261438f565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715614429576144296143f0565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614457576144576143f0565b604052919050565b60006001600160401b03821115614478576144786143f0565b5060051b60200190565b600060c0828403121561449457600080fd5b60405160c081018181106001600160401b03821117156144b6576144b66143f0565b8060405250809150823581526020830135602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201525092915050565b60006060828403121561450d57600080fd5b604051606081018181106001600160401b038211171561452f5761452f6143f0565b80604052508091508235815260208301356020820152604083013560408201525092915050565b60006080828403121561456857600080fd5b604051608081018181106001600160401b038211171561458a5761458a6143f0565b8060405250809150823581526020830135602082015260408301356040820152606083013560608201525092915050565b60006102e082840312156145ce57600080fd5b6145d6614406565b9050813581526020820135602082015260408201356040820152606082013560608201526146078360808401614482565b608082015261461a836101408401614482565b60a082015261462d8361020084016144fb565b60c0820152614640836102608401614556565b60e082015292915050565b6000806040838503121561465e57600080fd5b6146678361438f565b91506020808401356001600160401b0381111561468357600080fd5b8401601f8101861361469457600080fd5b80356146a76146a28261445f565b61442f565b8181526102e091820283018401918482019190898411156146c757600080fd5b938501935b838510156146ed576146de8a866145bb565b835293840193918501916146cc565b5080955050505050509250929050565b600082601f83011261470e57600080fd5b8135602061471e6146a28361445f565b82815260059290921b8401810191818101908684111561473d57600080fd5b8286015b848110156147585780358352918301918301614741565b509695505050505050565b6000806040838503121561477657600080fd5b8235915060208301356001600160401b0381111561479357600080fd5b61479f858286016146fd565b9150509250929050565b6000806000606084860312156147be57600080fd5b6147c78461438f565b92506147d56020850161438f565b9150604084013590509250925092565b600080604083850312156147f857600080fd5b823591506148086020840161438f565b90509250929050565b6020808252825182820181905260009190848201906040850190845b818110156148525783516001600160a01b03168352928401929184019160010161482d565b50909695505050505050565b60008060006060848603121561487357600080fd5b8335925060208401356001600160401b038082111561489157600080fd5b61489d878388016146fd565b935060408601359150808211156148b357600080fd5b506148c0868287016146fd565b9150509250925092565b60006001600160401b038311156148e3576148e36143f0565b6148f6601f8401601f191660200161442f565b905082815283838301111561490a57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261493257600080fd5b61158d838335602085016148ca565b60006020828403121561495357600080fd5b81356001600160401b0381111561496957600080fd5b6120ac84828501614921565b60006020828403121561498757600080fd5b81356001600160401b0381111561499d57600080fd5b6120ac848285016146fd565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156149fe57603f198886030184526149ec858351614337565b945092850192908501906001016149d0565b5092979650505050505050565b6000806103008385031215614a1f57600080fd5b614a288361438f565b915061480884602085016145bb565b600081518084526020808501945080840160005b83811015614a6757815187529582019590820190600101614a4b565b509495945050505050565b60208152600061158d6020830184614a37565b60008060408385031215614a9857600080fd5b50508035926020909101359150565b600080600060608486031215614abc57600080fd5b833592506020808501356001600160401b0380821115614adb57600080fd5b614ae7888389016146fd565b94506040870135915080821115614afd57600080fd5b818701915087601f830112614b1157600080fd5b8135614b1f6146a28261445f565b81815260059190911b8301840190848101908a831115614b3e57600080fd5b8585015b83811015614b7657803585811115614b5a5760008081fd5b614b688d89838a0101614921565b845250918601918601614b42565b508096505050505050509250925092565b60008060408385031215614b9a57600080fd5b614ba38361438f565b915060208301358015158114614bb857600080fd5b809150509250929050565b602081526000825160606020840152614bdf6080840182614a37565b9050602084015160408401526040840151601f19848303016060850152614c068282614a37565b95945050505050565b60008060008060808587031215614c2557600080fd5b614c2e8561438f565b9350614c3c6020860161438f565b92506040850135915060608501356001600160401b03811115614c5e57600080fd5b8501601f81018713614c6f57600080fd5b614c7e878235602084016148ca565b91505092959194509250565b60008060408385031215614c9d57600080fd5b614ca68361438f565b91506148086020840161438f565b600080600060608486031215614cc957600080fd5b505081359360208301359350604090920135919050565b600181811c90821680614cf457607f821691505b60208210811415611add57634e487b7160e01b600052602260045260246000fd5b602080825260139082015272426c61636b6c6973746564206164647265737360681b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415614d8257614d82614d58565b5060010190565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b60008219821115614dea57614dea614d58565b500190565b60006102e082019050825182526020830151602083015260408301516040830152606083015160608301526080830151614e616080840182805182526020810151602083015260408101516040830152606081015160608301526080810151608083015260a081015160a08301525050565b5060a08381015180516101408501526020808201516101608601526040808301516101808701526060808401516101a088015260808401516101c088015292909301516101e086015260c086015180516102008701528082015161022087015283015161024086015260e0860151805161026087015290810151610280860152918201516102a08501528101516102c0840152610f92565b60008151614f0b81856020860161430b565b9290920192915050565b600080845481600182811c915080831680614f3157607f831692505b6020808410821415614f5157634e487b7160e01b86526022600452602486fd5b818015614f655760018114614f7657614fa3565b60ff19861689528489019650614fa3565b60008b81526020902060005b86811015614f9b5781548b820152908501908301614f82565b505084890196505b505050505050614c068185614ef9565b67113730b6b2911d1160c11b81528451600090614fd7816008850160208a0161430b565b61202360f01b6008918401918201528551614ff981600a840160208a0161430b565b61088b60f21b600a92909101918201527f226465736372697074696f6e223a2245766f5665727365732045766f222c0000600c820152681134b6b0b3b2911d1160b91b602a820152845161505481603384016020890161430b565b650b9c1b99c88b60d21b60339290910191820152701130b734b6b0ba34b7b72fbab936111d1160791b60398201526150a0615092604a830186614ef9565b61088b60f21b815260020190565b979650505050505050565b607b60f81b8152600083516150c781600185016020880161430b565b8351908301906150de81600184016020880161430b565b607d60f81b60019290910191820152600201949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161513081601d85016020870161430b565b91909101601d0192915050565b60008282101561514f5761514f614d58565b500390565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b600082615216576152166151f1565b500490565b60008261522a5761522a6151f1565b500690565b6e2261747472696275746573223a205b60881b8152815160009061525a81600f85016020870161430b565b91909101600f0192915050565b6000835161527981846020880161430b565b83519083019061528d81836020880161430b565b605d60f81b9101908152600101949350505050565b600083516152b481846020880161430b565b8351908301906152c881836020880161430b565b01949350505050565b60008160001904831182151516156152eb576152eb614d58565b500290565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161532881601785016020880161430b565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161535981602884016020880161430b565b01602801949350505050565b634e487b7160e01b600052603160045260246000fd5b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906153ae90830184614337565b9695505050505050565b6000602082840312156153ca57600080fd5b815161158d816142d8565b7f7b2274726169745f74797065223a2253706563696573222c2276616c7565223a8152601160f91b602082015260008551615417816021850160208a0161430b565b62089f4b60ea1b60219184019182018190527f7b2274726169745f74797065223a22526172697479222c2276616c7565223a2260248301528651615462816044850160208b0161430b565b604492019182018190527f7b2274726169745f74797065223a2247656e646572222c2276616c7565223a22604783015285516154a5816067850160208a0161430b565b60679201918201527f7b2274726169745f74797065223a2247656e65726174696f6e222c2276616c75606a8201526232911d60e91b608a8201526150a06154ef608d830186614ef9565b611f4b60f21b815260020190565b7f7b2274726169745f74797065223a225072696d6172792054797065222c227661815265363ab2911d1160d11b602082015260008551615544816026850160208a0161430b565b62089f4b60ea1b60269184019182018190527f7b2274726169745f74797065223a225365636f6e646172792054797065222c226029830152673b30b63ab2911d1160c11b604983015286516155a0816051850160208b0161430b565b60519201918201527f7b2274726169745f74797065223a22427265656420436f756e74222c2276616c6054820152633ab2911d60e11b60748201526150a06154ef615677615642826156346155f982607889018d614ef9565b7f7b2274726169745f74797065223a22417661696c61626c65204272656564732281526816113b30b63ab2911d60b91b602082015260290190565b612d3160f01b815260020190565b7f7b2274726169745f74797065223a22457870657269656e6365222c2276616c7581526232911d60e91b602082015260230190565b86614ef9565b7f7b2274726169745f74797065223a224e6174757265222c2276616c7565223a228152600084516156b581602085016020890161430b565b808301905062089f4b60ea1b60208201527f7b2274726169745f74797065223a2241747461636b222c2276616c7565223a00602382015284516156ff81604284016020890161430b565b808201915050611f4b60f21b8060428301527f7b2274726169745f74797065223a22446566656e7365222c2276616c7565223a6044830152845161574a81606485016020890161430b565b606492019182015260660195945050505050565b7f7b2274726169745f74797065223a225370656369616c222c2276616c7565223a81526000845161579681602085016020890161430b565b8083019050611f4b60f21b8060208301527f7b2274726169745f74797065223a225370656369616c20446566656e7365222c602283015267113b30b63ab2911d60c11b604283015285516157f181604a850160208a0161430b565b604a9201918201527f7b2274726169745f74797065223a225370656564222c2276616c7565223a0000604c820152835161583281606a84016020880161430b565b607d60f81b606a9290910191820152606b0195945050505050565b60008161585c5761585c614d58565b50600019019056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a668747470733a2f2f6769746875622e636f6d2f45766f5665727365732f7075626c69632d6173736574732f7261772f6d61696e2f6e6674732f45766f2fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a264697066735822122064ad2b314201f52c2ba88df8d6a0e726ec0ebea724e366ad87fb3bf0c8b7635764736f6c63430008090033

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.