Contract 0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc41

 

Contract Overview

Balance:
0 MATIC

MATIC Value:
$0.00

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x361b439f6ce7df7108f009687406165f2ca38670389b91b0cc3715f3988f7751Bulk Mint190574312021-09-13 10:27:4778 days 1 hr ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.0095746507
0x525cc7cc04ec5d96e91702550b1fa798829dd5095fdfeafff58cf565239c7324Bulk Mint190306612021-09-12 16:27:3678 days 19 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.06426104
0x5d3da368efee89e65735bb481a767ab85996437a7ea3428a3077575a87f1b4dfBulk Mint190246192021-09-12 12:20:5278 days 23 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.07489680156
0x85a585dcc76fe443d0ae4738c14f85808e5cd2ece927593a4ca5655e0509e3eaBulk Mint190003392021-09-11 19:14:0779 days 16 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.0803269
0xc5dec7201b295f7474cbddb78d0f6df8e3bc0873763178efcbc5af874eb15716Bulk Mint189937852021-09-11 14:44:3279 days 21 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.00080036106
0x1e0103f7fdb47b7a2244d40e4822a74f3525321e2a1adc450af39b38f3031ca2Bulk Mint189925572021-09-11 13:50:5879 days 22 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.002595852
0xbd02720a32264e3afa71679a9178431978e19c43c32c6ac7810ac80c2ea83396Bulk Mint189683322021-09-10 22:03:5280 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.3767506
0x97b0d590eede63749bf72ffcf1da3f48cbb9543b5c0a11e3a5dbbfcd002b4158Bulk Mint189682982021-09-10 22:02:4080 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74732015
0x19e09d3cd5bd1cda402206eb99a283e015315ad90b0132d90501c8354da5a53eBulk Mint189682572021-09-10 22:01:1880 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74731835
0x0f2e2de140b203f495ef76148f8cfba603935d5d67cf1495fca0af90007ccb83Bulk Mint189682272021-09-10 22:00:1480 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74731775
0x5f35a86e73fda7b80403ad573081020f25855c0adcff7fee4d56296c1dd7eb5bBulk Mint189681562021-09-10 21:57:4880 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74731955
0x8b02d9d7c8a677eddb9fb9f0c01b2286dd8493895e80ef18522b6b18ee987b6aBulk Mint189681082021-09-10 21:56:0880 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74731895
0x99cdb474a9da5fdbf227d520bdb22301b6f14e9649e784704b4f9f03e02d2950Bulk Mint189679642021-09-10 21:51:0980 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74707895
0x53ed5f87083652805065228ff6521527b195d5cf9fd367d06ed4e211786bbfb8Bulk Mint189676812021-09-10 21:41:2580 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74731955
0x2641cab10dbbffb4a8967dd9fb9b74889895235e596e8c37fdcf0414b1b3c303Bulk Mint189674452021-09-10 21:33:1780 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74731955
0x63e084f7d115a0a8c7a6b4d83f32af421e7f89cdb86e3fc81d8e2ba9db388149Bulk Mint189673912021-09-10 21:31:2280 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74731955
0xbcdd0f5eb43cfde8ef8d2e5da8a5982e130ebd622d174d3b78c5d30c84c373eeBulk Mint189671632021-09-10 21:23:2280 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.74708015
0xf420636f12adbb54322b9b4dd76e30c7db4af3fef483e5dfa0052fd8adff0f06Bulk Mint189669462021-09-10 21:13:5680 days 14 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.23953886
0xe7aad8c2dc2b5a2bf6f651852e9e0780b814f83c28d9252c531abfbe65bdd71eBulk Mint189667082021-09-10 21:03:3680 days 15 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.8953187
0x22ff321bc09843e2ff128949e9255de548f5d8c0b5bfe03b309282cacd0b4fe1Bulk Mint189666582021-09-10 21:01:5680 days 15 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.8955593
0x9fe64310ee7866c680ee5146f0a4c7217cebee4f33b880fe1a1bf6cc2fa311eeBulk Mint189620192021-09-10 18:01:1780 days 18 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.004810729828
0xb3d5b273a93426127c8efcb792907ac7dc86744581e4787aaf144cad3e63a74aBulk Mint189620192021-09-10 18:01:1780 days 18 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.014780032423
0x588d5523f098076958353c2705503e66bf9e98bf706e421b7b8c4198cd0a957bBulk Mint189620192021-09-10 18:01:1780 days 18 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.06556905
0x71b13d8ecf17a9592ae64315ee6e1159bf6c3cc3227f3eb13ce4a09fe1a13575Bulk Mint189612662021-09-10 17:31:0780 days 18 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.00582253164
0xe320d0825dba17043cdc6c7c8fd07e7d92ca72bded69e7bc4a17cda5412f0868Bulk Mint189593762021-09-10 16:21:2780 days 19 hrs ago0x562d520ad50b63c0bae3278fb332b01bf96eead4 IN  0x4ca8fd22b97399421e9d0cb6f0765bd0a23ddc410 MATIC0.0360535
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SGE

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at polygonscan.com on 2021-09-02
*/

// Sources flattened with hardhat v2.4.1 https://hardhat.org

// File @openzeppelin/contracts/utils/[email protected]

// 

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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


// File @openzeppelin/contracts/utils/[email protected]

// 

pragma solidity ^0.8.0;

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

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

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

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

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

}


// File @openzeppelin/contracts/utils/introspection/[email protected]

// 

pragma solidity ^0.8.0;

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


// File @openzeppelin/contracts/utils/introspection/[email protected]

// 

pragma solidity ^0.8.0;

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


// File @openzeppelin/contracts/access/[email protected]

// 

pragma solidity ^0.8.0;



/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    function hasRole(bytes32 role, address account) external view returns (bool);
    function getRoleAdmin(bytes32 role) external view returns (bytes32);
    function grantRole(bytes32 role, address account) external;
    function revokeRole(bytes32 role, address account) external;
    function renounceRole(bytes32 role, address account) external;
}

/**
 * @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 AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping (address => bool) members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

    /**
     * @dev 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]{20}) is missing role (0x[0-9a-f]{32})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

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

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

    /**
     * @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]{20}) is missing role (0x[0-9a-f]{32})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        if(!hasRole(role, account)) {
            revert(string(abi.encodePacked(
                "AccessControl: account ",
                Strings.toHexString(uint160(account), 20),
                " is missing role ",
                Strings.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 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.
     */
    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.
     */
    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 granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    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.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

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

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

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


// File @openzeppelin/contracts/utils/structs/[email protected]

// 

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.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

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

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

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

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

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

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = 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) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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


// File @openzeppelin/contracts/access/[email protected]

// 

pragma solidity ^0.8.0;


/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable {
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

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

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlEnumerable).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 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 override returns (uint256) {
        return _roleMembers[role].length();
    }

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

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

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

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


// File @openzeppelin/contracts/security/[email protected]

// 

pragma solidity ^0.8.0;

/**
 * @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 Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

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

    bool private _paused;

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

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

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

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

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

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


// File @openzeppelin/contracts/token/ERC721/[email protected]

// 

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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


// File @openzeppelin/contracts/token/ERC721/[email protected]

// 

pragma solidity ^0.8.0;

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


// File @openzeppelin/contracts/token/ERC721/extensions/[email protected]

// 

pragma solidity ^0.8.0;

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {

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

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

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


// File @openzeppelin/contracts/utils/[email protected]

// 

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}


// File @openzeppelin/contracts/token/ERC721/[email protected]

// 

pragma solidity ^0.8.0;







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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
     * in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);
    }

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

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        private returns (bool)
    {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver(to).onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    // solhint-disable-next-line no-inline-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` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}


// File @openzeppelin/contracts-upgradeable/proxy/utils/[email protected]

// 

// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;

/**
 * @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 a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}


// File @openzeppelin/contracts-upgradeable/utils/[email protected]

// 

pragma solidity ^0.8.0;

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

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

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


// File @openzeppelin/contracts-upgradeable/utils/[email protected]

// 

pragma solidity ^0.8.0;

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

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

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

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

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

}


// File @openzeppelin/contracts-upgradeable/utils/introspection/[email protected]

// 

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 @openzeppelin/contracts-upgradeable/utils/introspection/[email protected]

// 

pragma solidity ^0.8.0;


/**
 * @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 initializer {
        __ERC165_init_unchained();
    }

    function __ERC165_init_unchained() internal initializer {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}


// File @openzeppelin/contracts-upgradeable/access/[email protected]

// 

pragma solidity ^0.8.0;




/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    function hasRole(bytes32 role, address account) external view returns (bool);
    function getRoleAdmin(bytes32 role) external view returns (bytes32);
    function grantRole(bytes32 role, address account) external;
    function revokeRole(bytes32 role, address account) external;
    function renounceRole(bytes32 role, address account) external;
}

/**
 * @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 initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
    }

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

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

    /**
     * @dev 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]{20}) is missing role (0x[0-9a-f]{32})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

    /**
     * @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 override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @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]{20}) is missing role (0x[0-9a-f]{32})$/
     */
    function _checkRole(bytes32 role, address account) internal view {
        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 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.
     */
    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.
     */
    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 granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    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.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

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

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

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}


