// File: @openzeppelin/contracts/access/AccessControl.sol



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract 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 Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _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 virtual 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]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        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 virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    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 revoked `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}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

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

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

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

// File: @openzeppelin/contracts/access/IAccessControl.sol



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

// File: @openzeppelin/contracts/token/ERC721/ERC721.sol



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

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

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

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

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

// File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @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);
    }
}

// File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // 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(IERC165, ERC721) returns (bool) {
        return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.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 < ERC721Enumerable.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 = ERC721.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 = ERC721.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();
    }
}

// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol



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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

// File: @openzeppelin/contracts/token/ERC721/IERC721.sol



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface 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/utils/Address.sol



// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// File: @openzeppelin/contracts/utils/Context.sol



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

pragma solidity ^0.8.0;

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

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

// File: @openzeppelin/contracts/utils/Counters.sol



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

pragma solidity ^0.8.0;

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

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

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

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

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

// File: @openzeppelin/contracts/utils/introspection/ERC165.sol



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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

// File: @openzeppelin/contracts/utils/introspection/IERC165.sol



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

pragma solidity ^0.8.0;

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

// File: @openzeppelin/contracts/utils/Strings.sol



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

pragma solidity ^0.8.0;

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

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

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

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

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

// File: contracts/lib/access/Ownable.sol



// SPDX-License-Identifier: MIT
// A light version of OpenZeppelin access/Ownable.sol (v4.4.1)

pragma solidity ^0.8.4;

error OnlyOwnerAllowedToTransferOwnership();

/**
 * @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}.
 *
 */
abstract contract Ownable {
    address private _owner;

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _owner = msg.sender;
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) external virtual {
        if (owner() != msg.sender) revert OnlyOwnerAllowedToTransferOwnership();
        _owner = newOwner;
    }
}

// File: contracts/lib/ERC721/ERC721Preset.sol



// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

import "../access/Ownable.sol";

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

error MintIsInactive();

/**
 * @title ERC721Preset
 * @dev ERC721 contract with several extensions implemented
 * @custom:version 1.2
 * @custom:date 2 May 2022
 *
 * @custom:changelog
 * 
 * v1.1
 * - Removed provenance as that should be an extension
 * - Used error objects for reverting
 * - flipping locks is external to save gas
 *
 * v1.2
 * - Added a light version of OpenZeppelin Ownable so public services can call the owner() function

 */
abstract contract ERC721Preset is
    AccessControl,
    Ownable,
    ERC721,
    ERC721Enumerable,
    ERC721Burnable
{
    using Counters for Counters.Counter;

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

    string public baseURI;
    bool public mintIsActive;

    Counters.Counter private _tokenIdCounter;

    constructor(string memory name, string memory symbol) ERC721(name, symbol) {
        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(STAFF_ROLE, msg.sender);
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return baseURI;
    }

    function setBaseURI(string memory newBaseUri) external onlyRole(STAFF_ROLE) {
        baseURI = newBaseUri;
    }

    function _safeMint(address to) internal returns (uint256) {
        if(!mintIsActive) revert MintIsInactive();

        uint256 tokenId = _tokenIdCounter.current() + 1;
        _safeMint(to, tokenId);
        _tokenIdCounter.increment();

        return tokenId;
    }

    function flipMintActive() external onlyRole(STAFF_ROLE) {
        mintIsActive = !mintIsActive;
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721, ERC721Enumerable) {
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC721, ERC721Enumerable, AccessControl)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}

// File: contracts/tgcasino/HighRoller.sol



// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

import "../lib/ERC721/ERC721Preset.sol";

/**
 * @title TG.Casino High Roller
 * @dev ERC721 contract for https://tg.casino
 * @custom:version v1.0
 * @custom:date 5 January 2024
 */
contract HighRoller is ERC721Preset {
    bytes32 public constant MINT_ROLE = keccak256("MINT_ROLE");

    constructor() ERC721Preset("TG.Casino High Roller", "TGHR") {
        _grantRole(MINT_ROLE, msg.sender);
    }

    function safeMint(address to) external onlyRole(MINT_ROLE) returns (uint256 tokenId) {
        tokenId = _safeMint(to);
        return tokenId;
    }
}

// File: contracts/tgcasino/HighRollerMinter.sol



// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

import "./HighRoller.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

error AlreadyMinted();

contract HighRollerMinter is AccessControl {
    bytes32 public constant STAFF_ROLE = keccak256("STAFF_ROLE");

    HighRoller private immutable _hr = HighRoller(address(0x1fb01aF3828b68D4AD473b07ca8f6D22576b821c));
    bool public alreadyMinted;

    address public tgDeployerWallet = 0xa9Ec8C669ec7De986AFfa242925aE2FFaDC6F817;

    address[] public mintToWallets = [
        0x558E15EDB19be404224a834f7776AB79bD783225,
        0x8325A509845a8f4F2760eAD394Ad95b059ef645c,
        0x4B1b9a8aD6e6af34dc6e768153bf40397a202fB8,
        0xFA288c37fDbbF08220b0627e6ce7107e9919Eb11,
        0x393565dF80feC2E8C4901191fb7974BaFF0861B0,
        0x43b0a1AaC5eebfD11d8C47d4da8Db0C545cbB252,
        0xF2419e4d28B7e6591AB036B715B3018a52584Ce6,
        0x9606588512faf395210E1a0fbFe0C63BfB6216CF,
        0x717aFfd69e3482FCF2cF60fD69782eB101f81fAF,
        0xC4E17dF17080E7E571be0D0DC2FE2F7F38A347C5,
        0x4885E698820201B5c10B9E9D14398253B4eecE42,
        0x24Ad962ac10Cd9f8e756aB1b03CF5F79555a97Ee,
        0xcbA2136fb1dcfb8814cde51ad34E8f7693Ee0E27,
        0x6751b3aAb3d2c170dF72c57abBaa2e494f2ACD41,
        0xc0bf772684c516c96189e92b9A35C6ec1F8A3ebA,
        0x0DeA9f1342038B61c40f91f9DF8d0452A8957a67,
        0x590e926AeeDd92274966383D6f3bea30A579fFdE,
        0x69f94A1fBfFe0218AadAaEfbC3CC97CC66831b9b,
        0x959DF4c613bC716f827B29d11C002138AbA9708A,
        0x00df21B6106bb7e6D5C80cFa7D7e6F3211e29CF3,
        0xE78F351e4Ec96c0dDC052e50fDcBbe486FAC8c96,
        0x27D98493230C7e69C4DB88053770765Fa96224b9,
        0x1D93539bCeB6fb6D77b2B57Ce8e2E042d79D7B68,
        0xB2bbd54e4405f5198E1F29e820Bd87407eFd8596,
        0x1Cf6B762A61D7c8AeB23FB7964f95387DB48a728,
        0xca00AA6037F1B7693efa5c97f449F503Ef8c6539,
        0x92E21BF96110239cc8dDD76B1bAa523755f21DC6,
        0x5e72a41A57657f4B66C782fDb0a0dBBd03B43339,
        0xCdD238db407E352EDDcEab238645463E1a17266D,
        0x6AD033A70F817A2822D899a853B2883D232AED15,
        0x9EB94BD24FCaFB1641f83213b6132dE2A07908fc,
        0x51A92A242184eDF519Cce754977B9494cD74857C,
        0x1d952E5E052776c56CaD91e5C3c882C09F1EB52C,
        0x385958033b1C83599DDf09d6d1da05636BaEa07F,
        0xCBE0ef2be773F4Eae3E054e1e6c28EDf8326Cc8D,
        0xb70Ad971Dfb60dB9b5A6d2Dcc86d2eF281D4bbad,
        0xc3B28b3437e1b4b9A2B3c514c776C83b038845a5,
        0x37db2ec76d5f455544372B191190E99A9DdDc4BE,
        0x154d0f126fAfDCa8bb9244BF9B92E174392ad201,
        0xBD2F9063917B04Ac955D150978a440C57Bd3c2d7,
        0x75E7dEdEb5AcA690858c6Af031AB13F3E0C8164a,
        0xA8B45025c522fDA123717B28EC9338C2077c66d7,
        0x03F2Dd98973dE88F37F76963E06E4d73345AFF1f,
        0xCe270f8763f39eD6BECcb7409d3c64260b3352B5,
        0x49eA9E0e15690b5E650390435BE0A24E42ab8365,
        0x56D3a817cE836932Dd84A13b6Db25673C4776d86,
        0x939826638AbbB8DD2Ea12133f3B02b2d88aA3664,
        0xF577A7FA896663E8d91797d9eb49d43d697b0a86,
        0xC8Af24450Fe296F266Dd677F15Ab1076FBB5Dbbe,
        0x3DfF37AcC2431FFDA41715A15bC96753663aCb8c,
        0x95878B7936FBa91485b555a39D475E7479b16b1F,
        0x950fc922ba22c5F9df6d67e4C2999A16a16AAAf9,
        0x9F6802358882d5011E283E3Eb72A66B9C77C19AA,
        0xF771e5691c2105597bff1afad0f0DC99a10C9b97,
        0x0C8FC6E10340ebfA64c7da5a4BdA4cc78fAa7c42,
        0xEcD8b2d61e3e5E97fAC3D631B1dE5EA8d03eE3B9,
        0x2A7090c39c35f2CE38CC96440632E7dc7e583617,
        0x7e09B2FCDb83A308D1B20dF67B038eB2Bf93d315,
        0x7d614762E9E8a716f6889C4158f3392986BbbcA3,
        0x9424F3E703b03ba02f076c86467dF1457502656d,
        0x498f502d9F7B1A30092b45CF64D8788DA8Fa0Cc2,
        0xe28baFFB1e409DaC2403780906173eaf0eC44543,
        0xc8F503407420009380a3771FA6B6A0B4419D5bce,
        0x775a082e87E5Bc43aBcf5665Db9b22de3761e137,
        0xcC307777c7C6B0F2CAfd43a7D1274a58a9cb0c13,
        0xabDF88d9C433dCEdB16962eb8AD995771Df664eD,
        0x26cd1866a5E8e3B4aacaAd6d480CeB6D781516c8,
        0xDDcf069659314859022B83691D4dFD691ec93006,
        0xb5C39406AA797799edA1CBdFE1505F71f0d0ba5D,
        0x91A6d53E41f6Ce4Fc7712d6ad25632CF5E80D89d,
        0x39Aa30B81afF106D8fF9e6389d80560A4Cc36825,
        0xDD97be0f713119F8b778841Ce8C7C8671cA81990,
        0x5F3C6Fb4f4440f3b7Cb622d023F8864b589d6F6e,
        0x0A555c30222580B17b4Ce8DF0AaD6BC4C85bcF8B,
        0xc26d4D2440E86fdaAa13d94D106B430b12AF8323,
        0xCdA1a0ECd7D25B49Ecbf0EeC1f45f0B7fb59961b,
        0x70672Fd4f6E5C65233BdC85bA2650819466c6DF9,
        0xDd2fF37e55d94de3DbB1628393377b6Ab1b76dfe,
        0xA336033fC39a359E375007e75aF49768e98d0790,
        0xc8010371Bd8b9795B671998eC1BA0a4307239115,
        0x62a03eEDaa3b3a01754fD2Abf3357850e7f9D2E8,
        0xb865A5dFc96659Dfc30363ace42e69140a7f52a4,
        0xd71CC9cC128bB47C2f8f3EfF665F2ec57546F476,
        0x764601d855Dc30fAe3127F8377d870072d70D559,
        0xa05a65B4dAD9a4c0bA18d83203a65F0F07799780,
        0xE772b2fdcCA4bfda8fd00a90213FC609894cFCBd,
        0x49ef9157C7C90b6626F4Adef093c45944222e038,
        0x026B9E0A8256CdF80503F56d0f5793118Bd9B893,
        0xB2f18d1895d624962C58c7516f532684334C0B24,
        0x0ffc699480b0693aE838f82481960Ef89eE14d85,
        0x8C348612BE8ceD1cF33FFb7Bb83b2D298Ab641bb,
        0x88d8878c6e685bCb768ffab8B32d3Dc124A77D13,
        0x23b7Db46a7Fee619D5ac1cF57f4C27248f14eCc7,
        0x74D1153143907a9E41f4Aa35bB34e8A466e5E2Cb,
        0x1208cE9f6C8346Af03D9622be6A5B4478830ABb6,
        0x85b7e5C29BAB54BbAB8475A5370859FE55Aa7821,
        0xCE59Beaa787779dfC63cc1eF5C622B7d6b3F9dcA,
        0xFA72D6312c2A1f45b89733C8138754c491E27272,
        0x5474612fe6eCA96a12423a690E67180e4CfDd9e3,
        0xA61dB853ae16A30B1BFf6246bfc626261eCE1386,
        0xEb95489e1d2Ce768F79Cd5771eE7D0f68Fd6A8AB,
        0x55701A8a8f3BB87dB53B38a9E27Df23E85D024ab,
        0x9f3ABb8570A21C6B3648B2c2d4A1Ca117B948529,
        0x21E44d8F5Db9A8820d20044b8992cD33374be133,
        0x450114723fba944388a74513a6C8B2286561C98f,
        0x252b5389C6bdbEf8006d95E4c210AEf335ee7F2F,
        0x9e41C0662dC3A2974063a99C3483c62c685ccFB3,
        0x81f5da8142D284bA740591f8e63675cDcb795477,
        0x903dd3aDf67057A5A056A20C6850B9e17f6ad767,
        0xCDA511033E9414cd0A0BFBb16c338A0d317285B0,
        0x72CE1B1C7F57666791e244E4395FE4f6882902dE,
        0x224bB5565C55D972516D2D08686aA68E8b555a8a,
        0x6A01e01a7405F723D5ea2BAf96347f0846dE54A0,
        0xD1b6aC3D46bA5D7E071c887f99d6b82f0D6b3B47,
        0xe7ca0e3b6eb88fBceb646987aa3843bEA7dd0Df6,
        0x4dfA74f7f3f160afB46D3672321E6B12Ff0A986A,
        0x4Fc48087F830f310167df81059A67c656208635b,
        0x5f0b0421F300994a5a4D46Ff7967b58879abbc98,
        0x617398Ff9a8C7D4153C59553F8aae7148096c36A,
        0x7973B7f810239Df1E8B1D01D088f50C82C297e1f,
        0x54534268de168391ce3D6F57F39B5941A3EFBf37,
        0xEA0bc56b85e8A1167932bF511C4fDdE84AA2f22C,
        0xD6144225e7F968B9A4bc239E34E890f7A9eA68bF,
        0x9b3319caA84A3DBa6bE70Df1eB7AF3ca413F8EB1,
        0xD1BdFD18BaC65510384Dd20B87b635a4F9B25025,
        0x85772147D5d30B5A493Eb4120dEA412131E64294,
        0x574644bD17287da7d2A23a8B669842425B38EBf2,
        0xc148af7a75928668c7d1dFbaE4FF9998C3140CD4,
        0xBEd12aF85135C0C48d9aAA7260D15f1dE5E2fC74,
        0xC14532214e6468A8c8E90643824486112Ef5cE20,
        0x14f586f784D67a67150F0D9a6485946d0044f8F1,
        0xE23Fae241Fa9febc8AeEcC9E46cb56D9C015EBE4,
        0x870a7849E436b675A0E67E5d2A3b4c3fE5957b1F,
        0xC419c055b1B31F1B7017290813deefbD699B17d1,
        0xE8BB68fA74D664AF7e4797584379927784eB0575,
        0xf977FDe968b01E4C32BFaB0705b6522e0daae857,
        0x1d52f101B0826815a96B892Dba99e7865796996c,
        0x658ea83B82c9cA11f864982277A1bdFfECc912c1,
        0x7a19C951B8b49a2710B4f2c2c5ec5504D8A1d537,
        0x4C5f615E717F3FEe416FD8CC0b23a4992D3B2ab4,
        0x0bC81b9EdAf69E83f1565862AF2eA38e8e82eC2e,
        0xdD30C61aEFAB341314DF84bB73A6f79ed29F5E59,
        0x5d1f54362b83c3E7e2d57f0Ba858399B921eF7Bd,
        0x9562616783D19517C64d31F3e0F8daF4075e2D61,
        0x104dFF210088156E88e0eE57f11993b430e5d2b3,
        0xEC1749cB0CeB7D5950EFE2DD19A33afaC6eC7a3C,
        0xDDb92626B4737772FECA470E856C3d48719aDE2C,
        0x27073cd0D709d89c391AF9767595D91C78ED43A7,
        0xB8DbDc2a11daE9c6E5200e9ba77d4FB8ea2c80b3,
        0x1929820e0ed66EeaA8A347dD8dce3254A8396729,
        0x64dC2E01bCD8901167f6C8B068808da19b41F4F6,
        0x27F11162C185eFD45Ca90a8F906860a5B9316adb,
        0x5fFd6468d09D7C57C26150a7256E2597DCb682D1,
        0x075E86d7B45e88221c943F5A6EA8a4554099F652,
        0x7482fa1454174DA843280450669055bCb1FafC13,
        0xf5C1cAe2b8C8C74b30e31a7c38878E9c7b8FBECD,
        0x6d681C1eC03e050343a57C2Ac7B2662525F83e01,
        0x50Ea620Ef2cf43f8e73d44416Ebd9718BfA0a024,
        0xEeE9D814e858c907a4d188EDED60E7ED2FAb4452,
        0x9FFcc690f061Be674c53278b722677528cDeb5B2,
        0x77849aebca9f5D686b493FD40dEc60006B3C850a,
        0xd6A2A89aFF9C19f26724e4bA7934B6aCcdA79a81,
        0x9FE9cA3bc9FC9B86AeAc707c52fF801495BCE2dF,
        0xe9Be7f0C6F1E50df722C21a571eeb902248a5d7F,
        0x5B58e13e6B12D2cf59eCD5D8e8EED6F835482a5e,
        0xB14CD311Fc4C573c7dE936F767C734ab1F40B9a0,
        0x94B166867a6dfD03a6b45f5DB7857eF25A7e4E86,
        0x650EB132b844cEcB756819f163e084d76EF23379,
        0x11296FBa435083053ec862D8568C26a1Caa5A534,
        0x051b392De234E0343C01025099f0a24eF2b1eBE1,
        0xcE5B9Ca4B042eE5BA48ee256C9c9E95728d1694c,
        0x5e476DB25176714FC3811bc1cAa8A7cCb1608524,
        0xB0fdc70D807Ca3FC64CC88fA35baCaf0487c7E87,
        0x9386410AD3b1d09f18ad6f6A36b1B8b971677efc,
        0xA6815971A7E4D608D8d3B4B5996A0de397A9c92B,
        0xf809d8f993bBa48c3046f587BC577244D632ccF1,
        0xA6ec562f8828118d3E1bD9f74eBBb562a40C9E29,
        0x01706773e2bF0f651d3d8Ba707CD0F021bceDE35,
        0xb8450a427be1947f007B444f65d16b886f7E39C3,
        0x9Bfcee789367b0af4521f197C5c98E0326a23EEc,
        0xd28949031621c33bd8c3585d9fdDbAdEB5CbfBd7,
        0x481B73E1AbF38f9c5dffA5056C7d78A31986112D,
        0x7399A390737A0e53a0bC4379D337EcB3A2ecB195,
        0x8511639bB055e6597B5e5224bEfc54cBF264cD40,
        0xFee522a1eCD54B66b6eBb73a78b0f2daA01084B9,
        0xAf6d1ef1539380F6C572115ba5DD0da710A94894,
        0x5f508DCbAcB4B950059804D1B57D90B8824279d7,
        0x19AA99cb73324E762303F02b31d67AEa0d8E7e43,
        0x047B96b37379aBAAbb6384C16e834232c94Cc9b8,
        0x0c4e20d457B04577260E94Ac9D4052Be9Ae95BD7,
        0xCBffE0B13C26c1a3668bFd5aA689e805C6b55F22,
        0x5641A8C0f9336F07b224A3a4eccfe391C97E60Ae,
        0x49C8c8fc7ed5a8461639485766Deb13fC6443A05,
        0x6E81587FbA8B8d7B93F87C38b3DEAac72b4ac331,
        0xE911c1B4077c6A0b5F7967B812FDC081b98d1Ce9,
        0x6D2021Ed2c575387c3678a79814F54A9a6f0eeB7,
        0x5c344BA4ED12b0Eb0632199D4cBE91DeA12f7e4E,
        0xB74B746873437d475C7027224EAb9FEfbd3B2755,
        0x45F36dDE59918Ebf866574B127aD47C0BD5eEd85,
        0x5f995f0FBb73da5f1628067deb3626F6554fDD72,
        0xA6E0D30a2321d9Ce92e56b4365f8BD65E45Ba353,
        0x19d3711290854986074F25D7Cb59001dAb90327D,
        0x2A78B1AE65a42046993Bddf8Fa2585B859D5F85f,
        0x97dCdBBBc8f784d35336168aBC5660a6c450E1b4,
        0xF27b24b0Bdfe3198e3c89553CA88837EB3a930EC,
        0x7B9e5f8eCEf5C3fDB7f56bCB9b29C07FEfD4E42b,
        0x2659C916A3443D6ecCA407fEe95B4f457B43Dd25,
        0x6F746F81C76d9470803EECd0C831Ba42f153b947,
        0xE2149a79b8afe7e28a8b447F7d3F64273c8de050,
        0x0687CDB99910E3f8C3fE64250a27419620B1d6B9,
        0x194B1F8302268135bD73042199A6FDcE71BA0A2c,
        0x097dE246c203c8Dbe5f5FCB5fBFD56311dC4BaE6,
        0x1Fad4Db36fB3D062F544635550d26f48fD639FD2,
        0x45c35ce31E3c0b10A4A2DaAeDcED29f3F94A5AdB,
        0x9Cb4557527BA8e7aD066207fDFcF17A6a587DD79,
        0x54f6D545e4276B0ecc7cd3BB99e4b42A12b2B202,
        0x5CA51c0Bb6Dbdf29465dAeb3F5dBD37074133467,
        0x2A7795cB4ce04cB2B8C72531C06B587443970b9d,
        0x2aff1e1F8bF231D201718BA52C019201DFBCCC4f,
        0xe3d755fe1f413CDC38D0e127804bcE70B4A93a94,
        0x3c057E14c52Ce2721c71F988bc48C748c10bE0Cb,
        0x107D1D4E51086Ff4B7eb2ca7b1aa7877D0a55E57,
        0x621DC1216803FfeAFAfC573af70A2B2048Fb2cE7,
        0xf9c244255F3cD4244AD2D11295B6C97f3dC688eD,
        0xA2Ee7908D45fCa3720E1FA5C204Ee04F2a14be91,
        0x720DfA5a9e378002bb80ed616c45e121BE1F8bF4,
        0x6FEbA25822a60c2FDCd3d67829CE7Ae91006a96A,
        0xb45d9a2E9900e00c4e1F6df9f6E39Ea48d3E47D0,
        0xBd456a109CE2c946564beB41F163607D4b959E83,
        0x4270A154A474cBCD3C714b11cAb2F2490CB15934,
        0x2945d55cBB1A9eADfd4A40739891a26BbE87f95D,
        0x464C9237e50432793f6Dec5B26E9775c0CeDBd4F,
        0xfAFa0bF6B9AD11257F0E75D3148a91Df2167Ba99,
        0xae77D746cCd08C33793c7cF667E7dbA62C531593,
        0x629f2eB078D61Aba611757B7f3E916C061feDebf,
        0xc3603621e178628bbB133AacEAEc83e4f12c7Cd3,
        0x4262372D718b65E33546B2F43A1e023AD8759B36,
        0x005e991137f4785D6bFA82Ff0DCbEA69E67146bb,
        0xBD4db236B0E35FF012C47f6D35259D9d802266B7,
        0x348ed12E1401d20a2171712fCC17764C3C8Ff6c1,
        0xD70cB67602A2E5f492a6004A4c481E241DEEb883,
        0x34D82f97D3265C4fE08170b7F40DB989B198fCb9,
        0x20135019C458A85ac4B844cC5266f72f19fe1e60,
        0x1dDdbeD426b87A4B59c079c30a9D8FFBbEC35d0a,
        0x2752910c9A1bFb3A7bDD47740001015cCbB98112,
        0xF4ae1527DAd68f617Cb46AaFc5f231838F90b327,
        0x5D1F056deb05c7cC523635b6C19dc977E1542317,
        0x4412145856aA3F5F137A62E52f8b2e8cb0265E36,
        0x85d36E7e811D90706065EF16e4f60BC3A17A9A3B,
        0x7692f08DEc7c9954b1463CBE82966f6F274c89c4,
        0xC0Bb0b8BFFA204811428926d815FC8c3Ef8bFC4A,
        0x74F9C802C1a074f29524aF239D41E79fCB1a6086,
        0xC62cD4b3a4A1854ff90e3Dd46EcD4765019876A0,
        0xb76e89dc5acBd96D5Edd49cE49C2d921B2928131,
        0xB4B7Bf088c9F7AA0Ec613FEd5037046922827CAE,
        0xb1f8C88ddA03513889105eBb31FB3D88D10CF952,
        0x39aF6636827F9AccF9fB2E6C09cA9E4b56857A57,
        0xF109E726Cc22456a1C7f0F229B3F3866D285F5E8,
        0x18cb9Ec8c28433D9670A39687544b5D2dfEcD482,
        0x217B93632ce9699Fe2d533Db8dDd9EC89B368b04,
        0x1d3B68b3252988FD7B536E1dC33cbaaa81226B86,
        0x5c31A9957d9d21E55Ae99f5F7b6Aa414851EBddF,
        0x92A479Cc3fB8CA48d4665d4320Ad4f55137441FA,
        0xc98C8c05db8AAb0248C7B8323671aB9BD7d202a5,
        0x4cE9CE87c41c9B6BbAC6E7A013cD1399bed24BCB,
        0x70440829b796a049B7D1B1C2e048B73950d0Bf2e,
        0x678E0a820649983fFBaa78ad409efFB5b8c1E3A0,
        0x86763E7546407E5AC45c1ED5bDA63b43B1934521,
        0xbA6D2089548Ab752004c3D848F28719Ac760D93D,
        0xaD2ac2476a92619aeE38193409e1A3F915621670,
        0x470aFFE194D760b218283C96744d6900654d5AFf,
        0x70Ef3dC8CCF647375fD2d1023bd8c9a251D59576,
        0x4fCB2Baf50594E427DCe332266160dB143129134,
        0x8D93dCfc349fC7b23Ead976d3653Cd6C59678984,
        0x94380cC36932066B8FE3f8DF9181c6842B6123D0,
        0x85071F39160bed44220f4e56313d709f353576db,
        0x409aaDcb02cd1BF4da5b80eb496d9174BfDA24f3,
        0xfA943D9b43c6c8246f91AAbDf7E59DCa32b62546,
        0xc4b61982C58bD28d71e6370B9FE9F0690b6ee1c7,
        0xBC13a468367e4957A298D5Bf8d075796a46d4836,
        0x6c08fCED4cB9Bd0231756f32B43A112bA85a4ddD,
        0xf1982957cd0922258855D6C58F0E439624eB64A5,
        0xF19F2a21922D3dbc674D116e6416f26EFad992d3,
        0x6fC927A025F62E16EDca45630E7C039c9B3cE444,
        0xc293802880F6D6dfd87E470cbE0c9AC310181848,
        0x058666E6D6586236D45cAe583935FB66c2c08D26,
        0xa3Ebee193Bb3707c84E203F8962bff5595196796,
        0xf6fa4A5e59D547cF5C389aF3A0f76820b3d55ADD,
        0x6678110595dcfF59F59f151464C9fD4F1E1afF11,
        0xD0500113AF97E72E84fc08aBb183fd714048e89C,
        0x2308C373CAA79a39769499ff87EB9223c931777F,
        0x99B74e7A399E0Bae0D972D13FAa653CED0693aE4,
        0xa86f39BaEdb4CA830B1fDd34E1C1A1EbEaae1e16,
        0x4188764153745487E88B5ba7bc278Aa84DC1101C,
        0x94400244C21FcD3Ce77354E798a1f7172dCcff64,
        0x470C945BcB0CE2353432d8c34566eAAA45E6BB4f,
        0x8C9c57dAfeb30B42F3D4c7ca2efA0a9159252BA1,
        0x783d64C0D096B62eBd81eba9d1a7E1283DfDC46e,
        0xA25Ae115BEDDFdFacd4c4D12C5C927f930CE887A
    ];

    constructor() {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(STAFF_ROLE, msg.sender);
    }

    function safeMintAll() external onlyRole(STAFF_ROLE) {
        if (alreadyMinted) revert AlreadyMinted();

        // Mint one to all wallets
        for (uint i = 0; i < mintToWallets.length; i++) {
            address wallet = mintToWallets[i];
            _hr.safeMint(wallet);
        }

        // Mint 10 for deployer wallet
        for (uint i = 0; i < 10; i++) {
            _hr.safeMint(tgDeployerWallet);
        }

        alreadyMinted = true;
    }
}

// File: contracts/tgcasino/HighRollerMinterBatch.sol



// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

import "./HighRoller.sol";
import "./HighRollerMinter.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

contract HighRollerMinterBatch is AccessControl {
    bytes32 public constant STAFF_ROLE = keccak256("STAFF_ROLE");

    HighRoller private immutable _hr = HighRoller(address(0x1fb01aF3828b68D4AD473b07ca8f6D22576b821c));
    HighRollerMinter private immutable _hrm = HighRollerMinter(address(0xC770261Ac650912aFf71C10E71c6b388749366f1));

    address public tgDeployerWallet = 0xa9Ec8C669ec7De986AFfa242925aE2FFaDC6F817;

    constructor() {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(STAFF_ROLE, msg.sender);
    }

    function safeMintBatch(uint from, uint max) public onlyRole(STAFF_ROLE) {
        // Mint 10 for deployer wallet
        for (uint i = from; i < max; i++) {
            address wallet = _hrm.mintToWallets(i);
            _hr.safeMint(wallet);
        }
    }

    function safeMintDeployer() external onlyRole(STAFF_ROLE) {
        // Mint 10 for deployer wallet
        for (uint i = 0; i < 10; i++) {
            _hr.safeMint(tgDeployerWallet);
        }
    }
}