// File @openzeppelin/contracts-upgradeable/access/[email protected]

// 

pragma solidity ^0.8.0;


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

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

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

    function __Ownable_init_unchained() internal initializer {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

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

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


// File @openzeppelin/contracts-upgradeable/token/ERC721/[email protected]

// 

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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


// File @openzeppelin/contracts-upgradeable/token/ERC721/[email protected]

// 

pragma solidity ^0.8.0;

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


// File @openzeppelin/contracts-upgradeable/token/ERC721/extensions/[email protected]

// 

pragma solidity ^0.8.0;

/**
 * @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 @openzeppelin/contracts-upgradeable/utils/[email protected]

// 

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}


// File @openzeppelin/contracts-upgradeable/token/ERC721/[email protected]

// 

pragma solidity ^0.8.0;








/**
 * @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 initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __ERC721_init_unchained(name_, symbol_);
    }

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

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

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

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

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

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

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

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

    /**
     * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
     * in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @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 of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);
    }

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

    /**
     * @dev 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(to).onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    // solhint-disable-next-line no-inline-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` 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 { }
    uint256[44] private __gap;
}


// File @openzeppelin/contracts-upgradeable/token/ERC721/extensions/[email protected]

// 

pragma solidity ^0.8.0;



/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable {
    function __ERC721Burnable_init() internal initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __ERC721Burnable_init_unchained();
    }

    function __ERC721Burnable_init_unchained() internal initializer {
    }
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
    }
    uint256[50] private __gap;
}


// File @openzeppelin/contracts-upgradeable/token/ERC721/extensions/[email protected]

// 

pragma solidity ^0.8.0;

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

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


// File @openzeppelin/contracts-upgradeable/token/ERC721/extensions/[email protected]

// 

pragma solidity ^0.8.0;



/**
 * @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 initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __ERC721Enumerable_init_unchained();
    }

    function __ERC721Enumerable_init_unchained() internal initializer {
    }
    // 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();
    }
    uint256[46] private __gap;
}


// File @openzeppelin/contracts/utils/[email protected]

// 

pragma solidity ^0.8.0;

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

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

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

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


// File contracts/SnookToken.sol

// 

pragma solidity ^0.8.0;






// about tokenURI in v4: https://forum.openzeppelin.com/t/function-settokenuri-in-erc721-is-gone-with-pragma-0-8-0/5978

contract SnookToken is ERC721Upgradeable, ERC721BurnableUpgradeable, ERC721EnumerableUpgradeable, OwnableUpgradeable {
    event Locked(address indexed from, uint tokenId, bool locked, string reason);

    using Counters for Counters.Counter;
    
    Counters.Counter private _tokenIds;
    mapping (uint => string) private _tokenURIs;
    mapping (uint => bool ) private _locked;
    
    address private _game;
    address private _afterdeath;
    address private _sge;

    function initialize(
      address game,
      address afterdeath,
      address sge,
      string memory tokenName,
      string memory tokenSymbol
    ) initializer public {
        __ERC721_init(tokenName, tokenSymbol);
        __ERC721Burnable_init();
        __ERC721Enumerable_init();
        __Ownable_init();

        _game = game;
        _afterdeath = afterdeath;
        _sge = sge;

    }

    modifier onlyGameContracts {
      require(
        msg.sender == _game || 
        msg.sender == _afterdeath || 
        msg.sender == _sge, 
        'SnookToken: Not game contracts'
      );
      _;
    }

    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
        return _tokenURIs[tokenId];
    }
    
    // used by resserection from Game constract
    function setTokenURI(uint256 tokenId, string memory tokenURI_) public onlyGameContracts() {  
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = tokenURI_;
    }

    function mint(address to, string memory tokenURI_) public onlyGameContracts() returns (uint256)
    {
        _tokenIds.increment(); // start token sequence from 1
        uint256 tokenId = _tokenIds.current();
        _mint(to, tokenId);  
        setTokenURI(tokenId, tokenURI_);
        return tokenId;
    }

    function burn(uint256 tokenId) public virtual override onlyGameContracts() {
        _burn(tokenId);
    }

    // lock token if it's in play
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) 
        internal virtual 
        override(ERC721Upgradeable, ERC721EnumerableUpgradeable) 
    {
        super._beforeTokenTransfer(from, to, tokenId);
        require(_locked[tokenId] == false, 'SnookToken: Token is locked');
    }

    // https://forum.openzeppelin.com/t/derived-contract-must-override-function-supportsinterface/6315/2
    function supportsInterface(bytes4 interfaceId) public view 
      virtual override(ERC721Upgradeable, ERC721EnumerableUpgradeable) 
      returns (bool) 
    {
        return super.supportsInterface(interfaceId);
    }

    function lock(uint tokenId, bool on, string memory reason) external onlyGameContracts() {
        _locked[tokenId] = on;
        emit Locked(ownerOf(tokenId), tokenId, on, reason);
    } 

    function isLocked(uint tokenId) view external returns (bool) {
        return _locked[tokenId];
    }
}


// File contracts/IDescriptorUser.sol

// 
pragma solidity ^0.8.0;

// https://ethereum.stackexchange.com/questions/27259/how-can-you-share-a-struct-definition-between-contracts-in-separate-files
interface IDescriptorUser {
  struct Descriptor {
    uint score;
    uint stars;
    uint traitCount;

    uint resurrectionPrice;
    uint resurrectionCount;
    uint onResurrectionScore;
    uint onResurrectionStars;
    uint onResurrectionTraitCount;
    string onResurrectionTokenURI;

    // required to recalculate probability density on exit from the game
    uint onGameEntryTraitCount; 
    uint deathTime;
    bool gameAllowed; // contract get the token to play only when this flag is true
  }
}


// File contracts/ISnookState.sol

// 
pragma solidity ^0.8.0;

interface ISnookState is IDescriptorUser { 
  function getSnookGame() external view returns (address);
  function getSkinRewardsAddress() external view returns (address);
  function getAfterdeathAddress() external view returns (address);
  function getSGEAddress() external view returns (address);
  
  function getDescriptor(uint tokenId) external view returns(Descriptor memory);
  function setDescriptor(uint tokenId, Descriptor memory descriptor) external;
  function deleteDescriptor(uint tokenId) external;
}


// File contracts/IAfterdeath.sol

// 
pragma solidity ^0.8.0;

interface IAfterdeath {
  event Resurrection(address indexed from, uint tokenId);
  event Bury(uint burialCount);
  
  function getTraitHist() external view returns (uint64[] memory);
  function updateOnMint(uint traitCount) external;
  function updateOnExtraction(uint onGameEntryTraitCount, uint traitCount) external;
  function updateOnDeath(uint traitCount) external;
  function resurrect(uint256 tokenId) external;
  function getResurrectionPrice(uint256 tokenId) external view returns (uint256 price);
  function bury(uint requestedBurials) external;
  function getBodyNumber() external view returns (uint);
  function toMorgue(uint tokenId) external;
}


// File @openzeppelin/contracts-upgradeable/utils/structs/[email protected]

// 

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

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = 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) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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


// File @openzeppelin/contracts-upgradeable/access/[email protected]

// 

pragma solidity ^0.8.0;



/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerableUpgradeable {
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

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

    function __AccessControlEnumerable_init_unchained() internal initializer {
    }
    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 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 override returns (uint256) {
        return _roleMembers[role].length();
    }

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

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

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

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


// File @openzeppelin/contracts-upgradeable/security/[email protected]

// 

pragma solidity ^0.8.0;


/**
 * @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 initializer {
        __Context_init_unchained();
        __Pausable_init_unchained();
    }

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

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

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

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

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

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


// File contracts/ISkillToken.sol

//

pragma solidity >=0.5.0;

interface ISkillToken {
    // IERC20Metadata
    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);

    // IERC20
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);    
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);
    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    // SnookGame extension
    function burn(address, uint256) external;
}


// File contracts/ISnookGame.sol

// 
pragma solidity ^0.8.0;

interface ISnookGame is IDescriptorUser {
  event GameAllowed(address indexed from, uint tokenId);
  event Entry(address indexed from, uint tokenId);
  event Extraction(address indexed to, uint tokenId);
  event Death(address indexed to, uint tokenId);
  event Birth(address indexed to, uint tokenId);
  
  function getSNOOKAddress() external view returns (address);
  function getSNKAddress() external view returns (address);
  function getSkinRewardsAddress() external view returns (address);
  function getSnookStateAddress() external view returns (address);
  function getAfterdeathAddress() external view returns (address);

  function describe(uint tokenId) external view returns (Descriptor memory d);
  function mint(address to, uint traitCount, string memory tokenURI_) external;
  function allowGame(uint256 tokenId) external;
  function enterGame(uint256 tokenId, uint resurrectionCount) external;
  function extractSnooksWithoutUpdate(uint256[] memory tokenIds) external;
  function extractSnook(
        uint256 tokenId, 
        uint traitCount, 
        uint stars, 
        uint score, 
        string memory tokenURI_
    ) external;
  function setDeathTime(
      uint256 tokenId, 
      uint onResurrectionTraitCount,
      uint onResurrectionStars,
      uint onResurrectionScore, 
      string memory onResurrectionTokenURI
  ) external;
  function pause() external;
  function unpause() external;
}


// File contracts/ISkinRewards.sol

// 
pragma solidity ^0.8.0;

interface ISkinRewards {
  event PeriodStart(address indexed sender, uint budget);
  event PeriodUpdate(uint indexed periodIdx, uint indexed tokenId, uint currentStars, uint newStars);
  event RewardClaim(address indexed sender, uint indexed tokenId, uint indexed periodIdx, uint tokenStars, uint amount);

  function getNumberOfClaimablePeriods() external view returns (uint);
  function getTreasuryAddress() external view returns(address);
  function getAfterdeathAddress() external view returns(address);
  function getSGEAddress() external view returns(address);
  function getSnookGameAddress() external view returns(address);
  function getSNOOKAddress() external view returns (address);
  function getSNKAddress() external view returns (address);

  function getPeriodBalance(uint periodIdx) external view 
    returns (uint);
  function startNewPeriod(uint budget) external;
  function updatePeriod(uint tokenId, uint currentStars, uint newStars) external;
  function getCurrentPeriodIndex() external view 
    returns (uint);
  function getIndexesOfClaimablePeriods() external view 
    returns(uint[] memory);
  function claimRewards(uint tokenId, uint periodIdx) external;
  function computeRewards(uint tokenId, uint periodIdx) external view 
    returns (uint amount, bool claimed, uint tokenStars, uint totalStars, uint budget);
  function pause() external;
  function unpause() external;
}


// File contracts/SkinRewards.sol

// 
pragma solidity ^0.8.0;








contract SkinRewards is ISkinRewards, IDescriptorUser, AccessControlEnumerableUpgradeable, PausableUpgradeable {
  bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
  
  // Special Skin Rewards variables
  // Why not array of structures? 
  // https://ethereum.stackexchange.com/questions/87451/solidity-error-struct-containing-a-nested-mapping-cannot-be-constructed/97883#97883
  struct Period {
    uint budget;
    mapping(uint => uint) tokenStars; // default: 0
    mapping(uint => bool) tokenRewardClaimed; // default: false
    mapping(uint => bool) tokenStarsUpdated; // default: false
    uint totalStars;
    uint claimedBudget; // amount of rewards claimed in this period; next period will get (budget-claimedBudget) remains
  }

  // We look back for _ClaimablePeriods only
  uint private _ClaimablePeriods;
  mapping (uint => Period) private _periods;
  uint private _currentPeriodIdx;
  address private _treasury;
  address private _afterdeath;
  address private _sge;
  ISnookGame private _game;
  SnookToken private _snook;
  ISkillToken private _skill;
  
  function getNumberOfClaimablePeriods() external override view returns(uint) {
    return _ClaimablePeriods;
  }

  function getTreasuryAddress() external override view returns(address) {
    return _treasury;
  }

  function getAfterdeathAddress() external override view returns(address) {
    return _afterdeath;
  }

  function getSGEAddress() external override view returns(address) {
    return _sge;
  }

  function getSnookGameAddress() external override view returns(address) {
    return address(_game);
  }

  function getSNOOKAddress() external override view returns (address) {
    return address(_snook);
  }

  function getSNKAddress() external override view returns (address) {
    return address(_skill);
  }

  function initialize(
    uint claimablePeriods, 
    address treasury,
    address game,
    address snook,
    address skill,
    address afterdeath,
    address sge,
    address adminAccount
  ) initializer public 
  {
    __AccessControlEnumerable_init();
    __Pausable_init();

    _ClaimablePeriods = claimablePeriods;
    _treasury = treasury;
    _game = ISnookGame(game);
    _snook = SnookToken(snook);
    _skill = ISkillToken(skill);
    _afterdeath = afterdeath;
    _sge = sge; 
    _currentPeriodIdx = 0;

    _setupRole(DEFAULT_ADMIN_ROLE, adminAccount);
    _setupRole(PAUSER_ROLE, adminAccount);
  }

  modifier onlyGameContracts {
    require(
      msg.sender == address(_game) || 
      msg.sender == address(_afterdeath) || 
      msg.sender == _sge,
      'SkinRewards: Not game contracts'
    );
    _;
  }

  modifier onlyTreasury() {
    require(msg.sender == _treasury, 'StakingRewards: Not treasury');
    _;
  }

  function getPeriodBalance(uint periodIdx) external override view returns (uint) {
    Period storage period = _periods[periodIdx];
    return period.budget - period.claimedBudget;
  }

  function startNewPeriod(uint budget) onlyTreasury() whenNotPaused() 
    external override  
  {
   
    _currentPeriodIdx += 1; // we start from 1
    uint unclaimablePeriodBalance = 0;
    
    if (_currentPeriodIdx > _ClaimablePeriods + 1) { 
      Period storage unclaimablePeriod = _periods[_currentPeriodIdx - _ClaimablePeriods - 1];
      unclaimablePeriodBalance = unclaimablePeriod.budget - unclaimablePeriod.claimedBudget;
      unclaimablePeriod.claimedBudget = unclaimablePeriod.budget;
    }
    
    Period storage period = _periods[_currentPeriodIdx];
    period.budget = budget + unclaimablePeriodBalance;
    period.totalStars = _periods[_currentPeriodIdx - 1].totalStars;
    emit PeriodStart(msg.sender, budget);
    
  }

  function updatePeriod(uint tokenId, uint currentStars, uint newStars) 
    onlyGameContracts() whenNotPaused() external override 
  {
    require(_currentPeriodIdx>0, 'Periods start from 1');
    Period storage period = _periods[_currentPeriodIdx];
    period.totalStars = period.totalStars + newStars - currentStars;
    period.tokenStars[tokenId] = newStars;
    period.tokenStarsUpdated[tokenId] = true;
    emit PeriodUpdate(_currentPeriodIdx, tokenId, currentStars, newStars);
  }

  // https://ethereum.stackexchange.com/questions/67137/why-creating-a-private-variable-and-a-getter-instead-of-just-creating-a-public-v
  function getCurrentPeriodIndex() external override view returns (uint) {
    return _currentPeriodIdx;
  }

  /*
    Returns array of indexes of claimable periods
  */
  function getIndexesOfClaimablePeriods() external override view returns(uint[] memory) {
    uint[] memory indexes = new uint[](_ClaimablePeriods);
    if (_currentPeriodIdx <= 1) {
        return indexes;
    }  
    uint i = _currentPeriodIdx <= _ClaimablePeriods ? 1 : _currentPeriodIdx - _ClaimablePeriods;
    uint k = 0;
    for (; i<_currentPeriodIdx; i++) {
        indexes[k++] = i;
    }
    return indexes;
  }

  // Returns stars of a specific token for specific period
  function _getTokenStarsOfPeriod(uint tokenId, uint periodIdx) private view returns (uint) {
    require(periodIdx > 0, 'Periods start from 1');
    uint tokenStars = 0;
    if (_periods[periodIdx].tokenStarsUpdated[tokenId] == true) {
      tokenStars = _periods[periodIdx].tokenStars[tokenId];
    } else {
      for (uint i=0; i<_ClaimablePeriods; i++) {
        uint j = periodIdx - i - 1;
        if (j == 0) {
          break;
        }
        if (_periods[j].tokenStarsUpdated[tokenId] == true) {
          tokenStars = _periods[j].tokenStars[tokenId];
          break;
        }
      }
    }    
    return tokenStars;
  }
  
  function claimRewards(uint tokenId, uint periodIdx) whenNotPaused() external override  {    
    uint periodIdxMin = _currentPeriodIdx > _ClaimablePeriods ? _currentPeriodIdx - _ClaimablePeriods : 1;
    uint periodIdxMax = _currentPeriodIdx;

    require(periodIdx >= periodIdxMin && periodIdx < periodIdxMax, 'Unclaimable period');
    
    (uint amount, bool claimed, uint tokenStars,,) = _computeRewards(tokenId, periodIdx);
    require(claimed == false, 'Already claimed');
    // during claim we update claimed period to extend claimable periods 
    _periods[periodIdx].tokenStars[tokenId] = tokenStars;
    _periods[periodIdx].tokenStarsUpdated[tokenId] = true;
    _periods[periodIdx].tokenRewardClaimed[tokenId] = true; 
    _periods[periodIdx].claimedBudget += amount;
    _skill.transfer(_snook.ownerOf(tokenId), amount);
    emit RewardClaim(msg.sender, tokenId, periodIdx, tokenStars, amount);
  }

  function computeRewards(uint tokenId, uint periodIdx) external override view 
    returns (uint amount, bool claimed, uint tokenStars, uint totalStars, uint budget) 
  {
    uint periodIdxMin = _currentPeriodIdx > _ClaimablePeriods ? _currentPeriodIdx - _ClaimablePeriods : 1;
    uint periodIdxMax = _currentPeriodIdx;

    require(periodIdx >= periodIdxMin && periodIdx < periodIdxMax, 'Unclaimable period');
    return _computeRewards(tokenId, periodIdx);
  }

  /*
    Computes amount of SKILL as rewards, sets a boolean if the rewards were claimed for that period and token
    returns totalStars and the budget of the requested period.
  */
  function _computeRewards(uint tokenId, uint periodIdx) internal view 
    returns (uint amount, bool claimed, uint tokenStars, uint totalStars, uint budget) 
  {
    tokenStars = _getTokenStarsOfPeriod(tokenId, periodIdx);
    budget = _periods[periodIdx].budget;
    totalStars = _periods[periodIdx].totalStars;
    amount = 0;
    claimed = false;
    if (totalStars > 0) {
      amount = tokenStars * budget / totalStars;
      claimed = _periods[periodIdx].tokenRewardClaimed[tokenId];
    }
  }

  function pause() external override onlyRole(PAUSER_ROLE) whenNotPaused() {
    _pause();
  }

  function unpause() external override onlyRole(PAUSER_ROLE) whenPaused() {
    _unpause();
  } 
}


// File contracts/ISGE.sol

// 

pragma solidity ^0.8.0;

interface ISGE {
  event Birth(address indexed to, uint tokenId);
  event BulkMint(uint count);
  function bulkMint(address[] memory tos, string[][] memory tokenURIs) external;
  function getMintedCount() external returns (uint);
  function getMaxTokenCount() external returns (uint);
  function pause() external;
  function unpause() external;
}


// File contracts/SGE.sol

// 

pragma solidity ^0.8.0;








// SGE = Snook Generation Event
contract SGE is ISGE, IDescriptorUser, AccessControlEnumerable, Pausable {
  uint public constant TraitCount = 1;

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

  uint private immutable _maxTokenCount;
  ISnookState private _state;
  ISkinRewards private _skinRewards;
  IAfterdeath private _afterdeath;
  SnookToken private _snook;
  uint private _mintedCount;

  constructor(
    address state, 
    address snook, 
    address skinRewards, 
    address afterdeath,
    address adminAccount,
    uint maxTokenCount
  ) 
  {
    _mintedCount = 0;
    _maxTokenCount = maxTokenCount;
    _state = ISnookState(state);
    _snook = SnookToken(snook);
    _skinRewards = ISkinRewards(skinRewards);
    _afterdeath = IAfterdeath(afterdeath);

    _setupRole(DEFAULT_ADMIN_ROLE, adminAccount);
    _setupRole(MINTER_ROLE, adminAccount);
    _setupRole(PAUSER_ROLE, adminAccount);
  }

  function getMintedCount() view external override returns (uint) {
    return _mintedCount;
  }

  function getMaxTokenCount() view external override returns (uint) {
    return _maxTokenCount;
  }

  function _mint(address to, string memory tokenURI) internal {
    uint tokenId = _snook.mint(to, tokenURI);

    Descriptor memory descriptor = Descriptor({
      score: 0,
      onResurrectionScore: 0,
      stars: 0,
      onResurrectionStars: 0,
      onGameEntryTraitCount: TraitCount,
      traitCount: TraitCount,
      onResurrectionTraitCount: 0,
      onResurrectionTokenURI: "",
      deathTime: 0,
      resurrectionPrice: 0,
      resurrectionCount: 0,
      gameAllowed: false
    });
    _state.setDescriptor(tokenId, descriptor);
    
    _afterdeath.updateOnMint(TraitCount);
    _skinRewards.updatePeriod(tokenId, 0, 0);

    _mintedCount += 1;
    emit Birth(to, tokenId); 
  }

  function bulkMint(address[] memory tos, string[][] memory arrTokenURIs) 
    external override onlyRole(MINTER_ROLE) whenNotPaused() 
  {
    require(_mintedCount < _maxTokenCount, 'SGE: No more minting');
    uint count = 0;
    for (uint i=0; i<tos.length; i++) {
      address to = tos[i];
      string[] memory tokenURIs = arrTokenURIs[i];
      for (uint j=0; j<tokenURIs.length; j++) {
        _mint(to, tokenURIs[j]);
        count++;
      } 
    }

    emit BulkMint(count);
  }

  function pause() external override onlyRole(PAUSER_ROLE) whenNotPaused() {
    _pause();
  }

  function unpause() external override onlyRole(PAUSER_ROLE) whenPaused() {
    _unpause();
  }

}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"state","type":"address"},{"internalType":"address","name":"snook","type":"address"},{"internalType":"address","name":"skinRewards","type":"address"},{"internalType":"address","name":"afterdeath","type":"address"},{"internalType":"address","name":"adminAccount","type":"address"},{"internalType":"uint256","name":"maxTokenCount","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Birth","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"}],"name":"BulkMint","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TraitCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tos","type":"address[]"},{"internalType":"string[][]","name":"arrTokenURIs","type":"string[][]"}],"name":"bulkMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getMaxTokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMintedCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"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":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b50604051620019f9380380620019f98339810160408190526200003491620002b9565b600280546000600681905560808490526001600160a01b03808a16610100026001600160a81b031990931692909217909255600580548883166001600160a01b031991821617909155600380548884169083161790556004805492871692909116919091179055620000a790836200010b565b620000d37f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6836200010b565b620000ff7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a836200010b565b50505050505062000330565b6200012282826200014e60201b620006281760201c565b600082815260016020908152604090912062000149918390620006366200015e821b17901c565b505050565b6200015a82826200017e565b5050565b600062000175836001600160a01b03841662000208565b90505b92915050565b6200018a828262000257565b6200015a576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001c462000280565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000216838362000284565b6200024e5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000178565b50600062000178565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b3390565b60009081526001919091016020526040902054151590565b80516001600160a01b0381168114620002b457600080fd5b919050565b60008060008060008060c08789031215620002d2578182fd5b620002dd876200029c565b9550620002ed602088016200029c565b9450620002fd604088016200029c565b93506200030d606088016200029c565b92506200031d608088016200029c565b915060a087015190509295509295509295565b6080516116a662000353600039600081816102ab015261045f01526116a66000f3fe608060405234801561001057600080fd5b50600436106101165760003560e01c806391d14854116100a2578063ca15c87311610071578063ca15c87314610202578063d539139314610215578063d547741f1461021d578063e63ab1e914610230578063ebc9bd3b1461023857610116565b806391d14854146101cc57806393c84007146101df5780639f77b7b3146101e7578063a217fddf146101fa57610116565b806336568abe116100e957806336568abe146101815780633f4ba83a146101945780635c975abb1461019c5780638456cb59146101a45780639010d07c146101ac57610116565b806301ffc9a71461011b578063248a9ca3146101445780632f2ff15d146101645780632f83a4a314610179575b600080fd5b61012e6101293660046111dd565b610240565b60405161013b9190611304565b60405180910390f35b610157610152366004611179565b61026d565b60405161013b919061130f565b610177610172366004611191565b610282565b005b6101576102a9565b61017761018f366004611191565b6102cd565b6101776102ef565b61012e610359565b610177610362565b6101bf6101ba3660046111bc565b6103bc565b60405161013b91906112c4565b61012e6101da366004611191565b6103dd565b610157610406565b6101776101f53660046110bb565b61040b565b6101576105b4565b610157610210366004611179565b6105b9565b6101576105d0565b61017761022b366004611191565b6105f4565b6101576105fe565b610157610622565b60006001600160e01b03198216635a05180f60e01b148061026557506102658261064b565b90505b919050565b60009081526020819052604090206001015490565b61028c8282610670565b60008281526001602052604090206102a49082610636565b505050565b7f000000000000000000000000000000000000000000000000000000000000000090565b6102d7828261068f565b60008281526001602052604090206102a490826106d1565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a6103218161031c6106e6565b6106ea565b610329610359565b61034e5760405162461bcd60e51b8152600401610345906113a2565b60405180910390fd5b61035661074e565b50565b60025460ff1690565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61038f8161031c6106e6565b610397610359565b156103b45760405162461bcd60e51b8152600401610345906113d0565b6103566107bc565b60008281526001602052604081206103d49083610817565b90505b92915050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600181565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66104388161031c6106e6565b610440610359565b1561045d5760405162461bcd60e51b8152600401610345906113d0565b7f00000000000000000000000000000000000000000000000000000000000000006006541061049e5760405162461bcd60e51b8152600401610345906113fa565b6000805b84518110156105765760008582815181106104cd57634e487b7160e01b600052603260045260246000fd5b6020026020010151905060008583815181106104f957634e487b7160e01b600052603260045260246000fd5b6020026020010151905060005b8151811015610560576105408383838151811061053357634e487b7160e01b600052603260045260246000fd5b6020026020010151610823565b8461054a81611629565b955050808061055890611629565b915050610506565b505050808061056e90611629565b9150506104a2565b507f65f41458a2c91da70d04a12fa1bf14c0cbd4a7ad663ae79e3db9324a93fe15ff816040516105a6919061130f565b60405180910390a150505050565b600081565b600081815260016020526040812061026590610abb565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102d78282610ac6565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60065490565b6106328282610ae5565b5050565b60006103d4836001600160a01b038416610b6a565b60006001600160e01b03198216637965db0b60e01b1480610265575061026582610bb4565b6106798261026d565b6106858161031c6106e6565b6102a48383610ae5565b6106976106e6565b6001600160a01b0316816001600160a01b0316146106c75760405162461bcd60e51b815260040161034590611428565b6106328282610bcd565b60006103d4836001600160a01b038416610c50565b3390565b6106f482826103dd565b6106325761070c816001600160a01b03166014610d67565b610717836020610d67565b60405160200161072892919061124f565b60408051601f198184030181529082905262461bcd60e51b825261034591600401611318565b610756610359565b6107725760405162461bcd60e51b8152600401610345906113a2565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6107a56106e6565b6040516107b291906112c4565b60405180910390a1565b6107c4610359565b156107e15760405162461bcd60e51b8152600401610345906113d0565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586107a56106e6565b60006103d48383610f19565b60055460405163d0def52160e01b81526000916001600160a01b03169063d0def5219061085690869086906004016112d8565b602060405180830381600087803b15801561087057600080fd5b505af1158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a89190611205565b9050600060405180610180016040528060008152602001600081526020016001815260200160008152602001600081526020016000815260200160008152602001600081526020016040518060200160405280600081525081526020016001815260200160008152602001600015158152509050600260019054906101000a90046001600160a01b03166001600160a01b031663bb33e37383836040518363ffffffff1660e01b815260040161095f92919061148d565b600060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b50506004805460405163dab37f3360e01b81526001600160a01b03909116935063dab37f3392506109c1916001910161130f565b600060405180830381600087803b1580156109db57600080fd5b505af11580156109ef573d6000803e3d6000fd5b505060035460405163011f09bb60e01b81526001600160a01b03909116925063011f09bb9150610a289085906000908190600401611477565b600060405180830381600087803b158015610a4257600080fd5b505af1158015610a56573d6000803e3d6000fd5b50505050600160066000828254610a6d9190611594565b92505081905550836001600160a01b03167fe3e9cb4c9675332e1e71c04808555c8071daa68327830cac01cc33d4087a64e983604051610aad919061130f565b60405180910390a250505050565b600061026582610f72565b610acf8261026d565b610adb8161031c6106e6565b6102a48383610bcd565b610aef82826103dd565b610632576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610b266106e6565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610b768383610f76565b610bac575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556103d7565b5060006103d7565b6001600160e01b031981166301ffc9a760e01b14919050565b610bd782826103dd565b15610632576000828152602081815260408083206001600160a01b03851684529091529020805460ff19169055610c0c6106e6565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60008181526001830160205260408120548015610d5d576000610c746001836115cb565b8554909150600090610c88906001906115cb565b90506000866000018281548110610caf57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110610ce057634e487b7160e01b600052603260045260246000fd5b600091825260208083209091019290925582815260018901909152604090208490558654879080610d2157634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506103d7565b60009150506103d7565b60606000610d768360026115ac565b610d81906002611594565b67ffffffffffffffff811115610da757634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610dd1576020820181803683370190505b509050600360fc1b81600081518110610dfa57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610e3757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000610e5b8460026115ac565b610e66906001611594565b90505b6001811115610efa576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610ea857634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110610ecc57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93610ef381611612565b9050610e69565b5083156103d45760405162461bcd60e51b81526004016103459061136d565b81546000908210610f3c5760405162461bcd60e51b81526004016103459061132b565b826000018281548110610f5f57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b5490565b60009081526001919091016020526040902054151590565b80356001600160a01b038116811461026857600080fd5b600082601f830112610fb5578081fd5b610fc7610fc28335611570565b611546565b82358152602080820191908401835b85358110156110b0578135860187603f820112610ff1578586fd5b6020810135611002610fc282611570565b818152602081019060408401895b8481101561109657813586018d605f82011261102a578b8cfd5b604081013567ffffffffffffffff8111156110475761104761165a565b61105a601f8201601f1916602001611546565b8181528f606083850101111561106e578d8efd5b81606084016020830137602091810182018e9052865294850194929092019150600101611010565b505087525050602094850194929092019150600101610fd6565b509095945050505050565b600080604083850312156110cd578182fd5b823567ffffffffffffffff808211156110e4578384fd5b818501915085601f8301126110f7578384fd5b81356020611107610fc283611570565b82815281810190858301838502870184018b1015611123578889fd5b8896505b8487101561114c5761113881610f8e565b835260019690960195918301918301611127565b5096505086013592505080821115611162578283fd5b5061116f85828601610fa5565b9150509250929050565b60006020828403121561118a578081fd5b5035919050565b600080604083850312156111a3578182fd5b823591506111b360208401610f8e565b90509250929050565b600080604083850312156111ce578182fd5b50508035926020909101359150565b6000602082840312156111ee578081fd5b81356001600160e01b0319811681146103d4578182fd5b600060208284031215611216578081fd5b5051919050565b15159052565b6000815180845261123b8160208601602086016115e2565b601f01601f19169290920160200192915050565b60007f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000825283516112878160178501602088016115e2565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516112b88160288401602088016115e2565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b03831681526040602082018190526000906112fc90830184611223565b949350505050565b901515815260200190565b90815260200190565b6000602082526103d46020830184611223565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604082015261647360f01b606082015260800190565b6020808252818101527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604082015260600190565b60208082526014908201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252601490820152735347453a204e6f206d6f7265206d696e74696e6760601b604082015260600190565b6020808252602f908201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560408201526e103937b632b9903337b91039b2b63360891b606082015260800190565b9283526020830191909152604082015260600190565b600083825260406020830152825160408301526020830151606083015260408301516080830152606083015160a0830152608083015160c083015260a083015160e083015260c0830151610100818185015260e0850151915061012082818601528186015192506101809150610140828187015261150f6101c0870185611223565b918701516101608781019190915290870151928601929092529085015190915061153d6101a085018261121d565b50949350505050565b60405181810167ffffffffffffffff811182821017156115685761156861165a565b604052919050565b600067ffffffffffffffff82111561158a5761158a61165a565b5060209081020190565b600082198211156115a7576115a7611644565b500190565b60008160001904831182151516156115c6576115c6611644565b500290565b6000828210156115dd576115dd611644565b500390565b60005b838110156115fd5781810151838201526020016115e5565b8381111561160c576000848401525b50505050565b60008161162157611621611644565b506000190190565b600060001982141561163d5761163d611644565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea264697066735822122018cac7b31f8e5b962f9d8870e8d2aab3226d139996e3065a48fcbd51ac7b1e7964736f6c634300080000330000000000000000000000003473fd176c8f552a1283165cf586ee44bd5b168a0000000000000000000000004372597f1c600d86598675dcb6cf5713bb7525cf000000000000000000000000d6588e9c555d35b0274f47dc6b9d4d79176023470000000000000000000000006bc8f0128e4aaa0b3678b67bb93715fa70faf3d300000000000000000000000011fe914689525618c322fc9cd76333ba15a932a600000000000000000000000000000000000000000000000000000000000189c0

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

0000000000000000000000003473fd176c8f552a1283165cf586ee44bd5b168a0000000000000000000000004372597f1c600d86598675dcb6cf5713bb7525cf000000000000000000000000d6588e9c555d35b0274f47dc6b9d4d79176023470000000000000000000000006bc8f0128e4aaa0b3678b67bb93715fa70faf3d300000000000000000000000011fe914689525618c322fc9cd76333ba15a932a600000000000000000000000000000000000000000000000000000000000189c0

-----Decoded View---------------
Arg [0] : state (address): 0x3473fd176c8f552a1283165cf586ee44bd5b168a
Arg [1] : snook (address): 0x4372597f1c600d86598675dcb6cf5713bb7525cf
Arg [2] : skinRewards (address): 0xd6588e9c555d35b0274f47dc6b9d4d7917602347
Arg [3] : afterdeath (address): 0x6bc8f0128e4aaa0b3678b67bb93715fa70faf3d3
Arg [4] : adminAccount (address): 0x11fe914689525618c322fc9cd76333ba15a932a6
Arg [5] : maxTokenCount (uint256): 100800

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000003473fd176c8f552a1283165cf586ee44bd5b168a
Arg [1] : 0000000000000000000000004372597f1c600d86598675dcb6cf5713bb7525cf
Arg [2] : 000000000000000000000000d6588e9c555d35b0274f47dc6b9d4d7917602347
Arg [3] : 0000000000000000000000006bc8f0128e4aaa0b3678b67bb93715fa70faf3d3
Arg [4] : 00000000000000000000000011fe914689525618c322fc9cd76333ba15a932a6
Arg [5] : 00000000000000000000000000000000000000000000000000000000000189c0


Deployed ByteCode Sourcemap

147621:2644:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;24124:227;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;10416:123;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;25495:165::-;;;;;;:::i;:::-;;:::i;:::-;;148726:100;;;:::i;26018:174::-;;;;;;:::i;:::-;;:::i;150165:95::-;;;:::i;27545:86::-;;;:::i;150065:94::-;;;:::i;24950:145::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;9414:139::-;;;;;;:::i;:::-;;:::i;147699:35::-;;;:::i;149557:502::-;;;;;;:::i;:::-;;:::i;7379:49::-;;;:::i;25269:134::-;;;;;;:::i;:::-;;:::i;147741:62::-;;;:::i;25753:170::-;;;;;;:::i;:::-;;:::i;147808:62::-;;;:::i;148624:96::-;;;:::i;24124:227::-;24209:4;-1:-1:-1;;;;;;24233:57:0;;-1:-1:-1;;;24233:57:0;;:110;;;24307:36;24331:11;24307:23;:36::i;:::-;24226:117;;24124:227;;;;:::o;10416:123::-;10482:7;10509:12;;;;;;;;;;:22;;;;10416:123::o;25495:165::-;25580:30;25596:4;25602:7;25580:15;:30::i;:::-;25621:18;;;;:12;:18;;;;;:31;;25644:7;25621:22;:31::i;:::-;;25495:165;;:::o;148726:100::-;148806:14;148726:100;:::o;26018:174::-;26106:33;26125:4;26131:7;26106:18;:33::i;:::-;26150:18;;;;:12;:18;;;;;:34;;26176:7;26150:25;:34::i;150165:95::-;147846:24;8983:30;8994:4;9000:12;:10;:12::i;:::-;8983:10;:30::i;:::-;28148:8:::1;:6;:8::i;:::-;28140:41;;;;-1:-1:-1::0;;;28140:41:0::1;;;;;;;:::i;:::-;;;;;;;;;150244:10:::2;:8;:10::i;:::-;150165:95:::0;:::o;27545:86::-;27616:7;;;;27545:86;:::o;150065:94::-;147846:24;8983:30;8994:4;9000:12;:10;:12::i;8983:30::-;27871:8:::1;:6;:8::i;:::-;27870:9;27862:38;;;;-1:-1:-1::0;;;27862:38:0::1;;;;;;;:::i;:::-;150145:8:::2;:6;:8::i;24950:145::-:0;25032:7;25059:18;;;:12;:18;;;;;:28;;25081:5;25059:21;:28::i;:::-;25052:35;;24950:145;;;;;:::o;9414:139::-;9492:4;9516:12;;;;;;;;;;;-1:-1:-1;;;;;9516:29:0;;;;;;;;;;;;;;;9414:139::o;147699:35::-;147733:1;147699:35;:::o;149557:502::-;147779:24;8983:30;8994:4;9000:12;:10;:12::i;8983:30::-;27871:8:::1;:6;:8::i;:::-;27870:9;27862:38;;;;-1:-1:-1::0;;;27862:38:0::1;;;;;;;:::i;:::-;149725:14:::2;149710:12;;:29;149702:62;;;;-1:-1:-1::0;;;149702:62:0::2;;;;;;;:::i;:::-;149771:10;149797:6:::0;149792:233:::2;149809:3;:10;149807:1;:12;149792:233;;;149835:10;149848:3;149852:1;149848:6;;;;;;-1:-1:-1::0;;;149848:6:0::2;;;;;;;;;;;;;;;149835:19;;149863:25;149891:12;149904:1;149891:15;;;;;;-1:-1:-1::0;;;149891:15:0::2;;;;;;;;;;;;;;;149863:43;;149920:6;149915:102;149932:9;:16;149930:1;:18;149915:102;;;149966:23;149972:2;149976:9;149986:1;149976:12;;;;;;-1:-1:-1::0;;;149976:12:0::2;;;;;;;;;;;;;;;149966:5;:23::i;:::-;150000:7:::0;::::2;::::0;::::2;:::i;:::-;;;;149950:3;;;;;:::i;:::-;;;;149915:102;;;;149792:233;;149821:3;;;;;:::i;:::-;;;;149792:233;;;;150038:15;150047:5;150038:15;;;;;;:::i;:::-;;;;;;;;27911:1;149557:502:::0;;;:::o;7379:49::-;7424:4;7379:49;:::o;25269:134::-;25341:7;25368:18;;;:12;:18;;;;;:27;;:25;:27::i;147741:62::-;147779:24;147741:62;:::o;25753:170::-;25839:31;25856:4;25862:7;25839:16;:31::i;147808:62::-;147846:24;147808:62;:::o;148624:96::-;148702:12;;148624:96;:::o;12650:112::-;12729:25;12740:4;12746:7;12729:10;:25::i;:::-;12650:112;;:::o;20249:152::-;20319:4;20343:50;20348:3;-1:-1:-1;;;;;20368:23:0;;20343:4;:50::i;9105:217::-;9190:4;-1:-1:-1;;;;;;9214:47:0;;-1:-1:-1;;;9214:47:0;;:100;;;9278:36;9302:11;9278:23;:36::i;10801:147::-;10884:18;10897:4;10884:12;:18::i;:::-;8983:30;8994:4;9000:12;:10;:12::i;8983:30::-;10915:25:::1;10926:4;10932:7;10915:10;:25::i;11849:218::-:0;11956:12;:10;:12::i;:::-;-1:-1:-1;;;;;11945:23:0;:7;-1:-1:-1;;;;;11945:23:0;;11937:83;;;;-1:-1:-1;;;11937:83:0;;;;;;;:::i;:::-;12033:26;12045:4;12051:7;12033:11;:26::i;20577:158::-;20650:4;20674:53;20682:3;-1:-1:-1;;;;;20702:23:0;;20674:7;:53::i;732:98::-;812:10;732:98;:::o;9843:384::-;9923:22;9931:4;9937:7;9923;:22::i;:::-;9919:301;;10055:41;10083:7;-1:-1:-1;;;;;10055:41:0;10093:2;10055:19;:41::i;:::-;10153:38;10181:4;10188:2;10153:19;:38::i;:::-;9976:230;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;9976:230:0;;;;;;;;;;-1:-1:-1;;;9962:246:0;;;;;;;:::i;28604:120::-;28148:8;:6;:8::i;:::-;28140:41;;;;-1:-1:-1;;;28140:41:0;;;;;;;:::i;:::-;28663:7:::1;:15:::0;;-1:-1:-1;;28663:15:0::1;::::0;;28694:22:::1;28703:12;:10;:12::i;:::-;28694:22;;;;;;:::i;:::-;;;;;;;;28604:120::o:0;28345:118::-;27871:8;:6;:8::i;:::-;27870:9;27862:38;;;;-1:-1:-1;;;27862:38:0;;;;;;;:::i;:::-;28405:7:::1;:14:::0;;-1:-1:-1;;28405:14:0::1;28415:4;28405:14;::::0;;28435:20:::1;28442:12;:10;:12::i;21535:158::-:0;21609:7;21660:22;21664:3;21676:5;21660:3;:22::i;148832:719::-;148914:6;;:25;;-1:-1:-1;;;148914:25:0;;148899:12;;-1:-1:-1;;;;;148914:6:0;;:11;;:25;;148926:2;;148930:8;;148914:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;148899:40;;148948:28;148979:365;;;;;;;;149006:1;148979:365;;;;149054:1;148979:365;;;;147733:1;148979:365;;;;149279:1;148979:365;;;;149308:1;148979:365;;;;149037:1;148979:365;;;;149085:1;148979:365;;;;149194:1;148979:365;;;;;;;;;;;;;;;;;;;;147733:1;148979:365;;;;149250:1;148979:365;;;;149331:5;148979:365;;;;;148948:396;;149351:6;;;;;;;;;-1:-1:-1;;;;;149351:6:0;-1:-1:-1;;;;;149351:20:0;;149372:7;149381:10;149351:41;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;149405:11:0;;;:36;;-1:-1:-1;;;149405:36:0;;-1:-1:-1;;;;;149405:11:0;;;;-1:-1:-1;149405:24:0;;-1:-1:-1;149405:36:0;;:11;;:36;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;149448:12:0;;:40;;-1:-1:-1;;;149448:40:0;;-1:-1:-1;;;;;149448:12:0;;;;-1:-1:-1;149448:25:0;;-1:-1:-1;149448:40:0;;149474:7;;149448:12;;;;:40;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;149513:1;149497:12;;:17;;;;;;;:::i;:::-;;;;;;;;149532:2;-1:-1:-1;;;;;149526:18:0;;149536:7;149526:18;;;;;;:::i;:::-;;;;;;;;148832:719;;;;:::o;21074:117::-;21137:7;21164:19;21172:3;21164:7;:19::i;11193:149::-;11277:18;11290:4;11277:12;:18::i;:::-;8983:30;8994:4;9000:12;:10;:12::i;8983:30::-;11308:26:::1;11320:4;11326:7;11308:11;:26::i;13097:229::-:0;13172:22;13180:4;13186:7;13172;:22::i;:::-;13167:152;;13211:6;:12;;;;;;;;;;;-1:-1:-1;;;;;13211:29:0;;;;;;;;;:36;;-1:-1:-1;;13211:36:0;13243:4;13211:36;;;13294:12;:10;:12::i;:::-;-1:-1:-1;;;;;13267:40:0;13285:7;-1:-1:-1;;;;;13267:40:0;13279:4;13267:40;;;;;;;;;;13097:229;;:::o;15304:414::-;15367:4;15389:21;15399:3;15404:5;15389:9;:21::i;:::-;15384:327;;-1:-1:-1;15427:23:0;;;;;;;;:11;:23;;;;;;;;;;;;;15610:18;;15588:19;;;:12;;;:19;;;;;;:40;;;;15643:11;;15384:327;-1:-1:-1;15694:5:0;15687:12;;4822:157;-1:-1:-1;;;;;;4931:40:0;;-1:-1:-1;;;4931:40:0;4822:157;;;:::o;13334:230::-;13409:22;13417:4;13423:7;13409;:22::i;:::-;13405:152;;;13480:5;13448:12;;;;;;;;;;;-1:-1:-1;;;;;13448:29:0;;;;;;;;;:37;;-1:-1:-1;;13448:37:0;;;13532:12;:10;:12::i;:::-;-1:-1:-1;;;;;13505:40:0;13523:7;-1:-1:-1;;;;;13505:40:0;13517:4;13505:40;;;;;;;;;;13334:230;;:::o;15894:1553::-;15960:4;16099:19;;;:12;;;:19;;;;;;16135:15;;16131:1309;;16497:21;16521:14;16534:1;16521:10;:14;:::i;:::-;16570:18;;16497:38;;-1:-1:-1;16550:17:0;;16570:22;;16591:1;;16570:22;:::i;:::-;16550:42;;16837:17;16857:3;:11;;16869:9;16857:22;;;;;;-1:-1:-1;;;16857:22:0;;;;;;;;;;;;;;;;;16837:42;;17003:9;16974:3;:11;;16986:13;16974:26;;;;;;-1:-1:-1;;;16974:26:0;;;;;;;;;;;;;;;;;;;;:38;;;;17080:23;;;:12;;;:23;;;;;;:36;;;17241:17;;17080:3;;17241:17;;;-1:-1:-1;;;17241:17:0;;;;;;;;;;;;;;;;;;;;;;;;;;17336:3;:12;;:19;17349:5;17336:19;;;;;;;;;;;17329:26;;;17379:4;17372:11;;;;;;;;16131:1309;17423:5;17416:12;;;;;2699:447;2774:13;2800:19;2832:10;2836:6;2832:1;:10;:::i;:::-;:14;;2845:1;2832:14;:::i;:::-;2822:25;;;;;;-1:-1:-1;;;2822:25:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2822:25:0;;2800:47;;-1:-1:-1;;;2858:6:0;2865:1;2858:9;;;;;;-1:-1:-1;;;2858:9:0;;;;;;;;;;;;:15;-1:-1:-1;;;;;2858:15:0;;;;;;;;;-1:-1:-1;;;2884:6:0;2891:1;2884:9;;;;;;-1:-1:-1;;;2884:9:0;;;;;;;;;;;;:15;-1:-1:-1;;;;;2884:15:0;;;;;;;;-1:-1:-1;2915:9:0;2927:10;2931:6;2927:1;:10;:::i;:::-;:14;;2940:1;2927:14;:::i;:::-;2915:26;;2910:131;2947:1;2943;:5;2910:131;;;-1:-1:-1;;;2991:5:0;2999:3;2991:11;2982:21;;;;;-1:-1:-1;;;2982:21:0;;;;;;;;;;;;2970:6;2977:1;2970:9;;;;;;-1:-1:-1;;;2970:9:0;;;;;;;;;;;;:33;-1:-1:-1;;;;;2970:33:0;;;;;;;;-1:-1:-1;3028:1:0;3018:11;;;;;2950:3;;;:::i;:::-;;;2910:131;;;-1:-1:-1;3059:10:0;;3051:55;;;;-1:-1:-1;;;3051:55:0;;;;;;;:::i;18201:204::-;18296:18;;18268:7;;18296:26;-1:-1:-1;18288:73:0;;;;-1:-1:-1;;;18288:73:0;;;;;;;:::i;:::-;18379:3;:11;;18391:5;18379:18;;;;;;-1:-1:-1;;;18379:18:0;;;;;;;;;;;;;;;;;18372:25;;18201:204;;;;:::o;17748:109::-;17831:18;;17748:109::o;17533:129::-;17606:4;17630:19;;;:12;;;;;:19;;;;;;:24;;;17533:129::o;14:175:1:-;84:20;;-1:-1:-1;;;;;133:31:1;;123:42;;113:2;;179:1;176;169:12;194:1833;;320:3;313:4;305:6;301:17;297:27;287:2;;342:5;335;328:20;287:2;370:83;385:67;444:6;431:20;385:67;:::i;:::-;370:83;:::i;:::-;499:20;;487:33;;545:4;536:14;;;;475:3;570:17;;605:5;619:1379;646:6;633:20;630:1;627:27;619:1379;;;731:3;718:17;710:6;706:30;776:3;771:2;767;763:11;759:21;749:2;;798:5;791;784:20;749:2;850:4;846:2;842:13;829:27;882:65;897:49;943:2;897:49;:::i;882:65::-;991:17;;;1041:4;1030:16;;;1080:2;1072:11;;1107:5;1125:764;1141:2;1136:3;1133:11;1125:764;;;1229:5;1216:19;1212:2;1208:28;1280:3;1275:2;1271;1267:11;1263:21;1253:2;;1302:5;1295;1288:20;1253:2;1358;1354;1350:11;1337:25;1389:18;1385:2;1382:26;1379:2;;;1411:18;;:::i;:::-;1463:54;1505:2;1486:13;;-1:-1:-1;;1482:27:1;1511:4;1478:38;1463:54;:::i;:::-;1550:2;1541:7;1534:19;1598:3;1593:2;1588;1584;1580:11;1576:20;1573:29;1570:2;;;1619:5;1612;1605:20;1570:2;1690;1685;1681;1677:11;1670:4;1661:7;1657:18;1644:49;1739:4;1721:16;;;1717:27;;1710:42;;;1769:22;;1817:16;;;;1859;;;;;-1:-1:-1;1163:1:1;1154:11;1125:764;;;-1:-1:-1;;1902:18:1;;-1:-1:-1;;1949:4:1;1940:14;;;;1974;;;;;-1:-1:-1;669:1:1;662:9;619:1379;;;-1:-1:-1;2016:5:1;;277:1750;-1:-1:-1;;;;;277:1750:1:o;2032:1274::-;;;2246:2;2234:9;2225:7;2221:23;2217:32;2214:2;;;2267:6;2259;2252:22;2214:2;2312:9;2299:23;2341:18;2382:2;2374:6;2371:14;2368:2;;;2403:6;2395;2388:22;2368:2;2446:6;2435:9;2431:22;2421:32;;2491:7;2484:4;2480:2;2476:13;2472:27;2462:2;;2518:6;2510;2503:22;2462:2;2559;2546:16;2581:4;2605:65;2620:49;2666:2;2620:49;:::i;2605:65::-;2704:15;;;2735:12;;;;2767:11;;;2805;;;2797:20;;2793:29;;2790:42;-1:-1:-1;2787:2:1;;;2850:6;2842;2835:22;2787:2;2877:6;2868:15;;2892:171;2906:2;2903:1;2900:9;2892:171;;;2963:25;2984:3;2963:25;:::i;:::-;2951:38;;2924:1;2917:9;;;;;3009:12;;;;3041;;2892:171;;;-1:-1:-1;3082:5:1;-1:-1:-1;;3125:18:1;;3112:32;;-1:-1:-1;;3156:16:1;;;3153:2;;;3190:6;3182;3175:22;3153:2;;3218:82;3292:7;3281:8;3270:9;3266:24;3218:82;:::i;:::-;3208:92;;;2204:1102;;;;;:::o;3311:190::-;;3423:2;3411:9;3402:7;3398:23;3394:32;3391:2;;;3444:6;3436;3429:22;3391:2;-1:-1:-1;3472:23:1;;3381:120;-1:-1:-1;3381:120:1:o;3506:266::-;;;3635:2;3623:9;3614:7;3610:23;3606:32;3603:2;;;3656:6;3648;3641:22;3603:2;3697:9;3684:23;3674:33;;3726:40;3762:2;3751:9;3747:18;3726:40;:::i;:::-;3716:50;;3593:179;;;;;:::o;3777:258::-;;;3906:2;3894:9;3885:7;3881:23;3877:32;3874:2;;;3927:6;3919;3912:22;3874:2;-1:-1:-1;;3955:23:1;;;4025:2;4010:18;;;3997:32;;-1:-1:-1;3864:171:1:o;4040:306::-;;4151:2;4139:9;4130:7;4126:23;4122:32;4119:2;;;4172:6;4164;4157:22;4119:2;4203:23;;-1:-1:-1;;;;;;4255:32:1;;4245:43;;4235:2;;4307:6;4299;4292:22;4351:194;;4474:2;4462:9;4453:7;4449:23;4445:32;4442:2;;;4495:6;4487;4480:22;4442:2;-1:-1:-1;4523:16:1;;4432:113;-1:-1:-1;4432:113:1:o;4550:93::-;4622:13;4615:21;4603:34;;4593:50::o;4648:260::-;;4730:5;4724:12;4757:6;4752:3;4745:19;4773:63;4829:6;4822:4;4817:3;4813:14;4806:4;4799:5;4795:16;4773:63;:::i;:::-;4890:2;4869:15;-1:-1:-1;;4865:29:1;4856:39;;;;4897:4;4852:50;;4700:208;-1:-1:-1;;4700:208:1:o;4913:786::-;;5324:25;5319:3;5312:38;5379:6;5373:13;5395:62;5450:6;5445:2;5440:3;5436:12;5429:4;5421:6;5417:17;5395:62;:::i;:::-;-1:-1:-1;;;5516:2:1;5476:16;;;5508:11;;;5501:40;5566:13;;5588:63;5566:13;5637:2;5629:11;;5622:4;5610:17;;5588:63;:::i;:::-;5671:17;5690:2;5667:26;;5302:397;-1:-1:-1;;;;5302:397:1:o;5704:203::-;-1:-1:-1;;;;;5868:32:1;;;;5850:51;;5838:2;5823:18;;5805:102::o;5912:319::-;-1:-1:-1;;;;;6089:32:1;;6071:51;;6158:2;6153;6138:18;;6131:30;;;5912:319;;6178:47;;6206:18;;6198:6;6178:47;:::i;:::-;6170:55;6061:170;-1:-1:-1;;;;6061:170:1:o;6236:187::-;6401:14;;6394:22;6376:41;;6364:2;6349:18;;6331:92::o;6428:177::-;6574:25;;;6562:2;6547:18;;6529:76::o;6610:222::-;;6759:2;6748:9;6741:21;6779:47;6822:2;6811:9;6807:18;6799:6;6779:47;:::i;6837:398::-;7039:2;7021:21;;;7078:2;7058:18;;;7051:30;7117:34;7112:2;7097:18;;7090:62;-1:-1:-1;;;7183:2:1;7168:18;;7161:32;7225:3;7210:19;;7011:224::o;7240:356::-;7442:2;7424:21;;;7461:18;;;7454:30;7520:34;7515:2;7500:18;;7493:62;7587:2;7572:18;;7414:182::o;7601:344::-;7803:2;7785:21;;;7842:2;7822:18;;;7815:30;-1:-1:-1;;;7876:2:1;7861:18;;7854:50;7936:2;7921:18;;7775:170::o;7950:340::-;8152:2;8134:21;;;8191:2;8171:18;;;8164:30;-1:-1:-1;;;8225:2:1;8210:18;;8203:46;8281:2;8266:18;;8124:166::o;8295:344::-;8497:2;8479:21;;;8536:2;8516:18;;;8509:30;-1:-1:-1;;;8570:2:1;8555:18;;8548:50;8630:2;8615:18;;8469:170::o;8644:411::-;8846:2;8828:21;;;8885:2;8865:18;;;8858:30;8924:34;8919:2;8904:18;;8897:62;-1:-1:-1;;;8990:2:1;8975:18;;8968:45;9045:3;9030:19;;8818:237::o;9242:335::-;9460:25;;;9516:2;9501:18;;9494:34;;;;9559:2;9544:18;;9537:34;9448:2;9433:18;;9415:162::o;9582:1336::-;;9795:6;9784:9;9777:25;9838:2;9833;9822:9;9818:18;9811:30;9883:6;9877:13;9872:2;9861:9;9857:18;9850:41;9945:2;9937:6;9933:15;9927:22;9922:2;9911:9;9907:18;9900:50;10005:2;9997:6;9993:15;9987:22;9981:3;9970:9;9966:19;9959:51;10065:2;10057:6;10053:15;10047:22;10041:3;10030:9;10026:19;10019:51;10125:3;10117:6;10113:16;10107:23;10101:3;10090:9;10086:19;10079:52;10186:3;10178:6;10174:16;10168:23;10162:3;10151:9;10147:19;10140:52;10229:3;10221:6;10217:16;10211:23;10253:3;10292:2;10287;10276:9;10272:18;10265:30;10332:3;10324:6;10320:16;10314:23;10304:33;;10356:3;10395:2;10390;10379:9;10375:18;10368:30;10445:2;10437:6;10433:15;10427:22;10407:42;;10468:6;10458:16;;10493:3;10532:2;10527;10516:9;10512:18;10505:30;10558:54;10607:3;10596:9;10592:19;10578:12;10558:54;:::i;:::-;10637:15;;;10631:22;10672:3;10691:18;;;10684:30;;;;10756:15;;;10750:22;10730:18;;;10723:50;;;;10810:15;;;10804:22;10544:68;;-1:-1:-1;10835:54:1;10884:3;10869:19;;10804:22;10835:54;:::i;:::-;-1:-1:-1;10906:6:1;9767:1151;-1:-1:-1;;;;9767:1151:1:o;10923:251::-;10993:2;10987:9;11023:17;;;11070:18;11055:34;;11091:22;;;11052:62;11049:2;;;11117:18;;:::i;:::-;11153:2;11146:22;10967:207;;-1:-1:-1;10967:207:1:o;11179:192::-;;11278:18;11270:6;11267:30;11264:2;;;11300:18;;:::i;:::-;-1:-1:-1;11360:4:1;11341:17;;;11337:28;;11254:117::o;11376:128::-;;11447:1;11443:6;11440:1;11437:13;11434:2;;;11453:18;;:::i;:::-;-1:-1:-1;11489:9:1;;11424:80::o;11509:168::-;;11615:1;11611;11607:6;11603:14;11600:1;11597:21;11592:1;11585:9;11578:17;11574:45;11571:2;;;11622:18;;:::i;:::-;-1:-1:-1;11662:9:1;;11561:116::o;11682:125::-;;11750:1;11747;11744:8;11741:2;;;11755:18;;:::i;:::-;-1:-1:-1;11792:9:1;;11731:76::o;11812:258::-;11884:1;11894:113;11908:6;11905:1;11902:13;11894:113;;;11984:11;;;11978:18;11965:11;;;11958:39;11930:2;11923:10;11894:113;;;12025:6;12022:1;12019:13;12016:2;;;12060:1;12051:6;12046:3;12042:16;12035:27;12016:2;;11865:205;;;:::o;12075:136::-;;12142:5;12132:2;;12151:18;;:::i;:::-;-1:-1:-1;;;12187:18:1;;12122:89::o;12216:135::-;;-1:-1:-1;;12276:17:1;;12273:2;;;12296:18;;:::i;:::-;-1:-1:-1;12343:1:1;12332:13;;12263:88::o;12356:127::-;12417:10;12412:3;12408:20;12405:1;12398:31;12448:4;12445:1;12438:15;12472:4;12469:1;12462:15;12488:127;12549:10;12544:3;12540:20;12537:1;12530:31;12580:4;12577:1;12570:15;12604:4;12601:1;12594:15

Swarm Source

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